diff options
Diffstat (limited to 'tests/test-minirst.py')
-rw-r--r-- | tests/test-minirst.py | 76 |
1 files changed, 32 insertions, 44 deletions
diff --git a/tests/test-minirst.py b/tests/test-minirst.py index df5fbb6..52475c1 100644 --- a/tests/test-minirst.py +++ b/tests/test-minirst.py @@ -1,30 +1,19 @@ from pprint import pprint from mercurial import minirst -def debugformat(text, form, **kwargs): - if form == 'html': - print "html format:" - out = minirst.format(text, style=form, **kwargs) - else: - print "%d column format:" % form - out = minirst.format(text, width=form, **kwargs) - +def debugformat(title, text, width, **kwargs): + print "%s formatted to fit within %d characters:" % (title, width) print "-" * 70 - if type(out) == tuple: - print out[0][:-1] + formatted = minirst.format(text, width, **kwargs) + if type(formatted) == tuple: + print formatted[0] print "-" * 70 - pprint(out[1]) + pprint(formatted[1]) else: - print out[:-1] + print formatted print "-" * 70 print -def debugformats(title, text, **kwargs): - print "== %s ==" % title - debugformat(text, 60, **kwargs) - debugformat(text, 30, **kwargs) - debugformat(text, 'html', **kwargs) - paragraphs = """ This is some text in the first paragraph. @@ -34,7 +23,9 @@ This is some text in the first paragraph. \n \n \nThe third and final paragraph. """ -debugformats('paragraphs', paragraphs) +debugformat('paragraphs', paragraphs, 60) +debugformat('paragraphs', paragraphs, 30) + definitions = """ A Term @@ -49,7 +40,9 @@ Another Term Definition. """ -debugformats('definitions', definitions) +debugformat('definitions', definitions, 60) +debugformat('definitions', definitions, 30) + literals = r""" The fully minimized form is the most @@ -73,7 +66,9 @@ simply ends with space-double-colon. :: with '::' disappears in the final output. """ -debugformats('literals', literals) +debugformat('literals', literals, 60) +debugformat('literals', literals, 30) + lists = """ - This is the first list item. @@ -117,7 +112,9 @@ Line blocks are also a form of list: | This is the second line. """ -debugformats('lists', lists) +debugformat('lists', lists, 60) +debugformat('lists', lists, 30) + options = """ There is support for simple option lists, @@ -143,7 +140,9 @@ marker after the option. It is treated as a normal paragraph: --foo bar baz """ -debugformats('options', options) +debugformat('options', options, 60) +debugformat('options', options, 30) + fields = """ :a: First item. @@ -156,7 +155,8 @@ Next list: :much too large: This key is big enough to get its own line. """ -debugformats('fields', fields) +debugformat('fields', fields, 60) +debugformat('fields', fields, 30) containers = """ Normal output. @@ -174,14 +174,14 @@ Normal output. Debug output. """ -debugformats('containers (normal)', containers) -debugformats('containers (verbose)', containers, keep=['verbose']) -debugformats('containers (debug)', containers, keep=['debug']) -debugformats('containers (verbose debug)', containers, +debugformat('containers (normal)', containers, 60) +debugformat('containers (verbose)', containers, 60, keep=['verbose']) +debugformat('containers (debug)', containers, 60, keep=['debug']) +debugformat('containers (verbose debug)', containers, 60, keep=['verbose', 'debug']) roles = """Please see :hg:`add`.""" -debugformats('roles', roles) +debugformat('roles', roles, 60) sections = """ @@ -197,7 +197,7 @@ Subsection Markup: ``foo`` and :hg:`help` ------------------------------ """ -debugformats('sections', sections) +debugformat('sections', sections, 20) admonitions = """ @@ -214,7 +214,7 @@ admonitions = """ This is danger """ -debugformats('admonitions', admonitions) +debugformat('admonitions', admonitions, 30) comments = """ Some text. @@ -230,16 +230,4 @@ Some text. Empty comment above """ -debugformats('comments', comments) - - -data = [['a', 'b', 'c'], - ['1', '2', '3'], - ['foo', 'bar', 'baz this list is very very very long man']] - -rst = minirst.maketable(data, 2, True) -table = ''.join(rst) - -print table - -debugformats('table', table) +debugformat('comments', comments, 30) |