[pypy-svn] r45929 - in pypy/dist/pypy/translator/cli: src test

antocuni at codespeak.net antocuni at codespeak.net
Thu Aug 23 15:02:17 CEST 2007


Author: antocuni
Date: Thu Aug 23 15:02:16 2007
New Revision: 45929

Modified:
   pypy/dist/pypy/translator/cli/src/pypylib.cs
   pypy/dist/pypy/translator/cli/test/test_string.py
Log:
I really hate .NET.
String.Compare has cultural-specific behaviour by default.



Modified: pypy/dist/pypy/translator/cli/src/pypylib.cs
==============================================================================
--- pypy/dist/pypy/translator/cli/src/pypylib.cs	(original)
+++ pypy/dist/pypy/translator/cli/src/pypylib.cs	Thu Aug 23 15:02:16 2007
@@ -201,7 +201,7 @@
 
         public static int ll_strcmp(string s1, string s2)
         {
-            return string.Compare(s1, s2);
+            return string.Compare(s1, s2, StringComparison.Ordinal);
         }
 
         public static bool ll_startswith(string s1, string s2)

Modified: pypy/dist/pypy/translator/cli/test/test_string.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_string.py	(original)
+++ pypy/dist/pypy/translator/cli/test/test_string.py	Thu Aug 23 15:02:16 2007
@@ -24,3 +24,8 @@
     def test_getitem_exc(self):
         py.test.skip('fixme!')
 
+    def test_compare(self):
+        strings = ['aa', 'ZZ']
+        def fn(i, j):
+            return strings[i] < strings[j]
+        assert self.interpret(fn, [0, 1], backendopt=False) == fn(0, 1)



More information about the Pypy-commit mailing list