aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Driessen <vincent@datafox.nl>2010-08-19 09:51:42 +0200
committerVincent Driessen <vincent@datafox.nl>2010-08-19 09:51:42 +0200
commit4353027f5c7dd4235151baced074a32545d886b6 (patch)
tree2069097afbd30839ddc9f5d4d272a77e4e1c6fa1 /tests
parentfae01af853842a405b52010ea7a2f41fe4243e8c (diff)
downloadvim-rst-tables-4353027f5c7dd4235151baced074a32545d886b6.tar.gz
vim-rst-tables-4353027f5c7dd4235151baced074a32545d886b6.tar.bz2
vim-rst-tables-4353027f5c7dd4235151baced074a32545d886b6.zip
Added ability to parse existing tables.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_rst_tables.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_rst_tables.py b/tests/test_rst_tables.py
index b3df5ad..f7f5280 100644
--- a/tests/test_rst_tables.py
+++ b/tests/test_rst_tables.py
@@ -82,6 +82,38 @@ a line ending.
expected = [['x', 'y'], ['a', 'b'], ['only one', '']]
self.assertEquals(expected, parse_table(input))
+ def testParseValidTable(self):
+ input = ['+=====+====+',
+ '| Foo | Mu |',
+ '+=====+====+',
+ '| x | y |',
+ '+-----+----+']
+ expect = [['Foo', 'Mu'], ['x', 'y']]
+ self.assertEquals(expect, parse_table(input))
+
+ def testParseCorruptedTable(self):
+ input = ['+===+-----====+',
+ '| Foo | Mu |',
+ '+=====+====+',
+ '| x | This became somewhat larger |',
+ 'blah | A new line| ',
+ '+-----+----+']
+ expect = [['Foo', 'Mu'],
+ ['x', 'This became somewhat larger'],
+ ['blah', 'A new line']]
+ self.assertEquals(expect, parse_table(input))
+
+ input = ['+===+-----====+',
+ '| Foo | Mu |',
+ '+=====+====+',
+ '| x | This became somewhat larger |',
+ 'blah | A new line|| ',
+ '+-----+----+']
+ expect = [['Foo', 'Mu', ''],
+ ['x', 'This became somewhat larger', ''],
+ ['blah', 'A new line', '']]
+ self.assertEquals(expect, parse_table(input))
+
def testTableLine(self):
self.assertEquals('', table_line([], True))
self.assertEquals('++', table_line([0], True))