mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 22:00:55 +00:00
testing: fix temporary create failed on Windows
We are creating temporary files on the root directory of beego now This PR using system temporary directory for testing. Fixes #4243
This commit is contained in:
parent
f6519b29a8
commit
6ffbc0a2b8
@ -125,8 +125,8 @@ func TestGetUint64(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAdditionalViewPaths(t *testing.T) {
|
func TestAdditionalViewPaths(t *testing.T) {
|
||||||
dir1 := "_beeTmp"
|
dir1 := tmpDir("TestAdditionalViewPaths1")
|
||||||
dir2 := "_beeTmp2"
|
dir2 := tmpDir("TestAdditionalViewPaths2")
|
||||||
defer os.RemoveAll(dir1)
|
defer os.RemoveAll(dir1)
|
||||||
defer os.RemoveAll(dir2)
|
defer os.RemoveAll(dir2)
|
||||||
|
|
||||||
|
@ -45,8 +45,12 @@ var block = `{{define "block"}}
|
|||||||
<h1>Hello, blocks!</h1>
|
<h1>Hello, blocks!</h1>
|
||||||
{{end}}`
|
{{end}}`
|
||||||
|
|
||||||
|
func tmpDir(s string) string {
|
||||||
|
return filepath.Join(os.TempDir(), s)
|
||||||
|
}
|
||||||
|
|
||||||
func TestTemplate(t *testing.T) {
|
func TestTemplate(t *testing.T) {
|
||||||
dir := "_beeTmp"
|
dir := tmpDir("TestTemplate")
|
||||||
files := []string{
|
files := []string{
|
||||||
"header.tpl",
|
"header.tpl",
|
||||||
"index.tpl",
|
"index.tpl",
|
||||||
@ -107,7 +111,7 @@ var user = `<!DOCTYPE html>
|
|||||||
`
|
`
|
||||||
|
|
||||||
func TestRelativeTemplate(t *testing.T) {
|
func TestRelativeTemplate(t *testing.T) {
|
||||||
dir := "_beeTmp"
|
dir := tmpDir("TestRelativeTemplate")
|
||||||
|
|
||||||
//Just add dir to known viewPaths
|
//Just add dir to known viewPaths
|
||||||
if err := AddViewPath(dir); err != nil {
|
if err := AddViewPath(dir); err != nil {
|
||||||
@ -218,7 +222,7 @@ var output = `<!DOCTYPE html>
|
|||||||
`
|
`
|
||||||
|
|
||||||
func TestTemplateLayout(t *testing.T) {
|
func TestTemplateLayout(t *testing.T) {
|
||||||
dir := "_beeTmp"
|
dir := tmpDir("TestTemplateLayout")
|
||||||
files := []string{
|
files := []string{
|
||||||
"add.tpl",
|
"add.tpl",
|
||||||
"layout_blog.tpl",
|
"layout_blog.tpl",
|
||||||
|
Loading…
Reference in New Issue
Block a user