@@ -15,8 +15,8 @@ type Test struct {
1515}
1616
1717type Data struct {
18- a bool
19- b string
18+ A bool
19+ B string
2020}
2121
2222type User struct {
@@ -48,7 +48,6 @@ func (u *User) Func5() (*settings, os.Error) {
4848 return & settings {true }, nil
4949}
5050
51-
5251func (u * User ) Func6 () (* vector.Vector , os.Error ) {
5352 var v vector.Vector
5453 v .Push (& settings {true })
@@ -72,6 +71,7 @@ func makeVector(n int) *vector.Vector {
7271}
7372
7473var tests = []Test {
74+
7575 {`hello world` , nil , "hello world" },
7676 {`hello {{name}}` , map [string ]string {"name" : "world" }, "hello world" },
7777 {`{{var}}` , map [string ]string {"var" : "5 > 2" }, "5 > 2" },
@@ -89,21 +89,21 @@ var tests = []Test{
8989 {`{{#has}}{{/has}}` , & User {"Mike" , 1 }, "" },
9090
9191 //section tests
92- {`{{#a }}{{b }}{{/a }}` , Data {true , "hello" }, "hello" },
93- {`{{#a }}{{{b }}}{{/a }}` , Data {true , "5 > 2" }, "5 > 2" },
94- {`{{#a }}{{b }}{{/a }}` , Data {true , "5 > 2" }, "5 > 2" },
95- {`{{#a }}{{b }}{{/a }}` , Data {false , "hello" }, "" },
92+ {`{{#A }}{{B }}{{/A }}` , Data {true , "hello" }, "hello" },
93+ {`{{#A }}{{{B }}}{{/A }}` , Data {true , "5 > 2" }, "5 > 2" },
94+ {`{{#A }}{{B }}{{/A }}` , Data {true , "5 > 2" }, "5 > 2" },
95+ {`{{#A }}{{B }}{{/A }}` , Data {false , "hello" }, "" },
9696 {`{{a}}{{#b}}{{b}}{{/b}}{{c}}` , map [string ]string {"a" : "a" , "b" : "b" , "c" : "c" }, "abc" },
97- {`{{#a }}{{b }}{{/a }}` , struct {
98- a []struct {
99- b string
97+ {`{{#A }}{{B }}{{/A }}` , struct {
98+ A []struct {
99+ B string
100100 }
101101 }{[]struct {
102- b string
102+ B string
103103 }{{"a" }, {"b" }, {"c" }}},
104104 "abc" ,
105105 },
106- {`{{#a }}{{b}}{{/a }}` , struct { a []map [string ]string }{[]map [string ]string {{"b" : "a" }, {"b" : "b" }, {"b" : "c" }}}, "abc" },
106+ {`{{#A }}{{b}}{{/A }}` , struct { A []map [string ]string }{[]map [string ]string {{"b" : "a" }, {"b" : "b" }, {"b" : "c" }}}, "abc" },
107107
108108 {`{{#users}}{{Name}}{{/users}}` , map [string ]interface {}{"users" : []User {{"Mike" , 1 }}}, "Mike" },
109109
@@ -184,14 +184,13 @@ func TestSectionPartial(t *testing.T) {
184184}
185185
186186func TestMultiContext (t * testing.T ) {
187- output := Render (`{{hello}} {{world }}` , map [string ]string {"hello" : "hello" }, struct { world string }{"world" })
188- output2 := Render (`{{hello}} {{world }}` , struct { world string }{"world" }, map [string ]string {"hello" : "hello" })
187+ output := Render (`{{hello}} {{World }}` , map [string ]string {"hello" : "hello" }, struct { World string }{"world" })
188+ output2 := Render (`{{hello}} {{World }}` , struct { World string }{"world" }, map [string ]string {"hello" : "hello" })
189189 if output != "hello world" || output2 != "hello world" {
190190 t .Fatalf ("TestMultiContext expected %q got %q" , "hello world" , output )
191191 }
192192}
193193
194-
195194var malformed = []Test {
196195 {`{{#a}}{{}}{{/a}}` , Data {true , "hello" }, "empty tag" },
197196 {`{{}}` , nil , "empty tag" },
0 commit comments