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:
.
`
- output := Sanitize("http://example.org/", input)
+ want := `This is a text with an image:
.
`
+ have := Sanitize("http://example.org/", input)
- if input != output {
- t.Errorf(`Wrong output: "%s" != "%s"`, input, output)
+ if have != want {
+ t.Errorf("Wrong output: \nwant: %#v\nhave: %#v", want, have)
}
}
@@ -27,31 +28,31 @@ func TestImgWithTextDataURL(t *testing.T) {
func TestImgWithDataURL(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 TestImgWithSrcset(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 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:
.
`
+ input := `This
is a text
.
`
output := Sanitize("http://example.org/", input)
if input != output {
@@ -95,11 +96,11 @@ func TestTable(t *testing.T) {
func TestRelativeURL(t *testing.T) {
input := `This link is relative and this image:
`
- 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)
}
}