Skip to content

Commit

Permalink
[t] More string tests to improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nwellnhof committed Nov 30, 2010
1 parent a3ca6c8 commit 5f23cc5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
13 changes: 13 additions & 0 deletions t/op/string.t
Expand Up @@ -1611,6 +1611,19 @@ catch2:
pop_eh
null2:
is ($S9, "Can't upcase NULL string", 'upcase inplace null')

push_eh catch3
null $S9
set $S0, binary:"abCD012yz"
upcase $S1, $S0
pop_eh
goto null3
catch3:
.get_results($P9)
$S9 = $P9['message']
pop_eh
null3:
is ($S9, "Invalid operation on binary string", 'upcase binary')
.end

.sub test_downcase
Expand Down
14 changes: 13 additions & 1 deletion t/op/string_cs.t
Expand Up @@ -5,7 +5,7 @@ use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
use Parrot::Test tests => 57;
use Parrot::Test tests => 58;
use Parrot::Config;

=head1 NAME
Expand Down Expand Up @@ -388,6 +388,16 @@ CODE
/Lossy conversion/
OUTPUT

pasm_error_output_like( <<'CODE', <<OUTPUT, "trans_encoding_s_s_i utf-16 to ucs-2 - lossy" );
set S1, utf16:"abc\x{10101}def"
find_encoding I0, "ucs2"
trans_encoding S2, S1, I0
print "never\n"
end
CODE
/Lossy conversion/
OUTPUT

pasm_output_is( <<'CODE', <<OUTPUT, "trans_encoding_s_s_i iso-8859-1 to ucs4" );
set S0, iso-8859-1:"abc_ä_"
find_encoding I0, "ucs4"
Expand All @@ -413,6 +423,8 @@ pasm_output_is( <<'CODE', <<OUTPUT, "trans_encoding_s_s_i utf8 to ucs4" );
set S0, utf8:"\x{fc}_\x{20202}"
find_encoding I0, "ucs4"
trans_encoding S1, S0, I0
# also test ucs4 to ucs4 conversion
trans_encoding S1, S1, I0
iseq I1, S0, S1
print I1
print "\n"
Expand Down
2 changes: 1 addition & 1 deletion t/pmc/stringiterator.t
Expand Up @@ -34,7 +34,7 @@ Tests the C<StringIterator> PMC. Iterate over string in both directions.
get_keyed(iso-8859-1:"a\x{e4}c\x{f6}e\x{fc}g", utf8:"ä", utf8:"ö", utf8:"ü")
get_keyed(binary:"a\x{e4}c\x{f6}e\x{fc}g", utf8:"ä", utf8:"ö", utf8:"ü")
get_keyed(utf8:"aäc\x{20123}eüg", utf8:"ä", utf8:"\x{20123}", utf8:"ü")
get_keyed(utf16:"aäcöe\x{20abc}g", utf8:"ä", utf8:"ö", utf8:"\x{20abc}")
get_keyed(utf16:"\x{20456}öe\x{20abc}g", utf8:"ä", utf8:"ö", utf8:"\x{20abc}")
get_keyed(ucs2:"aäcöe\x{beef}g", utf8:"ä", utf8:"ö", utf8:"\x{beef}")
get_keyed(ucs4:"a\x{20789}cöeüg", utf8:"\x{20789}", utf8:"ö", utf8:"ü")

Expand Down

0 comments on commit 5f23cc5

Please sign in to comment.