diff --git a/src/content/sanitizer/sanitizer_test.go b/src/content/sanitizer/sanitizer_test.go index 8f49f05..53ffb3d 100644 --- a/src/content/sanitizer/sanitizer_test.go +++ b/src/content/sanitizer/sanitizer_test.go @@ -8,10 +8,11 @@ import "testing" func TestValidInput(t *testing.T) { input := `
This is a text with an image: .
This is a text with an image: .
`
- expected := `
`
- output := Sanitize("http://example.org/", input)
+ want := `
`
+ have := Sanitize("http://example.org/", input)
- if output != expected {
- t.Errorf(`Wrong output: %s`, output)
+ if have != want {
+ t.Errorf("Wrong output:\nwant: %s\nhave: %s", want, have)
}
}
func TestImgWithSrcsetAndDataURL(t *testing.T) {
input := `
`
- expected := `
`
- output := Sanitize("http://example.org/", input)
+ want := `
`
+ have := Sanitize("http://example.org/", input)
- if output != expected {
- t.Errorf(`Wrong output: %s`, output)
+ if have != want {
+ t.Errorf("Wrong output:\nwant: %s\nhave: %s", want, have)
}
}
@@ -67,16 +68,16 @@ func TestSourceWithSrcsetAndMedia(t *testing.T) {
func TestMediumImgWithSrcset(t *testing.T) {
input := `
`
- expected := `
`
- output := Sanitize("http://example.org/", input)
+ want := `
`
+ have := Sanitize("http://example.org/", input)
- if output != expected {
- t.Errorf(`Wrong output: %s`, output)
+ if have != want {
+ t.Errorf("Wrong output:\nwant: %s\nhave: %s", want, have)
}
}
func TestSelfClosingTags(t *testing.T) {
- input := `This
is a text
with an image: .
This
is a text
.
`
- expected := `This link is relative and this image:
`
- output := Sanitize("http://example.org/", input)
+ want := `This link is relative and this image:
`
+ have := Sanitize("http://example.org/", input)
- if expected != output {
- t.Errorf(`Wrong output: "%s" != "%s"`, expected, output)
+ if want != have {
+ t.Errorf("Wrong output:\nwant: %s\nhave: %s", want, have)
}
}
@@ -165,11 +166,11 @@ func TestInvalidNestedTag(t *testing.T) {
func TestValidIFrame(t *testing.T) {
input := ``
- expected := ``
- output := Sanitize("http://example.org/", input)
+ want := ``
+ have := Sanitize("http://example.org/", input)
- if expected != output {
- t.Errorf("Wrong output:\nwant: %s\nhave: %s", expected, output)
+ if want != have {
+ t.Errorf("Wrong output:\nwant: %s\nhave: %s", want, have)
}
}