summaryrefslogtreecommitdiff
path: root/tests/test_build_text.py
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2014-08-26 20:52:02 +0900
committershimizukawa <shimizukawa@gmail.com>2014-08-26 20:52:02 +0900
commitf8f89235b026e99cdb6166ded84e1c9dd770049d (patch)
tree3d803cf9361f028a73dbb3e6d95979dfc9218592 /tests/test_build_text.py
parentc6cf6fb66e1eba1d326fdcebd14ad459c23c9063 (diff)
downloadsphinx-f8f89235b026e99cdb6166ded84e1c9dd770049d.tar.gz
`make text` generate wrong table when it has empty table cells. Closes #1544
Diffstat (limited to 'tests/test_build_text.py')
-rw-r--r--tests/test_build_text.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_build_text.py b/tests/test_build_text.py
index d6513504..e6e4d5be 100644
--- a/tests/test_build_text.py
+++ b/tests/test_build_text.py
@@ -139,3 +139,29 @@ def test_nonascii_maxwidth(app):
lines = [line.strip() for line in result.splitlines() if line.strip()]
line_widths = [column_width(line) for line in lines]
assert max(line_widths) < MAXWIDTH
+
+
+@with_text_app()
+def test_table_with_empty_cell(app):
+ contents = (u"""
+ +-----+-----+
+ | XXX | XXX |
+ +-----+-----+
+ | | XXX |
+ +-----+-----+
+ | XXX | |
+ +-----+-----+
+ """)
+
+ (app.srcdir / 'contents.rst').write_text(contents, encoding='utf-8')
+ app.builder.build_all()
+ result = (app.outdir / 'contents.txt').text(encoding='utf-8')
+
+ lines = [line.strip() for line in result.splitlines() if line.strip()]
+ assert lines[0] == "+-------+-------+"
+ assert lines[1] == "| XXX | XXX |"
+ assert lines[2] == "+-------+-------+"
+ assert lines[3] == "| | XXX |"
+ assert lines[4] == "+-------+-------+"
+ assert lines[5] == "| XXX | |"
+ assert lines[6] == "+-------+-------+"