This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Set PERL_CORE environment var
[perl5.git] / lib / Test / Simple / t / More.t
CommitLineData
d020a79a 1use Test::More tests => 22;
3f2ec160
JH
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');
d020a79a
JH
15like("/usr/local/pr0n/", '/^\/usr\/local/', 'regexes with slashes in like' );
16
17can_ok('Test::More', qw(require_ok use_ok ok is isnt like skip can_ok
18 pass fail eq_array eq_hash eq_set));
19can_ok(bless({}, "Test::More"), qw(require_ok use_ok ok is isnt like skip
20 can_ok pass fail eq_array eq_hash eq_set));
21
22isa_ok(bless([], "Foo"), "Foo");
23
3f2ec160
JH
24
25pass('pass() passed');
26
27ok( eq_array([qw(this that whatever)], [qw(this that whatever)]),
28 'eq_array with simple arrays' );
29ok( eq_hash({ foo => 42, bar => 23 }, {bar => 23, foo => 42}),
30 'eq_hash with simple hashes' );
31ok( eq_set([qw(this that whatever)], [qw(that whatever this)]),
32 'eq_set with simple sets' );
33
34my @complex_array1 = (
35 [qw(this that whatever)],
36 {foo => 23, bar => 42},
37 "moo",
38 "yarrow",
39 [qw(498 10 29)],
40 );
41my @complex_array2 = (
42 [qw(this that whatever)],
43 {foo => 23, bar => 42},
44 "moo",
45 "yarrow",
46 [qw(498 10 29)],
47 );
48
49ok( eq_array(\@complex_array1, \@complex_array2),
50 'eq_array with complicated arrays' );
51ok( eq_set(\@complex_array1, \@complex_array2),
52 'eq_set with complicated arrays' );
53
54my @array1 = (qw(this that whatever),
55 {foo => 23, bar => 42} );
56my @array2 = (qw(this that whatever),
57 {foo => 24, bar => 42} );
58
59ok( !eq_array(\@array1, \@array2),
60 'eq_array with slightly different complicated arrays' );
61ok( !eq_set(\@array1, \@array2),
62 'eq_set with slightly different complicated arrays' );
63
64my %hash1 = ( foo => 23,
65 bar => [qw(this that whatever)],
66 har => { foo => 24, bar => 42 },
67 );
68my %hash2 = ( foo => 23,
69 bar => [qw(this that whatever)],
70 har => { foo => 24, bar => 42 },
71 );
72
73
74ok( eq_hash(\%hash1, \%hash2),
75 'eq_hash with complicated hashes');
76
77%hash1 = ( foo => 23,
78 bar => [qw(this that whatever)],
79 har => { foo => 24, bar => 42 },
80 );
81%hash2 = ( foo => 23,
82 bar => [qw(this tha whatever)],
83 har => { foo => 24, bar => 42 },
84 );
85
86ok( !eq_hash(\%hash1, \%hash2),
87 'eq_hash with slightly different complicated hashes' );