test/run-testsuite.py: Allow disabling normalisation on per-unittest basis. And use it for few tests in regressions.txt where the whitespace matters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
diff --git a/test/regressions.txt b/test/regressions.txt
index b251443..284a532 100644
--- a/test/regressions.txt
+++ b/test/regressions.txt
@@ -690,14 +690,14 @@ _*xx-_-
If from one side (and the other has no space/newline), replace new line with
space.
-```````````````````````````````` example
+```````````````````````````````` example [no-normalize]
`
foo`
.
<p><code> foo</code></p>
````````````````````````````````
-```````````````````````````````` example
+```````````````````````````````` example [no-normalize]
`foo
`
.
@@ -706,7 +706,7 @@ foo`
If from both side, eat it.
-```````````````````````````````` example
+```````````````````````````````` example [no-normalize]
`
foo
`
@@ -714,6 +714,7 @@ foo
<p><code>foo</code></p>
````````````````````````````````
+
## [Issue 226](https://github.com/mity/md4c/issues/226)
```````````````````````````````` example
diff --git a/test/run-testsuite.py b/test/run-testsuite.py
index 50f1252..8eaa275 100644
--- a/test/run-testsuite.py
+++ b/test/run-testsuite.py
@@ -42,7 +42,7 @@ def do_test(test, normalize, result_counts):
if retcode == 0:
expected_html = test['html']
unicode_error = None
- if normalize:
+ if normalize and not test['no_normalize']:
try:
passed = normalize_html(actual_html) == normalize_html(expected_html)
except UnicodeDecodeError as e:
@@ -84,6 +84,7 @@ def get_tests(specfile):
state = 0 # 0 regular text, 1 markdown example, 2 html output
headertext = ''
tests = []
+ no_normalize = 0
header_re = re.compile('#+ ')
@@ -93,6 +94,8 @@ def get_tests(specfile):
l = line.strip()
if re.match("`{32} example( [a-z]{1,})?", l):
state = 1
+ if re.search("\\[no-normalize\\]", l):
+ no_normalize = 1
elif state >= 2 and l == "`" * 32:
state = 0
example_number = example_number + 1
@@ -100,15 +103,17 @@ def get_tests(specfile):
tests.append({
"markdown":''.join(markdown_lines).replace('→',"\t"),
"html":''.join(html_lines).replace('→',"\t"),
+ "no_normalize": no_normalize,
"cmdline_options":''.join(cmdline_lines),
"example": example_number,
"start_line": start_line,
"end_line": end_line,
- "section": headertext})
+ "section": headertext,})
start_line = 0
markdown_lines = []
html_lines = []
cmdline_lines = []
+ no_normalize = 0
elif l == ".":
state += 1
elif state == 1: