4
# most be loaded before Sereal::TestSet
5
use Sereal::Encoder qw(encode_sereal);
6
use Sereal::Encoder::Constants qw(:all);
9
use lib File::Spec->catdir(qw(t lib));
15
use Sereal::TestSet qw(:all);
17
use Data::Dumper; # must be loaded AFTER the test set (bug in perl)
19
# These tests are extraordinarily basic, badly-done and really just
20
# for basic sanity testing during development.
25
run_tests("no_shared_hk", {no_shared_hashkeys => 1});
29
my ($extra_name, $opt_hash) = @_;
30
foreach my $bt (@BasicTests) {
31
my (undef, $exp, $name) = @$bt;
33
$exp = $exp->($opt_hash) if ref($exp) eq 'CODE';
34
$name="unnamed" if not defined $name;
35
#next unless $name=~/PAD/;
38
my $enc = Sereal::Encoder->new($opt_hash ? $opt_hash : ());
41
$out= $enc->encode($bt->[0]); # must use bt here or we get a copy
43
} or die "Failed to encode: \n$@\n". Data::Dumper::Dumper($bt->[0]);
44
ok(defined $out, "($extra_name) defined: $name");
45
#is(length($out), length($exp));
46
is(Data::Dumper::qquote($out), Data::Dumper::qquote($exp), "($extra_name) correct: $name")
48
if ($ENV{DEBUG_SEREAL}) {
49
print STDERR "\nEXPECTED:\n";
51
print STDERR "\nGOT:\n";