StrCaseCmp tests: Add some tests in Katakana. Convert strings to
authorMartin Pool <mbp@samba.org>
Wed, 9 Apr 2003 06:50:59 +0000 (06:50 +0000)
committerMartin Pool <mbp@samba.org>
Wed, 9 Apr 2003 06:50:59 +0000 (06:50 +0000)
UTF-8 before passing to test harness.
(This used to be commit 79b292de98208571e49648cf88d9b565396151be)

source3/stf/strings.py

index 4e070c04448ba4d9bb492e9ebf07a7141dcb88bc..328849b1ceb44c095b75e653838edc935bc59d9d 100755 (executable)
@@ -62,10 +62,10 @@ class PushUCS2_Tests(comfychair.TestCase):
             self.assert_equal(out, "0\n")
     
 
-class StrCaseCmp_Ascii_Tests(comfychair.TestCase):
+class StrCaseCmp(comfychair.TestCase):
     """String comparisons in simple ASCII""" 
     def run_strcmp(self, a, b, expect):
-        out, err = self.runcmd('t_strcmp \"%s\" \"%s\"' % (a, b))
+        out, err = self.runcmd('t_strcmp \"%s\" \"%s\"' % (a.encode('utf-8'), b.encode('utf-8')))
         if signum(int(out)) != expect:
             self.fail("comparison failed:\n"
                       "  a=%s\n"
@@ -88,12 +88,14 @@ class StrCaseCmp_Ascii_Tests(comfychair.TestCase):
                  ('longstring ' * 100, 'longstring ' * 100, 0),
                  ('longstring ' * 100, 'longstring ' * 100 + 'a', -1),
                  ('longstring ' * 100 + 'a', 'longstring ' * 100, +1),
+                 (KATAKANA_LETTER_A, KATAKANA_LETTER_A, 0),
+                 (KATAKANA_LETTER_A, 'a', 1),
                  ]
         for a, b, expect in cases:
             self.run_strcmp(a, b, expect)
         
 # Define the tests exported by this module
-tests = [StrCaseCmp_Ascii_Tests,
+tests = [StrCaseCmp,
          PushUCS2_Tests]
 
 # Handle execution of this file as a main program