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

Unified Diff: grit/util_unittest.py

Issue 9924009: Add c_format as a format option. (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: Created 8 years, 9 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 | « grit/util.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/util_unittest.py
diff --git a/grit/util_unittest.py b/grit/util_unittest.py
index ee941f2f441145d71be428c531c114dcaae03543..a02ba0ff4ea99d5846b10982686315865e96f8ce 100644
--- a/grit/util_unittest.py
+++ b/grit/util_unittest.py
@@ -55,6 +55,28 @@ class UtilUnittest(unittest.TestCase):
self.failUnless(util.UnescapeHtml('ϲ') == unichr(1010))
self.failUnless(util.UnescapeHtml('ꯍ') == unichr(43981))
+ def testRelativePath(self):
+ """ Verify that MakeRelativePath works in some tricky cases."""
+
+ def TestRelativePathCombinations(base_path, other_path, expected_result):
+ """ Verify that the relative path function works for
+ the given paths regardless of whether or not they end with
+ a trailing slash."""
+ for path1 in [base_path, base_path + os.path.sep]:
+ for path2 in [other_path, other_path + os.path.sep]:
+ result = util.MakeRelativePath(path1, path2)
+ self.failUnless(result == expected_result)
+
+ # set-up variables
+ root_dir = 'c:%sa' % os.path.sep
+ result1 = '..%sabc' % os.path.sep
+ path1 = root_dir + 'bc'
+ result2 = 'bc'
+ path2 = '%s%s%s' % (root_dir, os.path.sep, result2)
+ # run the tests
+ TestRelativePathCombinations(root_dir, path1, result1)
+ TestRelativePathCombinations(root_dir, path2, result2)
+
class TestBaseClassToLoad(object):
pass
« no previous file with comments | « grit/util.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698