Skip to content

Commit a53d1fe

Browse files
committed
Add tests for multi character replacement windows-1252/1 decode
Test checks that 1 or two successive replacements work.
1 parent 378622e commit a53d1fe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

t/moar/11-decode.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ my $special_windows1252 := nqp::encodeconf(nqp::chr(129), 'windows-1252', $buf8.
3131
is(nqp::decodeconf($special_windows1252, 'windows-1252', 1), "\c[129]",
3232
'nqp::encodeconf works with windows-1252 and non-strict. decodeconf works non-strict');
3333
# Test we can decode invalid codepoint and it is replaced instead on strict mode
34-
is(nqp::decoderepconf($special_windows1252, 'windows-1252', 'X', 0), "X",
34+
my $nspecial_windows_str := "//" ~ nqp::chr(129) ~ "//" ~ nqp::chr(129) ~ nqp::chr(129) ~ "//"; #"//$special_windows1252//$special_windows1252$special_windows1252//";
35+
my $nspecial_windows := nqp::encodeconf($nspecial_windows_str, 'windows-1252', $buf8.new, 1);
36+
37+
is(nqp::decoderepconf($nspecial_windows, 'windows-1252', 'ABCDE', 0), "//ABCDE//ABCDEABCDE//",
3538
"nqp::decoderepconf works on strict (does do replacement)");
3639
# Test that if we use non-strict mode, it leaves things that fit into Unicode
3740
# unchanged.

0 commit comments

Comments
 (0)