Refactored TestTemplates
This commit is contained in:
parent
c8530ba7e4
commit
7adc73fa59
1 changed files with 3 additions and 3 deletions
|
@ -43,7 +43,7 @@ func TestTemplates(t *testing.T) {
|
||||||
var err error
|
var err error
|
||||||
templates, err = initTemplates("templates")
|
templates, err = initTemplates("templates")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorQuit(fmt.Errorf("Unable to initialize templates: %s", err))
|
t.Fatalf("Unable to initialize templates: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdData.OutFolder, err = ioutil.TempDir("", "templates")
|
cmdData.OutFolder, err = ioutil.TempDir("", "templates")
|
||||||
|
@ -61,7 +61,7 @@ func TestTemplates(t *testing.T) {
|
||||||
}
|
}
|
||||||
defer tplTestHandle.Close()
|
defer tplTestHandle.Close()
|
||||||
|
|
||||||
tplTestHandle.WriteString(fmt.Sprintf("package %s", cmdData.PkgName))
|
fmt.Fprintf(tplTestHandle, "package %s", cmdData.PkgName)
|
||||||
|
|
||||||
buf := bytes.Buffer{}
|
buf := bytes.Buffer{}
|
||||||
cmd := exec.Command("go", "test", tplFile)
|
cmd := exec.Command("go", "test", tplFile)
|
||||||
|
@ -69,7 +69,7 @@ func TestTemplates(t *testing.T) {
|
||||||
cmd.Stderr = &buf
|
cmd.Stderr = &buf
|
||||||
|
|
||||||
if err = cmd.Run(); err != nil {
|
if err = cmd.Run(); err != nil {
|
||||||
t.Errorf("Unable to execute command 'go test', compile failed?: %s\n\n%s", err, buf.String())
|
t.Errorf("go test cmd execution failed: %s\n\n%s", err, buf.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue