Skip to content

Commit

Permalink
Extra decoding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Mar 22, 2018
1 parent 1384547 commit 5bcb548
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion t/moar/11-decode.t
@@ -1,6 +1,6 @@
# This can be moved when *conf ops are added to jvm and others
use nqpmo;
plan(7);
plan(9);

my sub create_buf($type) {
my $buf := nqp::newtype(nqp::null(), 'VMArray');
Expand Down Expand Up @@ -34,6 +34,14 @@ is(nqp::decodeconf($special_windows1252, 'windows-1252', 1), "\c[129]",
my $nspecial_windows_str := "//" ~ nqp::chr(129) ~ "//" ~ nqp::chr(129) ~ nqp::chr(129) ~ "//"; #"//$special_windows1252//$special_windows1252$special_windows1252//";
my $nspecial_windows := nqp::encodeconf($nspecial_windows_str, 'windows-1252', $buf8.new, 1);

dies-ok({
nqp::encodeconf(nqp::chr(129), 'windows-1252', $buf8.new, 0);
}, 'nqp::encodeconf can\'t encode unmapped chars in strict mode');

dies-ok({
nqp::encodeconf('', 'windows-1252', $buf8.new, 1);
}, 'nqp::encodeconf only fuges unmapped chars in permissive mode');

is(nqp::decoderepconf($nspecial_windows, 'windows-1252', 'ABCDE', 0), "//ABCDE//ABCDEABCDE//",
"nqp::decoderepconf works on strict (does do replacement)");
# Test that if we use non-strict mode, it leaves things that fit into Unicode
Expand Down

0 comments on commit 5bcb548

Please sign in to comment.