template: add tests for RawContents
This commit is contained in:
parent
99a93009ed
commit
b9eea82a36
@ -2,6 +2,7 @@ package template
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
1
template/test-fixtures/parse-contents.json
Normal file
1
template/test-fixtures/parse-contents.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"builders":[{"type":"test"}]}
|
Loading…
x
Reference in New Issue
Block a user