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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Mon Aug 16 18:44:20 UTC 2010


Author: NotFound
Date: Mon Aug 16 18:44:20 2010
New Revision: 48529
URL: https://trac.parrot.org/parrot/changeset/48529

Log:
test for substr null string

Modified:
   trunk/t/op/string.t

Modified: trunk/t/op/string.t
==============================================================================
--- trunk/t/op/string.t	Mon Aug 16 18:42:50 2010	(r48528)
+++ trunk/t/op/string.t	Mon Aug 16 18:44:20 2010	(r48529)
@@ -32,6 +32,7 @@
     three_argument_chopn__oob_values()
     substr_tests()
     neg_substr_offset()
+    exception_substr_null_string()
     exception_substr_oob()
     exception_substr_oob_neg()
     len_greater_than_strlen()
@@ -310,6 +311,23 @@
     is( $S1, "length", '' )
 .end
 
+.sub exception_substr_null_string
+    .local string s
+    .local pmc eh
+    .local int r
+    null s
+    eh = new ['ExceptionHandler']
+    eh.'handle_types'(.EXCEPTION_SUBSTR_OUT_OF_STRING)
+    set_addr eh, handler
+    push_eh eh
+    r = 1
+    substr s, s, 0, 0
+    r = 0
+  handler:
+    pop_eh
+    is(r, 1, "substr with null string throws" )
+.end
+
 # This asks for substring that shouldn't be allowed...
 .sub exception_substr_oob
     .local pmc eh


More information about the parrot-commits mailing list