"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tpl/internal/go_templates/htmltemplate/content_test.go" between
hugo-0.80.0.tar.gz and hugo-0.81.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

content_test.go  (hugo-0.80.0):content_test.go  (hugo-0.81.0)
skipping to change at line 407 skipping to change at line 407
} }
if want, got := test.want[i], b.String()[pre:b.Len()-post ]; want != got { if want, got := test.want[i], b.String()[pre:b.Len()-post ]; want != got {
t.Errorf("%q with %v:\nwant\n\t%q,\ngot\n\t%q\n", test.input, x, want, got) t.Errorf("%q with %v:\nwant\n\t%q,\ngot\n\t%q\n", test.input, x, want, got)
continue continue
} }
} }
} }
} }
// Test that we print using the String method. Was issue 3073. // Test that we print using the String method. Was issue 3073.
type stringer struct { type myStringer struct {
v int v int
} }
func (s *stringer) String() string { func (s *myStringer) String() string {
return fmt.Sprintf("string=%d", s.v) return fmt.Sprintf("string=%d", s.v)
} }
type errorer struct { type errorer struct {
v int v int
} }
func (s *errorer) Error() string { func (s *errorer) Error() string {
return fmt.Sprintf("error=%d", s.v) return fmt.Sprintf("error=%d", s.v)
} }
func TestStringer(t *testing.T) { func TestStringer(t *testing.T) {
s := &stringer{3} s := &myStringer{3}
b := new(bytes.Buffer) b := new(bytes.Buffer)
tmpl := Must(New("x").Parse("{{.}}")) tmpl := Must(New("x").Parse("{{.}}"))
if err := tmpl.Execute(b, s); err != nil { if err := tmpl.Execute(b, s); err != nil {
t.Fatal(err) t.Fatal(err)
} }
var expect = "string=3" var expect = "string=3"
if b.String() != expect { if b.String() != expect {
t.Errorf("expected %q got %q", expect, b.String()) t.Errorf("expected %q got %q", expect, b.String())
} }
e := &errorer{7} e := &errorer{7}
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)