]> iEval git - data-dump-sexp.git/blame - t/Data-Dump-Sexp.t
Initial commit
[data-dump-sexp.git] / t / Data-Dump-Sexp.t
CommitLineData
9336e296
MG
1#!/usr/bin/perl
2use strict;
3use warnings;
4
5use Test::More tests => 10;
6BEGIN { use_ok('Data::Dump::Sexp') };
7
8use Data::SExpression;
9
10is dump_sexp(5), 5;
11is dump_sexp('yes'), '"yes"';
12is dump_sexp('"ha\\ha\\ha"'), '"\\"ha\\\\ha\\\\ha\\""';
13is dump_sexp([1, "yes", 2]), '(1 "yes" 2)';
14is dump_sexp({b => 5, a => "yes"}), '(("a" . "yes") ("b" . 5))';
15
16sub roundtrip_test {
17 my ($sexp) = @_;
18 my $ds = Data::SExpression->new({use_symbol_class => 1, fold_lists => 0});
19 my $parsed = $ds->read($sexp);
20 is dump_sexp($parsed), $sexp
21}
22
23roundtrip_test 'symbol';
24roundtrip_test '(HA-HA 111 "text")';
25roundtrip_test '(cons . cell)';
26roundtrip_test '(1 2 3 . 4)';
This page took 0.021647 seconds and 4 git commands to generate.