diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-02-28 12:49:37 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-02-28 12:49:37 +0100 |
commit | 3238618f956afa5d2f23ee607536c4383f5b1cd8 (patch) | |
tree | 758dac89b0688c38da1dcf16ed07c537af94e796 /fastimport/tests | |
parent | 0d0a934996871e5245564ba06d4fc3b9b2f5964c (diff) | |
download | python-fastimport-3238618f956afa5d2f23ee607536c4383f5b1cd8.tar.gz |
Implement 'done' feature.
Diffstat (limited to 'fastimport/tests')
-rw-r--r-- | fastimport/tests/test_parser.py | 26 |
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): |