Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: tools/grit/grit/node/message_unittest.py

Issue 2112653003: grit: Automatically replace ... with … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move replace to Translate() to avoid changing message IDs Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/grit/grit/node/message.py ('k') | tools/grit/grit/tool/build.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/node/message_unittest.py
diff --git a/tools/grit/grit/node/message_unittest.py b/tools/grit/grit/node/message_unittest.py
index a058257a74cbcbc7c3b74174247735e7a94ab84b..3592af37df88c1bd92cb1708b548b126a17b3be9 100755
--- a/tools/grit/grit/node/message_unittest.py
+++ b/tools/grit/grit/node/message_unittest.py
@@ -8,12 +8,16 @@
import os
import sys
-if __name__ == '__main__':
- sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
-
import unittest
import StringIO
+if __name__ == '__main__':
+ # When executed as the main module, the first entry in sys.path will be
+ # the directory contain this module. This entry causes the io.py file in this
+ # directory to be selected whenever any file does "import io", rather than the
+ # system "io" module. As a work-around, remove the first sys.path entry.
+ sys.path[0] = os.path.join(os.path.dirname(__file__), '../..')
+
from grit import tclib
from grit import util
from grit.node import message
@@ -85,6 +89,18 @@ class MessageUnittest(unittest.TestCase):
self.failUnlessEqual(expected_formatter_data[key],
msg.formatter_data[key])
+ def testReplaceEllipsis(self):
+ root = util.ParseGrdForUnittest('''
+ <messages>
+ <message name="IDS_GREETING" desc="">
+ A...B.... <ph name="PH">%s<ex>A</ex></ph>... B... C...
+ </message>
+ </messages>''')
+ msg, = root.GetChildrenOfType(message.MessageNode)
+ msg.SetReplaceEllipsis(True)
+ content = msg.Translate('en')
+ self.failUnlessEqual(u'A...B.... %s\u2026 B\u2026 C\u2026', content)
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « tools/grit/grit/node/message.py ('k') | tools/grit/grit/tool/build.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698