Skip to content

Commit

Permalink
Merge pull request #12 from miyagawa/decode-utf8
Browse files Browse the repository at this point in the history
Unit test for decoding behavior change in #11
  • Loading branch information
dankogai committed Aug 29, 2013
2 parents 1f1e421 + 0d0973e commit c9be90a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions t/decode.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use strict;
use Encode qw(decode_utf8 FB_CROAK);
use Test::More tests => 3;

sub croak_ok(&) {
my $code = shift;
eval { $code->() };
like $@, qr/does not map/;
}

my $bytes = "L\x{e9}on";
my $pad = "\x{30C9}";

my $orig = $bytes;
croak_ok { Encode::decode_utf8($orig, FB_CROAK) };

my $orig2 = $bytes;
croak_ok { Encode::decode('utf-8', $orig2, FB_CROAK) };

chop(my $new = $bytes . $pad);
croak_ok { Encode::decode_utf8($new, FB_CROAK) };

0 comments on commit c9be90a

Please sign in to comment.