template: add tests for RawContents

This commit is contained in:
Mitchell Hashimoto 2015-05-26 09:41:42 -07:00
parent 99a93009ed
commit b9eea82a36
2 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package template
import (
"reflect"
"strings"
"testing"
"time"
)
@ -284,3 +285,16 @@ func TestParse(t *testing.T) {
}
}
}
func TestParse_contents(t *testing.T) {
tpl, err := ParseFile(fixtureDir("parse-contents.json"))
if err != nil {
t.Fatalf("err: %s", err)
}
actual := strings.TrimSpace(string(tpl.RawContents))
expected := `{"builders":[{"type":"test"}]}`
if actual != expected {
t.Fatalf("bad: %s\n\n%s", actual, expected)
}
}

View File

@ -0,0 +1 @@
{"builders":[{"type":"test"}]}