[svn:parrot] r48429 - trunk/t/op

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Aug 12 09:40:26 UTC 2010


Author: NotFound
Date: Thu Aug 12 09:40:25 2010
New Revision: 48429
URL: https://trac.parrot.org/parrot/changeset/48429

Log:
tests for cmp with null strings

Modified:
   trunk/t/op/cmp-nonbranch.t

Modified: trunk/t/op/cmp-nonbranch.t
==============================================================================
--- trunk/t/op/cmp-nonbranch.t	Thu Aug 12 09:30:40 2010	(r48428)
+++ trunk/t/op/cmp-nonbranch.t	Thu Aug 12 09:40:25 2010	(r48429)
@@ -17,7 +17,7 @@
 =cut
 
 
-.const int TESTS = 93
+.const int TESTS = 96
 
 .macro EXP()
   exp_nok:
@@ -66,6 +66,7 @@
     'iseq'()
     'isne'()
     'cmp'()
+    'cmp_string_null'()
     'trac#11'()
 .end
 
@@ -1214,6 +1215,24 @@
 .end
 
 
+.sub 'cmp_string_null'
+    .local string s1, s2
+    .local int r
+    null s1
+    s2 = 'hello'
+
+    r = cmp s1, s2
+    is(r, -1, 'cmp snull, snotnull')
+
+    r = cmp s2, s1
+    is(r, 1, 'cmp snotnull, snull')
+
+    null s2
+    r = cmp s2, s1
+    is(r, 0, 'cmp snull, snull')
+.end
+
+
 .sub 'trac#11'
     $P0 = new 'String'
     assign $P0, 'foo'


More information about the parrot-commits mailing list