From 26d1dab349a31b98ca9f3196f1eb281832822a10 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Fri, 10 Oct 2014 08:26:17 +0400 Subject: [PATCH] Add more tests + a benchmark case --- benchmark/samples/inline-links-nested.md | 2 + test/fixtures/remarkable/regression.txt | 19 +++++++ test/fixtures/remarkable/strikeout.txt | 64 +++++++++++++++++++++++- 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/remarkable/regression.txt diff --git a/benchmark/samples/inline-links-nested.md b/benchmark/samples/inline-links-nested.md index 85cf9b6..4e7dc85 100644 --- a/benchmark/samples/inline-links-nested.md +++ b/benchmark/samples/inline-links-nested.md @@ -9,3 +9,5 @@ Invalid links: [[[[[[[[[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ + +![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![ diff --git a/test/fixtures/remarkable/regression.txt b/test/fixtures/remarkable/regression.txt new file mode 100644 index 0000000..7263b62 --- /dev/null +++ b/test/fixtures/remarkable/regression.txt @@ -0,0 +1,19 @@ + +Regression tests for link backtracking optimizations: + +. +[[some unrelated text [link] + +[link]: foo +. +

[[some unrelated text link

+. + +. +[[some unrelated text [[link]] + +[[link]]: foo +. +

[[some unrelated text [link]

+. + diff --git a/test/fixtures/remarkable/strikeout.txt b/test/fixtures/remarkable/strikeout.txt index 8a7c05e..78f3e45 100644 --- a/test/fixtures/remarkable/strikeout.txt +++ b/test/fixtures/remarkable/strikeout.txt @@ -2,4 +2,66 @@ ~~Strikeout~~ .

Strikeout

-. \ No newline at end of file +. + + +These are not strikeouts, you have to use exactly two "~~": +. +x ~~~foo~~~ + +x ~~foo~~~ + +x ~~~foo~~ +. +

x ~~~foo~~~

+

x ~~foo~~~

+

x ~~~foo~~

+. + +Strikeouts have the same priority as emphases: + +. +**~~test**~~ + +~~**test~~** +. +

~~test~~

+

**test**

+. + +Strikeouts have the same priority as emphases with respect to links: +. +[~~link]()~~ + +~~[link~~]() +. +

~~link~~

+

~~link~~

+. + +Strikeouts have the same priority as emphases with respect to backticks: +. +~~`code~~` + +`~~code`~~ +. +

~~code~~

+

~~code~~

+. + +Nested strikeouts: +. +~~foo ~~bar~~ baz~~ + +~~f **o ~~o b~~ a** r~~ +. +

foo bar baz

+

f o o b a r

+. + +Should not have a whitespace between text and "~~": +. +foo ~~ bar ~~ baz +. +

foo ~~ bar ~~ baz

+.