diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-11-04 12:08:37 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-11-04 12:08:37 +0000 |
| commit | efc5384a325e8621cac37b2a33ce64e609c66f39 (patch) | |
| tree | 31e9363f00a0a01fdf27e5da5dc77a775157d89a /tests | |
| parent | c906b270f5bc53d9657c5f0bdb98a3015c9f8c71 (diff) | |
Fixed #6476 -- Added option to makemessages management command to disable wrapping of long lines. Thanks to pytechd for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14454 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/i18n/commands/extraction.py | 29 | ||||
| -rw-r--r-- | tests/regressiontests/i18n/commands/templates/test.html | 3 |
2 files changed, 27 insertions, 5 deletions
diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py index 4b4fa1b07e..7b064d1daa 100644 --- a/tests/regressiontests/i18n/commands/extraction.py +++ b/tests/regressiontests/i18n/commands/extraction.py @@ -27,11 +27,15 @@ class ExtractorTests(TestCase): pass os.chdir(self._cwd) - def assertMsgId(self, msgid, s): - return self.assert_(re.search('^msgid "%s"' % msgid, s, re.MULTILINE)) + def assertMsgId(self, msgid, s, use_quotes=True): + if use_quotes: + msgid = '"%s"' % msgid + return self.assert_(re.search('^msgid %s' % msgid, s, re.MULTILINE)) - def assertNotMsgId(self, msgid, s): - return self.assert_(not re.search('^msgid "%s"' % msgid, s, re.MULTILINE)) + def assertNotMsgId(self, msgid, s, use_quotes=True): + if use_quotes: + msgid = '"%s"' % msgid + return self.assert_(not re.search('^msgid %s' % msgid, s, re.MULTILINE)) class JavascriptExtractorTests(ExtractorTests): @@ -96,3 +100,20 @@ class CopyPluralFormsExtractorTests(ExtractorTests): self.assert_(os.path.exists(self.PO_FILE)) po_contents = open(self.PO_FILE, 'r').read() self.assert_('Plural-Forms: nplurals=2; plural=(n != 1)' in po_contents) + + +class NoWrapExtractorTests(ExtractorTests): + + def test_no_wrap_enabled(self): + os.chdir(self.test_dir) + management.call_command('makemessages', locale=LOCALE, verbosity=0, no_wrap=True) + self.assert_(os.path.exists(self.PO_FILE)) + po_contents = open(self.PO_FILE, 'r').read() + self.assertMsgId('This literal should also be included wrapped or not wrapped depending on the use of the --no-wrap option.', po_contents) + + def test_no_wrap_disabled(self): + os.chdir(self.test_dir) + management.call_command('makemessages', locale=LOCALE, verbosity=0, no_wrap=False) + self.assert_(os.path.exists(self.PO_FILE)) + po_contents = open(self.PO_FILE, 'r').read() + self.assertMsgId('""\n"This literal should also be included wrapped or not wrapped depending on the "\n"use of the --no-wrap option."', po_contents, use_quotes=False) diff --git a/tests/regressiontests/i18n/commands/templates/test.html b/tests/regressiontests/i18n/commands/templates/test.html index 2c38b3e4e6..7574efa863 100644 --- a/tests/regressiontests/i18n/commands/templates/test.html +++ b/tests/regressiontests/i18n/commands/templates/test.html @@ -1,2 +1,3 @@ {% load i18n %} -{% trans "This literal should be included." %}
\ No newline at end of file +{% trans "This literal should be included." %} +{% trans "This literal should also be included wrapped or not wrapped depending on the use of the --no-wrap option." %}
\ No newline at end of file |
