From 8cc788ec597b8ca1d1b7e8249fd0072ae3034124 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 9 Sep 2014 16:10:50 +0800 Subject: New Python implemented test script --- Makefile | 2 +- .../MarkdownTest_1.0.3/Tests/Escape character.html | 51 ------------ .../MarkdownTest_1.0.3/Tests/Escape character.text | 51 ------------ test/Tests/Escape character.html | 51 ++++++++++++ test/Tests/Escape character.text | 51 ++++++++++++ test/config.json | 97 ++++++++++++++++++++++ test/runner.py | 94 +++++++++++++++++++++ test/runner.sh | 50 ----------- 8 files changed, 294 insertions(+), 153 deletions(-) delete mode 100644 test/MarkdownTest_1.0.3/Tests/Escape character.html delete mode 100644 test/MarkdownTest_1.0.3/Tests/Escape character.text create mode 100644 test/Tests/Escape character.html create mode 100644 test/Tests/Escape character.text create mode 100644 test/config.json create mode 100755 test/runner.py delete mode 100755 test/runner.sh diff --git a/Makefile b/Makefile index 998a41d..66ead31 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ src/html_blocks.c: html_block_names.gperf # Testing test: hoedown - test/runner.sh ./hoedown test/MarkdownTest_1.0.3/Tests + test/runner.py test-pl: hoedown perl test/MarkdownTest_1.0.3/MarkdownTest.pl \ diff --git a/test/MarkdownTest_1.0.3/Tests/Escape character.html b/test/MarkdownTest_1.0.3/Tests/Escape character.html deleted file mode 100644 index a6863ba..0000000 --- a/test/MarkdownTest_1.0.3/Tests/Escape character.html +++ /dev/null @@ -1,51 +0,0 @@ -

==Highlight==

- -

~~Strikethrough~~

- -

_Underscore_

- -

_Underscore_

- -

_Underscore_

- -

_Underscore_

- -

_Underscore_

- -

*Asterisk*

- -

*Asterisk*

- -

*Asterisk*

- -

*Asterisk*

- -

*Asterisk*

- -

[Bracket]

- -

(Parenthesis)

- -

<Chevron>

- -

Super^script

- -

`Backtick`

- -

"Quote"

- -

Foo\

- -

Foo\*

- -

Foo\\Bar\

- -

*Foo\Bar\*

- -

Foo]

- -

Foo\

- -

Foo\]

- -

Foo\\

diff --git a/test/MarkdownTest_1.0.3/Tests/Escape character.text b/test/MarkdownTest_1.0.3/Tests/Escape character.text deleted file mode 100644 index 3eab090..0000000 --- a/test/MarkdownTest_1.0.3/Tests/Escape character.text +++ /dev/null @@ -1,51 +0,0 @@ -\==Highlight\== - -\~~Strikethrough\~~ - -\_Underscore\_ - -\__Underscore\__ - -_\_Underscore_\_ - -\__Underscore_\_ - -_\_Underscore\__ - -\*Asterisk\* - -\**Asterisk\** - -\**Asterisk*\* - -*\*Asterisk\** - -*\*Asterisk*\* - -\[Bracket\] - -\(Parenthesis\) - -\ - -Super\^script - -\`Backtick\` - -\"Quote\" - -**Foo\\** - -*Foo\\\** - -**Foo\\\Bar\\** - -*Foo\\Bar\\\* - -[Foo\]](http://example.com) - -[Foo\\](http://example.com) - -[Foo\\\]](http://example.com) - -[Foo\\\\](http://example.com) diff --git a/test/Tests/Escape character.html b/test/Tests/Escape character.html new file mode 100644 index 0000000..a6863ba --- /dev/null +++ b/test/Tests/Escape character.html @@ -0,0 +1,51 @@ +

==Highlight==

+ +

~~Strikethrough~~

+ +

_Underscore_

+ +

_Underscore_

+ +

_Underscore_

+ +

_Underscore_

+ +

_Underscore_

+ +

*Asterisk*

+ +

*Asterisk*

+ +

*Asterisk*

+ +

*Asterisk*

+ +

*Asterisk*

+ +

[Bracket]

+ +

(Parenthesis)

+ +

<Chevron>

+ +

Super^script

+ +

`Backtick`

+ +

"Quote"

+ +

Foo\

+ +

Foo\*

+ +

Foo\\Bar\

+ +

*Foo\Bar\*

+ +

Foo]

+ +

Foo\

+ +

Foo\]

+ +

Foo\\

diff --git a/test/Tests/Escape character.text b/test/Tests/Escape character.text new file mode 100644 index 0000000..3eab090 --- /dev/null +++ b/test/Tests/Escape character.text @@ -0,0 +1,51 @@ +\==Highlight\== + +\~~Strikethrough\~~ + +\_Underscore\_ + +\__Underscore\__ + +_\_Underscore_\_ + +\__Underscore_\_ + +_\_Underscore\__ + +\*Asterisk\* + +\**Asterisk\** + +\**Asterisk*\* + +*\*Asterisk\** + +*\*Asterisk*\* + +\[Bracket\] + +\(Parenthesis\) + +\ + +Super\^script + +\`Backtick\` + +\"Quote\" + +**Foo\\** + +*Foo\\\** + +**Foo\\\Bar\\** + +*Foo\\Bar\\\* + +[Foo\]](http://example.com) + +[Foo\\](http://example.com) + +[Foo\\\]](http://example.com) + +[Foo\\\\](http://example.com) diff --git a/test/config.json b/test/config.json new file mode 100644 index 0000000..cec160c --- /dev/null +++ b/test/config.json @@ -0,0 +1,97 @@ +{ + "tests": [ + { + "input": "MarkdownTest_1.0.3/Tests/Amps and angle encoding.text", + "output": "MarkdownTest_1.0.3/Tests/Amps and angle encoding.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Auto links.text", + "output": "MarkdownTest_1.0.3/Tests/Auto links.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Backslash escapes.text", + "output": "MarkdownTest_1.0.3/Tests/Backslash escapes.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text", + "output": "MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Code Blocks.text", + "output": "MarkdownTest_1.0.3/Tests/Code Blocks.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Code Spans.text", + "output": "MarkdownTest_1.0.3/Tests/Code Spans.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text", + "output": "MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Horizontal rules.text", + "output": "MarkdownTest_1.0.3/Tests/Horizontal rules.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text", + "output": "MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text", + "output": "MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Inline HTML comments.text", + "output": "MarkdownTest_1.0.3/Tests/Inline HTML comments.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Links, inline style.text", + "output": "MarkdownTest_1.0.3/Tests/Links, inline style.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Links, reference style.text", + "output": "MarkdownTest_1.0.3/Tests/Links, reference style.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Links, shortcut references.text", + "output": "MarkdownTest_1.0.3/Tests/Links, shortcut references.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Literal quotes in titles.text", + "output": "MarkdownTest_1.0.3/Tests/Literal quotes in titles.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text", + "output": "MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text", + "output": "MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Nested blockquotes.text", + "output": "MarkdownTest_1.0.3/Tests/Nested blockquotes.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text", + "output": "MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Strong and em together.text", + "output": "MarkdownTest_1.0.3/Tests/Strong and em together.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Tabs.text", + "output": "MarkdownTest_1.0.3/Tests/Tabs.html" + }, + { + "input": "MarkdownTest_1.0.3/Tests/Tidyness.text", + "output": "MarkdownTest_1.0.3/Tests/Tidyness.html" + }, + { + "input": "Tests/Escape character.text", + "output": "Tests/Escape character.html", + "skip": true + } + ] +} diff --git a/test/runner.py b/test/runner.py new file mode 100755 index 0000000..5ebd78f --- /dev/null +++ b/test/runner.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals, print_function +import os +import sys +import copy +import json +import re +import subprocess +import unittest + +DLN = '======================================================================' +SLN = '----------------------------------------------------------------------' +TEST_ROOT = os.path.dirname(__file__) +HOEDOWN = [os.path.join(os.path.dirname(TEST_ROOT), 'hoedown')] +TIDY = ['tidy', '--show-body-only', '1', '--show-warnings', '0', + '--quiet', '1'] +CONFIG_PATH = os.path.join(TEST_ROOT, 'config.json') +SLUGIFY_PATTERN = re.compile(r'\W') + + +class TestFailed(AssertionError): + def __init__(self, name, expected, got): + super(TestFailed, self).__init__(self) + description_format = ( + '{name}\nExpected\n{sln}\n{expected}\n\n' + 'Got\n{sln}\n{got}\n\n' + ) + self.description = description_format.format( + dln=DLN, sln=SLN, name=name, + expected=expected.strip(), got=got.strip(), + ) + + def __str__(self): + return self.description + + +def _test_func(test_case): + flags = test_case.get('flags') or [] + hoedown_proc = subprocess.Popen( + HOEDOWN + flags + [os.path.join(TEST_ROOT, test_case['input'])], + stdout=subprocess.PIPE, + ) + hoedown_proc.wait() + got_tidy_proc = subprocess.Popen( + TIDY, stdin=hoedown_proc.stdout, stdout=subprocess.PIPE, + ) + got_tidy_proc.wait() + got = got_tidy_proc.stdout.read() + + expected_tidy_proc = subprocess.Popen( + TIDY + [os.path.join(TEST_ROOT, test_case['output'])], + stdout=subprocess.PIPE, + ) + expected_tidy_proc.wait() + expected = expected_tidy_proc.stdout.read() + + try: + assert expected == got + except AssertionError: + raise TestFailed(test_case['input'], expected, got) + + +def _make_test(test_case): + return lambda self: _test_func(test_case) + + +class MarkdownTestCaseMeta(type): + """Meta class for ``MarkdownTestCase`` to inject test cases on the fly. + """ + def __new__(meta, name, bases, attrs): + with open(CONFIG_PATH) as f: + config = json.load(f) + + for test in config['tests']: + input_name = test['input'] + attr_name = 'test_' + SLUGIFY_PATTERN.sub( + '_', os.path.splitext(input_name)[0].lower(), + ) + func = _make_test(test) + func.__doc__ = input_name + if test.get('skip', False): + func = unittest.skip(input_name)(func) + attrs[attr_name] = func + return type.__new__(meta, name, bases, attrs) + + +class MarkdownTestCase(unittest.TestCase): + __metaclass__ = MarkdownTestCaseMeta + + +if __name__ == '__main__': + unittest.main() diff --git a/test/runner.sh b/test/runner.sh deleted file mode 100755 index d60eac5..0000000 --- a/test/runner.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -POSIXLY_CORRECT=1 -export POSIXLY_CORRECT - -TIDY='tidy --show-body-only 1 --quiet 1 --show-warnings 0' -SCRIPT="$1" -TESTDIR="$2" -PASSED=0 -FAILED=0 - -abort() { - echo "Error: $*" - exit 1 -} - -test -f "$SCRIPT" || abort "argument #1 invalid; not a file" -test -x "$SCRIPT" || abort "argument #1 invalid; not executable" -echo "" | "$SCRIPT" || abort "argument #1 invalid; script failed to run" -test -d "$TESTDIR" || abort "argument #2 invalid; not a directory" - -for TEXT in "$TESTDIR"/*.text; do - test -f "$TEXT" || abort "empty or invalid test directory" - printf "$(basename "$TEXT" .text) ... " - HTML=$(echo "$TEXT" | sed 's/\.text$/.html/') - - # We use mktemp to create an unpredictable, temporary filename. - # The created file is immediately deleted, since we only want a - # name to pass to mkfifo and "mktemp -u" is not portable. - PIPE=$(mktemp .testpipe-XXXXXXXX) - test -f "$PIPE" -a -n "$PIPE" || abort "mktemp failed" - trap 'rm -f "$PIPE"' EXIT INT TERM HUP - rm -f "$PIPE" - mkfifo -m 0600 "$PIPE" || abort "unable to create named pipe" - - $SCRIPT "$TEXT" | $TIDY > "$PIPE" & - DIFF=$($TIDY "$HTML" | diff "$PIPE" -) - if test "$?" = 0; then - PASSED=$(expr $PASSED + 1) - echo OK - else - FAILED=$(expr $FAILED + 1) - echo FAILED - printf "\n$DIFF\n\n" - fi - rm -f "$PIPE" -done - -printf "\n\n$PASSED passed; $FAILED failed.\n" -test "$FAILED" = 0 || exit 1 -- cgit v1.2.1 From b49d385be355e08536974e98e8644609319e596f Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 9 Sep 2014 16:30:01 +0800 Subject: Add math test (modified) and tweak runner --- test/Tests/Math.html | 31 +++++++++++++++++++++++++++++++ test/Tests/Math.text | 31 +++++++++++++++++++++++++++++++ test/config.json | 5 +++++ test/runner.py | 9 +++++---- 4 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 test/Tests/Math.html create mode 100644 test/Tests/Math.text diff --git a/test/Tests/Math.html b/test/Tests/Math.html new file mode 100644 index 0000000..5e2fd3e --- /dev/null +++ b/test/Tests/Math.html @@ -0,0 +1,31 @@ +

\[ +1*2*3 multi-line math +\]

+ +

\( 1*2*3 inline-math \)

+ +

\[ 1*2*3 math with dollar \]

+ +

\[ 1*2*3 \$ \\ \text{dollar with escapes} \]

+ +

\( \\ \text{backslash with escapes} \$ 1*2*3 \)

+ +

( not really math )

+ +

$$ also not math $$

+ +

this$$ should not be$$ math

+ +

nor $$ should $$this

+ +

this \(*should* be\) math

+ +

Something \{ like math but \} is not

+ +

Also \(like math but \) is not

+ +

\\( should not be math either \\)

+ +

This is \( math, and the \\\( inner one \\\) should be \) preserved

+ +

\[ did you <em> know </em> this is math? \]

diff --git a/test/Tests/Math.text b/test/Tests/Math.text new file mode 100644 index 0000000..789c213 --- /dev/null +++ b/test/Tests/Math.text @@ -0,0 +1,31 @@ +\\[ +1*2*3 multi-line math +\\] + +\\( 1*2*3 inline-math \\) + +$$ 1*2*3 math with dollar $$ + +$$ 1*2*3 \$ \\ \text{dollar with escapes} $$ + +\\( \\ \text{backslash with escapes} \$ 1*2*3 \\) + +\( not *really* math \) + +\$$ also *not* math \$$ + +this$$ should *not* be$$ math + +nor $$ *should* $$this + +this $$*should* be$$ math + +Something \\{ like *math* but \\} is not + +Also \\\(like *math* but \\\) is not + +\\\\( should not be *math* either \\\\) + +This is \\( math, and the \\\( inner one \\\) should be \\) preserved + +$$ did you know this is math? $$ diff --git a/test/config.json b/test/config.json index cec160c..bc6799c 100644 --- a/test/config.json +++ b/test/config.json @@ -92,6 +92,11 @@ "input": "Tests/Escape character.text", "output": "Tests/Escape character.html", "skip": true + }, + { + "input": "Tests/Math.text", + "output": "Tests/Math.html", + "flags": ["--math"] } ] } diff --git a/test/runner.py b/test/runner.py index 5ebd78f..fb64375 100755 --- a/test/runner.py +++ b/test/runner.py @@ -2,18 +2,19 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function -import os -import sys -import copy +import difflib import json +import os import re +import sys import subprocess import unittest DLN = '======================================================================' SLN = '----------------------------------------------------------------------' TEST_ROOT = os.path.dirname(__file__) -HOEDOWN = [os.path.join(os.path.dirname(TEST_ROOT), 'hoedown')] +PROJECT_ROOT = os.path.dirname(TEST_ROOT) +HOEDOWN = [os.path.abspath(os.path.join(PROJECT_ROOT, 'hoedown'))] TIDY = ['tidy', '--show-body-only', '1', '--show-warnings', '0', '--quiet', '1'] CONFIG_PATH = os.path.join(TEST_ROOT, 'config.json') -- cgit v1.2.1 From 95ab7bb92fbe8230c96b3513a4714b61bb52bbb9 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 9 Sep 2014 17:14:16 +0800 Subject: Enable escape character test --- test/config.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/config.json b/test/config.json index bc6799c..63cb1d7 100644 --- a/test/config.json +++ b/test/config.json @@ -90,8 +90,7 @@ }, { "input": "Tests/Escape character.text", - "output": "Tests/Escape character.html", - "skip": true + "output": "Tests/Escape character.html" }, { "input": "Tests/Math.text", -- cgit v1.2.1 From 6510aa4b76de4aa577d5cf394e8e629857052853 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 9 Sep 2014 17:14:38 +0800 Subject: Use difflib to make error friendly --- test/runner.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/test/runner.py b/test/runner.py index fb64375..6951d1d 100755 --- a/test/runner.py +++ b/test/runner.py @@ -24,13 +24,9 @@ SLUGIFY_PATTERN = re.compile(r'\W') class TestFailed(AssertionError): def __init__(self, name, expected, got): super(TestFailed, self).__init__(self) - description_format = ( - '{name}\nExpected\n{sln}\n{expected}\n\n' - 'Got\n{sln}\n{got}\n\n' - ) - self.description = description_format.format( - dln=DLN, sln=SLN, name=name, - expected=expected.strip(), got=got.strip(), + diff = difflib.unified_diff(expected.splitlines(), got.splitlines(), 'Expected', 'Got') + self.description = '{name}\n{diff}'.format( + name=name, diff='\n'.join(diff), ) def __str__(self): @@ -48,14 +44,14 @@ def _test_func(test_case): TIDY, stdin=hoedown_proc.stdout, stdout=subprocess.PIPE, ) got_tidy_proc.wait() - got = got_tidy_proc.stdout.read() + got = got_tidy_proc.stdout.read().strip() expected_tidy_proc = subprocess.Popen( TIDY + [os.path.join(TEST_ROOT, test_case['output'])], stdout=subprocess.PIPE, ) expected_tidy_proc.wait() - expected = expected_tidy_proc.stdout.read() + expected = expected_tidy_proc.stdout.read().strip() try: assert expected == got -- cgit v1.2.1 From 9a2166db3cd1da2a2b2e6eb62539039dff12d399 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 9 Sep 2014 17:16:08 +0800 Subject: Cleanup --- test/runner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/runner.py b/test/runner.py index 6951d1d..0d5f724 100755 --- a/test/runner.py +++ b/test/runner.py @@ -6,7 +6,6 @@ import difflib import json import os import re -import sys import subprocess import unittest @@ -24,7 +23,10 @@ SLUGIFY_PATTERN = re.compile(r'\W') class TestFailed(AssertionError): def __init__(self, name, expected, got): super(TestFailed, self).__init__(self) - diff = difflib.unified_diff(expected.splitlines(), got.splitlines(), 'Expected', 'Got') + diff = difflib.unified_diff( + expected.splitlines(), got.splitlines(), + fromfile='Expected', tofile='Got', + ) self.description = '{name}\n{diff}'.format( name=name, diff='\n'.join(diff), ) -- cgit v1.2.1 From 855bc34742e710391588c95471014958f14c39d7 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 9 Sep 2014 17:45:24 +0800 Subject: Make test script Python 3-compatible --- Makefile | 2 +- test/runner.py | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 66ead31..56e1597 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ src/html_blocks.c: html_block_names.gperf # Testing test: hoedown - test/runner.py + python test/runner.py test-pl: hoedown perl test/MarkdownTest_1.0.3/MarkdownTest.pl \ diff --git a/test/runner.py b/test/runner.py index 0d5f724..693a0ea 100755 --- a/test/runner.py +++ b/test/runner.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import unicode_literals, print_function +from __future__ import print_function import difflib import json import os @@ -20,6 +20,17 @@ CONFIG_PATH = os.path.join(TEST_ROOT, 'config.json') SLUGIFY_PATTERN = re.compile(r'\W') +def with_metaclass(meta, *bases): + """Metaclass injection utility from six. + + See: https://pythonhosted.org/six/ + """ + class metaclass(meta): + def __new__(cls, name, this_bases, d): + return meta(name, bases, d) + return type.__new__(metaclass, 'temporary_class', (), {}) + + class TestFailed(AssertionError): def __init__(self, name, expected, got): super(TestFailed, self).__init__(self) @@ -55,6 +66,11 @@ def _test_func(test_case): expected_tidy_proc.wait() expected = expected_tidy_proc.stdout.read().strip() + # Cleanup. + hoedown_proc.stdout.close() + got_tidy_proc.stdout.close() + expected_tidy_proc.stdout.close() + try: assert expected == got except AssertionError: @@ -65,7 +81,7 @@ def _make_test(test_case): return lambda self: _test_func(test_case) -class MarkdownTestCaseMeta(type): +class MarkdownTestsMeta(type): """Meta class for ``MarkdownTestCase`` to inject test cases on the fly. """ def __new__(meta, name, bases, attrs): @@ -85,8 +101,8 @@ class MarkdownTestCaseMeta(type): return type.__new__(meta, name, bases, attrs) -class MarkdownTestCase(unittest.TestCase): - __metaclass__ = MarkdownTestCaseMeta +class MarkdownTests(with_metaclass(MarkdownTestsMeta, unittest.TestCase)): + pass if __name__ == '__main__': -- cgit v1.2.1 From 9a0c20d1ad5773be370f1c3e4a2b84f8feb0b5fd Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 9 Sep 2014 17:57:49 +0800 Subject: Add "fail" flag for expected failure Might be useful someday. --- test/runner.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/runner.py b/test/runner.py index 693a0ea..3c5e547 100755 --- a/test/runner.py +++ b/test/runner.py @@ -97,6 +97,8 @@ class MarkdownTestsMeta(type): func.__doc__ = input_name if test.get('skip', False): func = unittest.skip(input_name)(func) + if test.get('fail', False): + func = unittest.expectsFailure(func) attrs[attr_name] = func return type.__new__(meta, name, bases, attrs) -- cgit v1.2.1 From 00a5b7abc25a3f88afb7f4f44c1328a119343270 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 9 Sep 2014 17:59:15 +0800 Subject: Cleanup --- test/runner.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/runner.py b/test/runner.py index 3c5e547..4102fad 100755 --- a/test/runner.py +++ b/test/runner.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import print_function import difflib import json import os @@ -9,8 +8,6 @@ import re import subprocess import unittest -DLN = '======================================================================' -SLN = '----------------------------------------------------------------------' TEST_ROOT = os.path.dirname(__file__) PROJECT_ROOT = os.path.dirname(TEST_ROOT) HOEDOWN = [os.path.abspath(os.path.join(PROJECT_ROOT, 'hoedown'))] -- cgit v1.2.1