mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 19:40:54 +00:00
Merge pull request #4244 from AllenX2018/develop
testing: fix temporary create failed on Windows
This commit is contained in:
commit
0b7ece44cf
@ -125,8 +125,8 @@ func TestGetUint64(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAdditionalViewPaths(t *testing.T) {
|
||||
dir1 := "_beeTmp"
|
||||
dir2 := "_beeTmp2"
|
||||
dir1 := tmpDir("TestAdditionalViewPaths1")
|
||||
dir2 := tmpDir("TestAdditionalViewPaths2")
|
||||
defer os.RemoveAll(dir1)
|
||||
defer os.RemoveAll(dir2)
|
||||
|
||||
|
@ -45,8 +45,12 @@ var block = `{{define "block"}}
|
||||
<h1>Hello, blocks!</h1>
|
||||
{{end}}`
|
||||
|
||||
func tmpDir(s string) string {
|
||||
return filepath.Join(os.TempDir(), s)
|
||||
}
|
||||
|
||||
func TestTemplate(t *testing.T) {
|
||||
dir := "_beeTmp"
|
||||
dir := tmpDir("TestTemplate")
|
||||
files := []string{
|
||||
"header.tpl",
|
||||
"index.tpl",
|
||||
@ -107,7 +111,7 @@ var user = `<!DOCTYPE html>
|
||||
`
|
||||
|
||||
func TestRelativeTemplate(t *testing.T) {
|
||||
dir := "_beeTmp"
|
||||
dir := tmpDir("TestRelativeTemplate")
|
||||
|
||||
//Just add dir to known viewPaths
|
||||
if err := AddViewPath(dir); err != nil {
|
||||
@ -218,7 +222,7 @@ var output = `<!DOCTYPE html>
|
||||
`
|
||||
|
||||
func TestTemplateLayout(t *testing.T) {
|
||||
dir := "_beeTmp"
|
||||
dir := tmpDir("TestTemplateLayout")
|
||||
files := []string{
|
||||
"add.tpl",
|
||||
"layout_blog.tpl",
|
||||
|
Loading…
Reference in New Issue
Block a user