summaryrefslogtreecommitdiffstats
path: root/cnmfmt/cnmfmt_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 /cnmfmt/cnmfmt_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 'cnmfmt/cnmfmt_test.go')
-rw-r--r--cnmfmt/cnmfmt_test.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/cnmfmt/cnmfmt_test.go b/cnmfmt/cnmfmt_test.go
index 5d50b18..2ad92cb 100644
--- a/cnmfmt/cnmfmt_test.go
+++ b/cnmfmt/cnmfmt_test.go
@@ -127,6 +127,9 @@ var parseTests = map[string]Text{
"@@foo ": Text{[]Span{
Span{Format{Link: "foo"}, ""},
}},
+ "@@foo\\ bar baz quux@@": Text{[]Span{
+ Span{Format{Link: "foo bar"}, "baz quux"},
+ }},
"@@foo\\": Text{[]Span{
Span{Format{Link: "foo\\"}, ""},
}},
@@ -213,9 +216,9 @@ func textEqual(a, b Text) bool {
}
var escapeTests = map[string]string{
- "\n\r\t\v\x00": "\\n\\r\\t\v\\x00",
+ "\n\r\t\v\x00": "\\n\\r\\t\v\\x00",
"@@!!##\"\"//\"\"__``**%%^^&&++==\x01\x01\\": "\\@\\@!!##\\\"\\\"//\\\"\\\"\\_\\_\\`\\`\\*\\*%%^^&&++==\x01\x01\\\\",
- `foo\@\@bar`: `foo\\\@\\\@bar`,
+ `foo\@\@bar`: `foo\\\@\\\@bar`,
}
func TestEscape(t *testing.T) {
@@ -269,6 +272,10 @@ var parseTextTests = map[string]TextFmtContents{
Text{[]Span{Span{Format{Emphasized: true}, "foo"}}},
Text{[]Span{Span{Format{}, "bar"}}},
}},
+
+ "@@foo\\ bar baz quux@@": TextFmtContents{[]Text{
+ Text{[]Span{Span{Format{Link: "foo bar"}, "baz quux"}}},
+ }},
}
func TestParseTextFmt(t *testing.T) {
@@ -335,6 +342,10 @@ var writeTests = map[string]TextFmtContents{
}},
}},
+ "@@foo\\ bar baz quux\n": TextFmtContents{[]Text{
+ Text{[]Span{Span{Format{Link: "foo bar"}, "baz quux"}}},
+ }},
+
"foo**bar``baz**quux\n\n" +
"\\ \"\"qwe\\ \"\"__\\ asd \\ __``zxc``**\\ \n\n" +
"__@@http://example.com/__/ exa__mple@@ @@href text@@__ test\n": TextFmtContents{[]Text{