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