diff options
Diffstat (limited to 'vendor/github.com/tdewolff/parse/html/util_test.go')
-rw-r--r-- | vendor/github.com/tdewolff/parse/html/util_test.go | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/vendor/github.com/tdewolff/parse/html/util_test.go b/vendor/github.com/tdewolff/parse/html/util_test.go deleted file mode 100644 index 3722a08..0000000 --- a/vendor/github.com/tdewolff/parse/html/util_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package html // import "github.com/tdewolff/parse/html" - -import ( - "testing" - - "github.com/tdewolff/test" -) - -func TestEscapeAttrVal(t *testing.T) { - var escapeAttrValTests = []struct { - attrVal string - expected string - }{ - {"xyz", "xyz"}, - {"", ""}, - {"x&z", "x&z"}, - {"x/z", "x/z"}, - {"x'z", "\"x'z\""}, - {"x\"z", "'x\"z'"}, - {"'x\"z'", "'x\"z'"}, - {"'x'\"'z'", "\"x'"'z\""}, - {"\"x"'"z\"", "'x\"'\"z'"}, - {"\"x'z\"", "\"x'z\""}, - {"'x"z'", "'x\"z'"}, - {"'x\">'", "'x\">'"}, - {"You're encouraged to log in; however, it's not mandatory. [o]", "\"You're encouraged to log in; however, it's not mandatory. [o]\""}, - {"a'b=\"\"", "'a'b=\"\"'"}, - {"x<z", "\"x<z\""}, - {"'x\"'\"z'", "'x\"'\"z'"}, - } - var buf []byte - for _, tt := range escapeAttrValTests { - t.Run(tt.attrVal, func(t *testing.T) { - b := []byte(tt.attrVal) - orig := b - if len(b) > 1 && (b[0] == '"' || b[0] == '\'') && b[0] == b[len(b)-1] { - b = b[1 : len(b)-1] - } - val := EscapeAttrVal(&buf, orig, []byte(b)) - test.String(t, string(val), tt.expected) - }) - } -} |