github.com/coveo/gotemplate@v2.7.7+incompatible/collections/implementation/dict_helper_test.go (about) 1 package implementation 2 3 import "testing" 4 5 func Test_baseDict_String(t *testing.T) { 6 t.Parallel() 7 8 tests := []struct { 9 name string 10 d baseDict 11 want string 12 }{ 13 {"nil", nil, "dict[]"}, 14 {"Empty List", baseDict{}, "dict[]"}, 15 {"Map", dictFixture, "dict[float:1.23 int:123 list:[1 two] listInt:[1 2 3] map:dict[sub1:1 sub2:two] mapInt:dict[1:1 2:two] string:Foo bar]"}, 16 } 17 for _, tt := range tests { 18 t.Run(tt.name, func(t *testing.T) { 19 if got := tt.d.String(); got != tt.want { 20 t.Errorf("dict.String():\ngot %v\nwant %v", got, tt.want) 21 } 22 }) 23 } 24 }