summaryrefslogtreecommitdiffstats
path: root/simpletext_test.go
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2021-12-23 01:54:47 +0000
committerclsr <clsr@clsr.net>2021-12-23 02:51:49 +0000
commit43428e759d9fbc5a319c2b929bfb4469938cc386 (patch)
tree1ee452ff23249bf10653481599f8639aa46ceb25 /simpletext_test.go
parent690a7183d7eca35b59e23e556b0c6492df08ffa5 (diff)
downloadcnm-go-master.tar.gz
cnm-go-master.zip
Add EscapeAll and escape all spaces in linksHEADv0.4.2master
Diffstat (limited to 'simpletext_test.go')
-rw-r--r--simpletext_test.go29
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",