Initial commit
[data-sexpression-util.git] / t / Data-SExpression-Util.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use Test::More tests => 6;
6 use Data::Dump::Sexp qw/dump_sexp/;
7 BEGIN { use_ok('Data::SExpression::Util', ':all') };
8
9 my $list = cons 1, cons 2, cons 3, undef; # (1 2 3)
10 my $other_list = cons 4, cons 5, undef; # (4 5)
11
12 $list = append $list, $other_list; # $list is now (1 2 3 4 5)
13
14 is position(1, $list), 0;
15 is position(4, $list), 3;
16 ok !defined(position 0, $list);
17
18 $list = rev $list;
19 is dump_sexp($list), '(5 4 3 2 1)';
20
21 $list = mapcar { $_ + 1 } $list; # (6 5 4 3 2)
22 is dump_sexp($list), '(6 5 4 3 2)';
This page took 0.023595 seconds and 4 git commands to generate.