1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
use warnings;
use strict;
use Test::More tests => 43;
BEGIN { use_ok "Data::Pond", qw(pond_read_datum pond_write_datum); }
foreach(
undef,
[],
{},
) {
eval { pond_read_datum(undef); };
like $@, qr/\APond data error: /;
}
foreach(
*STDOUT,
\"",
sub{},
bless({},"main"),
bless({},"ARRAY"),
bless([],"main"),
bless([],"HASH"),
[ sub{} ],
) {
eval { pond_write_datum($_, {}); };
like $@, qr/\APond data error: /;
eval { pond_read_datum($_); };
like $@, qr/\APond data error: /;
}
foreach(
"",
" ",
"foo",
"undef",
"foo=>",
"1,",
"[,]",
"[,1]",
"[1,,]",
"[1,,2]",
"'\x00'",
"\"\x00\"",
"'\t'",
"\"\t\"",
"'\n'",
"\"\n\"",
"'\x7f'",
"\"\x7f\"",
"'\x80'",
"\"\x80\"",
"'\xa0'",
"\"\xa0\"",
"\"\\c\"",
) {
eval { pond_read_datum($_); };
like $@, qr/\APond syntax error\b/;
}
1;
|