Lines Matching defs:String
26 X string
31 // Struct with String method.
42 MSI map[string]int
43 MSIone map[string]int // one element, for deterministic output
44 MSIEmpty map[string]int
47 SMSI []map[string]int
62 PS *string
66 BinaryFunc func(string, string) string
67 VariadicFunc func(...string) string
68 VariadicFuncInt func(int, ...string) string
70 ErrFunc func() (string, error)
77 type S []string
79 func (S) Method0() string {
84 V string
91 func (v *V) String() string {
102 func (w *W) Error() string {
123 MSI: map[string]int{"one": 1, "two": 2, "three": 3},
124 MSIone: map[string]int{"one": 1},
127 SMSI: []map[string]int{
140 PS: newString("a string"),
142 BinaryFunc: func(a, b string) string { return fmt.Sprintf("[%s=%s]", a, b) },
143 VariadicFunc: func(s ...string) string { return fmt.Sprint("<", strings.Join(s, "+"), ">") },
144 VariadicFuncInt: func(a int, s ...string) string { return fmt.Sprint(a, "=<", strings.Join(s, "+"), ">") },
146 ErrFunc: func() (string, error) { return "bla", nil },
152 Method0() string
162 func newString(s string) *string {
174 func (t *T) Method0() string {
182 func (t *T) Method2(a uint16, b string) string {
186 func (t *T) Method3(v interface{}) string {
219 func (u *U) TrueFalse(b bool) string {
226 func typeOf(arg interface{}) string {
231 name string
232 input string
233 output string
238 // bigInt and bigUint are hex string representing numbers either side
280 {"dot string", "<{{.}}>", "<hello>", "hello", true},
282 {"dot map", "<{{.}}>", "<map[two:22]>", map[string]int{"two": 22}, true},
285 b string
294 // Type with String method.
295 {"V{6666}.String()", "-{{.V0}}-", "-<6666>-", tVal, true},
296 {"&V{7777}.String()", "-{{.V1}}-", "-<7777>-", tVal, true},
297 {"(*V)(nil).String()", "-{{.V2}}-", "-nilV-", tVal, true},
306 {"*string", "{{.PS}}", "a string", tVal, true},
314 {"empty with string", "{{.Empty2}}", "empty2", tVal, true},
348 {"Interface Call", `{{stringer .S}}`, "foozle", map[string]interface{}{"S": bytes.NewBufferString("foozle")}, true},
386 {"if string", "{{if `notempty`}}NON-EMPTY{{else}}EMPTY{{end}}", "NON-EMPTY", tVal, true},
406 {"printf string", `{{printf "%s" "hello"}}`, "hello", tVal, true},
419 {"html", `{{html .PS}}`, "a string", tVal, true},
465 {"with string", "{{with `notempty`}}{{.}}{{else}}EMPTY{{end}}", "notempty", tVal, true},
533 {"bug9", "{{.cause}}", "neglect", map[string]string{"cause": "neglect"}, true},
570 func zeroArgs() string {
574 func oneArg(a string) string {
578 func twoArgs(a, b string) string {
582 func dddArg(a int, b ...string) string {
587 func count(n int) chan string {
591 c := make(chan string)
602 func vfunc(V, *V) string {
606 // valueString takes a string, not a pointer.
607 func valueString(v string) string {
628 func makemap(arg ...string) map[string]string {
632 m := make(map[string]string)
639 func stringer(s fmt.Stringer) string {
640 return s.String()
644 return map[string]int{"three": 3}
692 result := b.String()
703 var delimPairs = []string{
713 var value = struct{ Str string }{hello}
729 // Now add an action containing a string.
741 if b.String() != hello+trueLeft {
742 t.Errorf("expected %q got %q", hello+trueLeft, b.String())
794 in, exp string
882 result := b.String()
892 result = b.String()
959 expr string
960 truth string
1090 if b.String() != test.truth {
1091 t.Errorf("%s: want %s; got %s", test.expr, test.truth, b.String())
1097 data := map[string]int{
1111 got := b.String()
1123 got = b.String()
1135 got = b.String()
1153 // Test that the error message for multiline unterminated string
1161 if !strings.Contains(str, "X:3: unexpected unterminated raw quoted string") {
1213 names := []string{
1233 names := []string{
1243 func testBadFuncName(name string, t *testing.T) {
1277 if got := buf.String(); got != want {
1285 if got := buf.String(); got != want2 {
1322 // Before index worked on reflect.Values, the .String could not be
1326 texts := []string{
1327 `{{range .}}{{.String}}{{end}}`,
1328 `{{with index . 0}}{{.String}}{{end}}`,
1337 if buf.String() != "<1>" {
1351 text string
1352 out string
1389 err := tmpl.Execute(&buf, map[string]interface{}{
1410 if buf.String() != tt.out {