]>
iEval git - data-dump-sexp.git/blob - t/Data-Dump-Sexp.t
5 use Test
::More tests
=> 16;
7 BEGIN { use_ok
('Data::Dump::Sexp') };
13 is dump_sexp
(undef), '()';
14 is dump_sexp
([Opaque
->new, 1, Opaque
->new]), '(<opaque> 1 <opaque>)';
16 is dump_sexp
('yes'), '"yes"';
17 is dump_sexp
('"ha\\ha\\ha"'), '"\\"ha\\\\ha\\\\ha\\""';
18 is dump_sexp
([1, "yes", 2]), '(1 "yes" 2)';
19 is dump_sexp
({b
=> 5, a
=> "yes"}), '(("a" . "yes") ("b" . 5))';
21 is dump_sexp
(\
42), 42;
22 is dump_sexp
(\\\\"aaaa"), '"aaaa"';
23 is dump_sexp
(\
substr "abcd", 1, 2), '"bc"';
25 throws_ok
{ dump_sexp
{key
=> sub{}} } qr/Cannot dump value of type CODE as sexp/;
29 my $ds = Data
::SExpression
->new({use_symbol_class
=> 1, fold_lists
=> 0});
30 my $parsed = $ds->read($sexp);
31 is dump_sexp
($parsed), $sexp, "roundtrip: $sexp";
34 roundtrip_test
'symbol';
35 roundtrip_test
'(HA-HA 111 "text")';
36 roundtrip_test
'(cons . cell)';
37 roundtrip_test
'(1 2 3 . 4)';
This page took 0.040901 seconds and 4 git commands to generate.