summaryrefslogtreecommitdiff
path: root/fastimport/tests/test_parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'fastimport/tests/test_parser.py')
-rw-r--r--fastimport/tests/test_parser.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/fastimport/tests/test_parser.py b/fastimport/tests/test_parser.py
index 06270a8..4bf11c7 100644
--- a/fastimport/tests/test_parser.py
+++ b/fastimport/tests/test_parser.py
@@ -259,6 +259,32 @@ class TestImportParser(testtools.TestCase):
self.assertEqual('Donald', cmd.more_authors[1][0])
self.assertEqual('donald@duck.org', cmd.more_authors[1][1])
+ def test_done_feature_missing_done(self):
+ s = StringIO.StringIO("""feature done
+""")
+ p = parser.ImportParser(s)
+ cmds = p.iter_commands()
+ self.assertEquals("feature", cmds.next().name)
+ self.assertRaises(errors.PrematureEndOfStream, cmds.next)
+
+ def test_done_with_feature(self):
+ s = StringIO.StringIO("""feature done
+done
+more data
+""")
+ p = parser.ImportParser(s)
+ cmds = p.iter_commands()
+ self.assertEquals("feature", cmds.next().name)
+ self.assertRaises(StopIteration, cmds.next)
+
+ def test_done_without_feature(self):
+ s = StringIO.StringIO("""done
+more data
+""")
+ p = parser.ImportParser(s)
+ cmds = p.iter_commands()
+ self.assertEquals([], list(cmds))
+
class TestStringParsing(testtools.TestCase):