From 0d0973e827c0a16bd5bb9abf9c84d86c78b9dfcb Mon Sep 17 00:00:00 2001 From: Tatsuhiko Miyagawa Date: Thu, 29 Aug 2013 09:06:20 -0700 Subject: [PATCH] Add test for ff65c71aa64c0efd285e6905ac68ba4e2cb25541 --- t/decode.t | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 t/decode.t diff --git a/t/decode.t b/t/decode.t new file mode 100644 index 0000000..277021f --- /dev/null +++ b/t/decode.t @@ -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) }; +