Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
2a9852fa
authored
2013-08-01 12:10:56 +0800
by
miraclesu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add template test
1 parent
6fbdbaae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
template_test.go
template_test.go
0 → 100644
View file @
2a9852f
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
Styling with
Markdown
is supported
Attach a file
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 post a comment