diff options
author | clsr <clsr@clsr.net> | 2021-12-23 01:54:47 +0000 |
---|---|---|
committer | clsr <clsr@clsr.net> | 2021-12-23 02:51:49 +0000 |
commit | 43428e759d9fbc5a319c2b929bfb4469938cc386 (patch) | |
tree | 1ee452ff23249bf10653481599f8639aa46ceb25 /simpletext_test.go | |
parent | 690a7183d7eca35b59e23e556b0c6492df08ffa5 (diff) | |
download | cnm-go-master.tar.gz cnm-go-master.zip |
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", |