Mercurial > iscconf
changeset 10:0a9f44133fb4
Add a test for string parsing
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Tue, 31 Jul 2012 15:20:50 +0200 |
| parents | dcb0d3dea03d |
| children | 9ad2e3f1c58c |
| files | iscconf/parser.py tests/test_dhcp.py |
| diffstat | 2 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/iscconf/parser.py Tue Jun 26 15:03:57 2012 +0200 +++ b/iscconf/parser.py Tue Jul 31 15:20:50 2012 +0200 @@ -28,7 +28,7 @@ class LexicalError(Error): pass -def t_string(t): +def t_STRING(t): r'"([^"]|\\")*"' t.value = t.value[1:1] return t
--- a/tests/test_dhcp.py Tue Jun 26 15:03:57 2012 +0200 +++ b/tests/test_dhcp.py Tue Jul 31 15:20:50 2012 +0200 @@ -74,6 +74,17 @@ }, }) + def test_string(self): + data = iscconf.parse("""\ +xxx { + xxx "hello world"; +}""") + self.assertEqual(data, { + ('xxx',): { + ('xxx',): 'hello world', + }, + }) + if __name__ == '__main__': unittest.main()
