Skip to content

Commit

Permalink
test for substr null string
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@48529 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
NotFound committed Aug 16, 2010
1 parent dc60a4c commit 363dfc6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions t/op/string.t
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Tests Parrot string registers and operations.
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()
Expand Down Expand Up @@ -310,6 +311,23 @@ Tests Parrot string registers and operations.
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
Expand Down

0 comments on commit 363dfc6

Please sign in to comment.