1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-30 14:04:13 +00:00

Merge pull request #4244 from AllenX2018/develop

testing: fix temporary create failed on Windows
This commit is contained in:
Ming Deng 2020-10-04 18:55:37 +08:00 committed by GitHub
commit 0b7ece44cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -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)

View File

@ -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",