| 1 |
// Copyright 2019 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package html |
| 6 |
|
| 7 |
import "testing" |
| 8 |
|
| 9 |
func FuzzEscapeUnescape(f *testing.F) { |
| 10 |
f.Fuzz(func(t *testing.T, v string) { |
| 11 |
e := EscapeString(v) |
| 12 |
u := UnescapeString(e) |
| 13 |
if u != v { |
| 14 |
t.Errorf("EscapeString(%q) = %q, UnescapeString(%q) = %q, want %q", v, e, e, u, v) |
| 15 |
} |
| 16 |
|
| 17 |
// As per the documentation, this isn't always equal to v, so it makes |
| 18 |
// no sense to check for equality. It can still be interesting to find |
| 19 |
// panics in it though. |
| 20 |
EscapeString(UnescapeString(v)) |
| 21 |
}) |
| 22 |
} |