summaryrefslogtreecommitdiffstats
path: root/cnmfmt/cnmfmt_test.go
diff options
context:
space:
mode:
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{