This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add Test::More, from Michael G Schwern.
[perl5.git] / lib / Test / More / t / More.t
CommitLineData
3f2ec160
JH
1use Test::More tests => 18;
2
3use_ok('Text::Soundex');
4require_ok('Test::More');
5
6
7ok( 2 eq 2, 'two is two is two is two' );
8is( "foo", "foo", 'foo is foo' );
9isnt( "foo", "bar", 'foo isnt bar');
10isn't("foo", "bar", 'foo isn\'t bar');
11
12#'#
13like("fooble", '/^foo/', 'foo is like fooble');
14like("FooBle", '/foo/i', 'foo is like FooBle');
15
16pass('pass() passed');
17
18ok( eq_array([qw(this that whatever)], [qw(this that whatever)]),
19 'eq_array with simple arrays' );
20ok( eq_hash({ foo => 42, bar => 23 }, {bar => 23, foo => 42}),
21 'eq_hash with simple hashes' );
22ok( eq_set([qw(this that whatever)], [qw(that whatever this)]),
23 'eq_set with simple sets' );
24
25my @complex_array1 = (
26 [qw(this that whatever)],
27 {foo => 23, bar => 42},
28 "moo",
29 "yarrow",
30 [qw(498 10 29)],
31 );
32my @complex_array2 = (
33 [qw(this that whatever)],
34 {foo => 23, bar => 42},
35 "moo",
36 "yarrow",
37 [qw(498 10 29)],
38 );
39
40ok( eq_array(\@complex_array1, \@complex_array2),
41 'eq_array with complicated arrays' );
42ok( eq_set(\@complex_array1, \@complex_array2),
43 'eq_set with complicated arrays' );
44
45my @array1 = (qw(this that whatever),
46 {foo => 23, bar => 42} );
47my @array2 = (qw(this that whatever),
48 {foo => 24, bar => 42} );
49
50ok( !eq_array(\@array1, \@array2),
51 'eq_array with slightly different complicated arrays' );
52ok( !eq_set(\@array1, \@array2),
53 'eq_set with slightly different complicated arrays' );
54
55my %hash1 = ( foo => 23,
56 bar => [qw(this that whatever)],
57 har => { foo => 24, bar => 42 },
58 );
59my %hash2 = ( foo => 23,
60 bar => [qw(this that whatever)],
61 har => { foo => 24, bar => 42 },
62 );
63
64
65ok( eq_hash(\%hash1, \%hash2),
66 'eq_hash with complicated hashes');
67
68%hash1 = ( foo => 23,
69 bar => [qw(this that whatever)],
70 har => { foo => 24, bar => 42 },
71 );
72%hash2 = ( foo => 23,
73 bar => [qw(this tha whatever)],
74 har => { foo => 24, bar => 42 },
75 );
76
77ok( !eq_hash(\%hash1, \%hash2),
78 'eq_hash with slightly different complicated hashes' );