diff options
Diffstat (limited to 'simpletext_test.go')
-rw-r--r-- | simpletext_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/simpletext_test.go b/simpletext_test.go index c5b4cf9..d75a741 100644 --- a/simpletext_test.go +++ b/simpletext_test.go @@ -92,6 +92,35 @@ func TestEscapeSpace(t *testing.T) { } } +var allEscapes = map[string]string{ + "": ``, + "ContNet": `ContNet`, + "\t": `\t`, + "\n": `\n`, + "\f": `\f`, + "\r": `\r`, + " ": `\ `, + "\\": `\\`, + "\x00": `\x00`, + " ": `\ \ \ \ \ \ \ `, + " ": `\ \ \ \ \ \ `, + " ": `\ \ \ \ `, + " ": `\ \ \ `, + " ": `\ \ `, + "\b\v\\\x00\xff\u00ff\\xff": "\b\v\\\\\\x00\xff\u00ff\\\\xff", +} + +func TestEscapeAll(t *testing.T) { + for k, v := range allEscapes { + t.Run(k, func(t *testing.T) { + e := EscapeAll(k) + if e != v { + t.Errorf("EscapeAll(%q) -> %q, expected %q", k, e, v) + } + }) + } +} + var simpleUnescapes = map[string]string{ ``: "", `ContNet`: "ContNet", |