diff MoinMoin/_tests/test_wikiutil.py @ 2378:a7f4b02f5fdb

fix the quoting mess * double double-quotes (") to get a double quote inside quotes * quote things correctly when needed (not just "%s") * add and fix unit tests for this quoting * formatter must quote the name before it can pass it to resolve_wiki
author Johannes Berg <johannes AT sipsolutions DOT net>
date Sun, 15 Jul 2007 16:34:25 +0200
parents 463f3de3f981
children c9949c55ff5e
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Sun Jul 15 14:05:12 2007 +0200
+++ b/MoinMoin/_tests/test_wikiutil.py	Sun Jul 15 16:34:25 2007 +0200
@@ -66,10 +66,10 @@
 
 
 class TestNameQuoting:
-    tests = [(u"", u"''"), # empty
-             (u"test", u"'test'"), # nothing special
-             (u"Sarah O'Connor", u"\"Sarah O'Connor\""), # contains ', quote with "
-             (u'Just "something" quoted', u'\'Just "something" quoted\''), # contains ", quote with '
+    tests = [(u"", u'""'), # empty
+             (u"test", u'"test"'), # nothing special
+             (u"Sarah O'Connor", u"\"Sarah O'Connor\""),
+             (u'Just "something" quoted', u'"Just ""something"" quoted"'),
             ]
     def testQuoteName(self):
         for name, qname in self.tests:
@@ -85,7 +85,13 @@
         tests = [('SomePage', ('Self', 'SomePage', '')),
                  ('OtherWiki:OtherPage', ('OtherWiki', 'OtherPage', '')),
                  ('MoinMoin:"Page with blanks" link title', ("MoinMoin", "Page with blanks", "link title")),
-                 ("MoinMoin:'Page with blanks' link title", ("MoinMoin", "Page with blanks", "link title")),
+                 ('MoinMoin:"Page with blanks"link title', ("MoinMoin", "Page with blanks", "link title")),
+                 ('MoinMoin:"Page with blanks"', ("MoinMoin", "Page with blanks", "")),
+                 ('MoinMoin:"Page with ""quote""" link title', ("MoinMoin", 'Page with "quote"', "link title")),
+                 ('MoinMoin:"Page with """"double-quote"""link title', ("MoinMoin", 'Page with ""double-quote"', "link title")),
+                 ('MoinMoin:"""starts with quote"link title', ("MoinMoin", '"starts with quote', "link title")),
+                 ('MoinMoin:"ends with quote"""link title', ("MoinMoin", 'ends with quote"', "link title")),
+                 ('MoinMoin:"""page with quotes around"""link title', ("MoinMoin", '"page with quotes around"', "link title")),
                  ('attachment:"filename with blanks.txt" other title', ("attachment", "filename with blanks.txt", "other title")),
                 ]
         for markup, (wikiname, pagename, linktext) in tests: