summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDasIch <dasdasich@gmail.com>2010-08-15 18:41:14 +0200
committerDasIch <dasdasich@gmail.com>2010-08-15 18:41:14 +0200
commit21f628bc8dbc4046850334a93debfdb974e08e58 (patch)
tree1136d3059bde5b9d05c41479d3ec67de931e3d18 /tests
parente20779803bba96609e7777b70f9b7fc73f4aca3c (diff)
downloadsphinx-21f628bc8dbc4046850334a93debfdb974e08e58.tar.gz
Added a test for paragraphs inserted at the beginning of a document
Diffstat (limited to 'tests')
-rw-r--r--tests/root/versioning/index.txt1
-rw-r--r--tests/root/versioning/insert_beginning.txt18
-rw-r--r--tests/test_versioning.py7
3 files changed, 26 insertions, 0 deletions
diff --git a/tests/root/versioning/index.txt b/tests/root/versioning/index.txt
index 234e223f..a6d12007 100644
--- a/tests/root/versioning/index.txt
+++ b/tests/root/versioning/index.txt
@@ -9,3 +9,4 @@ Versioning Stuff
deleted
deleted_end
modified
+ insert_beginning
diff --git a/tests/root/versioning/insert_beginning.txt b/tests/root/versioning/insert_beginning.txt
new file mode 100644
index 00000000..57102a76
--- /dev/null
+++ b/tests/root/versioning/insert_beginning.txt
@@ -0,0 +1,18 @@
+Versioning test text
+====================
+
+Apperantly inserting a paragraph at the beginning of a document caused
+problems earlier so this document should be used to test that.
+
+So the thing is I need some kind of text - not the lorem ipsum stuff, that
+doesn't work out that well - to test :mod:`sphinx.versioning`. I couldn't find
+a good text for that under public domain so I thought the easiest solution is
+to write one by myself. It's not really interesting, in fact it is *really*
+boring.
+
+Anyway I need more than one paragraph, at least three for the original
+document, I think, and another one for two different ones.
+
+So the previous paragraph was a bit short because I don't want to test this
+only on long paragraphs, I hope it was short enough to cover most stuff.
+Anyway I see this lacks ``some markup`` so I have to add a **little** bit.
diff --git a/tests/test_versioning.py b/tests/test_versioning.py
index 54a48f4a..549d760f 100644
--- a/tests/test_versioning.py
+++ b/tests/test_versioning.py
@@ -102,3 +102,10 @@ def test_insert():
assert len(new_nodes) == 1
assert original_uids[0] == uids[0]
assert original_uids[1:] == uids[2:]
+
+def test_insert_beginning():
+ insert_beginning = doctrees['versioning/insert_beginning']
+ new_nodes = list(merge_doctrees(original, insert_beginning, is_paragraph))
+ uids = [n.uid for n in insert_beginning.traverse(is_paragraph)]
+ assert len(new_nodes) == 1
+ assert original_uids == uids[1:]