aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/text/template/exec_test.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2011-11-17 22:53:23 -0800
committerRob Pike <r@golang.org>2011-11-17 22:53:23 -0800
commit25d2987dd93e1fa0d325af440a69e26fc0c9ee0e (patch)
tree252211315a2860306a321050424c3c763f110ac5 /src/pkg/text/template/exec_test.go
parentbbf952c3b4c5d7beb15c5c2a0ffb20f02323e6ea (diff)
downloadgo-25d2987dd93e1fa0d325af440a69e26fc0c9ee0e.tar.xz
text/template: refactor set parsing
Parse {{define}} blocks during template parsing rather than separately as a set-specific thing. This cleans up set parse significantly, and enables the next step, if we want, to unify the API for templates and sets. Other than an argument change to parse.Parse, which is in effect an internal function and unused by client code, there is no API change and no spec change yet. R=golang-dev, rsc, r CC=golang-dev https://golang.org/cl/5393049
Diffstat (limited to 'src/pkg/text/template/exec_test.go')
-rw-r--r--src/pkg/text/template/exec_test.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pkg/text/template/exec_test.go b/src/pkg/text/template/exec_test.go
index 5721667641..67b9416cd7 100644
--- a/src/pkg/text/template/exec_test.go
+++ b/src/pkg/text/template/exec_test.go
@@ -487,7 +487,11 @@ func testExecute(execTests []execTest, set *Set, t *testing.T) {
}
for _, test := range execTests {
tmpl := New(test.name).Funcs(funcs)
- _, err := tmpl.ParseInSet(test.input, set)
+ theSet := set
+ if theSet == nil {
+ theSet = new(Set)
+ }
+ _, err := tmpl.ParseInSet(test.input, theSet)
if err != nil {
t.Errorf("%s: parse error: %s", test.name, err)
continue