summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeppe Pihl <jpihl08@gmail.com>2014-10-04 17:48:55 +0200
committerJeppe Pihl <jpihl08@gmail.com>2014-10-04 17:48:55 +0200
commit7a3783f08185f7dbe5ab94ae43f9a510acb996e2 (patch)
tree84f51c7b9b743476a1a985acfb0c880bc81b215e
parenta961bae8cd1aa442629e1559828e7997916914a3 (diff)
downloadsphinx-7a3783f08185f7dbe5ab94ae43f9a510acb996e2.tar.gz
added tests for linenos, lineno-start, lineno-match
-rw-r--r--tests/test_directive_code.py78
1 files changed, 77 insertions, 1 deletions
diff --git a/tests/test_directive_code.py b/tests/test_directive_code.py
index 0c2cead6..0dc8419a 100644
--- a/tests/test_directive_code.py
+++ b/tests/test_directive_code.py
@@ -96,10 +96,86 @@ def test_literal_include_dedent(app, status, warning):
@with_app('html', testroot='directive-code')
+def test_literal_include_linenos(app, status, warning):
+ app.builder.build(['linenos'])
+ html = (app.outdir / 'linenos.html').text()
+ linenos = (
+ '<td class="linenos"><div class="linenodiv"><pre>'
+ ' 1\n'
+ ' 2\n'
+ ' 3\n'
+ ' 4\n'
+ ' 5\n'
+ ' 6\n'
+ ' 7\n'
+ ' 8\n'
+ ' 9\n'
+ '10\n'
+ '11\n'
+ '12\n'
+ '13</pre></div></td>')
+ assert linenos in html
+
+
+@with_app('html', testroot='directive-code')
+def test_literal_include_lineno_start(app, status, warning):
+ app.builder.build(['lineno_start'])
+ html = (app.outdir / 'lineno_start.html').text()
+ linenos = (
+ '<td class="linenos"><div class="linenodiv"><pre>'
+ '200\n'
+ '201\n'
+ '202\n'
+ '203\n'
+ '204\n'
+ '205\n'
+ '206\n'
+ '207\n'
+ '208\n'
+ '209\n'
+ '210\n'
+ '211\n'
+ '212</pre></div></td>')
+ assert linenos in html
+
+
+@with_app('html', testroot='directive-code')
+def test_literal_include_lineno_match(app, status, warning):
+ app.builder.build(['lineno_match'])
+ html = (app.outdir / 'lineno_match.html').text()
+ pyobject = (
+ '<td class="linenos"><div class="linenodiv"><pre>'
+ ' 9\n'
+ '10\n'
+ '11</pre></div></td>')
+
+ assert pyobject in html
+
+ lines = (
+ '<td class="linenos"><div class="linenodiv"><pre>'
+ '6\n'
+ '7\n'
+ '8\n'
+ '9</pre></div></td>')
+ assert lines in html
+
+ start_after = (
+ '<td class="linenos"><div class="linenodiv"><pre>'
+ ' 9\n'
+ '10\n'
+ '11\n'
+ '12\n'
+ '13</pre></div></td>')
+ assert start_after in html
+
+
+@with_app('html', testroot='directive-code')
def test_literalinclude_caption_html(app, status, warning):
app.builder.build('index')
html = (app.outdir / 'caption.html').text()
- caption = '<div class="code-block-caption">caption <strong>test</strong> py</div>'
+ caption = ('<div class="code-block-caption">'
+ 'caption <strong>test</strong> py'
+ '</div>')
assert caption in html