Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
2a9852fa
Commit
2a9852fa
authored
Aug 01, 2013
by
miraclesu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add template test
parent
6fbdbaae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
template_test.go
template_test.go
+49
-0
No files found.
template_test.go
0 → 100644
View file @
2a9852fa
package
beego
import
(
"os"
"path/filepath"
"testing"
)
func
TestBuildTemplate
(
t
*
testing
.
T
)
{
dir
:=
"_beeTmp"
files
:=
[]
string
{
"1.tpl"
,
"2.html"
,
"3.htmltpl"
,
"4.mystyle"
,
}
if
err
:=
os
.
MkdirAll
(
dir
,
0777
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
for
_
,
name
:=
range
files
{
if
_
,
err
:=
os
.
Create
(
filepath
.
Join
(
dir
,
name
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
if
err
:=
BuildTemplate
(
dir
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
len
(
BeeTemplates
)
!=
1
{
t
.
Fatalf
(
"should be 1 but got %v"
,
len
(
BeeTemplates
))
}
for
_
,
v
:=
range
BeeTemplates
{
if
len
(
v
.
Templates
())
!=
3
{
t
.
Errorf
(
"should be 3 but got %v"
,
len
(
v
.
Templates
()))
}
}
AddTemplateExt
(
"mystyle"
)
if
err
:=
BuildTemplate
(
dir
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
len
(
BeeTemplates
)
!=
1
{
t
.
Fatalf
(
"should be 1 but got %v"
,
len
(
BeeTemplates
))
}
for
_
,
v
:=
range
BeeTemplates
{
if
len
(
v
.
Templates
())
!=
4
{
t
.
Errorf
(
"should be 4 but got %v"
,
len
(
v
.
Templates
()))
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment