diff MoinMoin/_tests/test_wikiutil.py @ 3405:6f5e09f14525

parse_quoted_separated_ext: allow multiple/different quoting characters
author Johannes Berg <johannes AT sipsolutions DOT net>
date Sat, 22 Mar 2008 05:11:04 +0100
parents e979e3cad972
children c3aa12fcdf12
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Sat Mar 22 03:47:47 2008 +0100
+++ b/MoinMoin/_tests/test_wikiutil.py	Sat Mar 22 05:11:04 2008 +0100
@@ -383,6 +383,22 @@
         for test in tests:
             yield [_check] + list(test)
 
+    def testExtendedParserQuoting(self):
+        tests = [
+            (u'"a b" -a b-', u'"', [u'a b', u'-a', u'b-']),
+            (u'"a b" -a b-', u"-", [u'"a', u'b"', u'a b']),
+            (u'"a b" -a b-', u'"-', [u'a b', u'a b']),
+            (u'"a- b" -a b-', u'"-', [u'a- b', u'a b']),
+            (u'"a- b" -a" b-', u'"-', [u'a- b', u'a" b']),
+        ]
+
+        def _check(args, quotes, expected):
+            res = wikiutil.parse_quoted_separated_ext(args, quotes=quotes)
+            assert res == expected
+
+        for test in tests:
+            yield [_check] + list(test)
+
     def testExtendedParserMultikey(self):
         tests = [
             (u'"a", "b", "c"', u',', None, [u'a', u'b', u'c']),