summaryrefslogtreecommitdiff
path: root/dist/Env
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-01-24 16:22:57 +0000
committerNicholas Clark <nick@ccl4.org>2011-01-24 16:28:55 +0000
commit2b4e7dd9a254f68cb24561d0aa5e7824cf5da634 (patch)
tree6f1816476f3fc674ebe1f34dfe05482bf1a0aec6 /dist/Env
parent80b774e43cfdd26d01e24bcc667563c7fad4d5c1 (diff)
downloadperl-2b4e7dd9a254f68cb24561d0aa5e7824cf5da634.tar.gz
Convert Env's tests to Test::More
Diffstat (limited to 'dist/Env')
-rw-r--r--dist/Env/t/array.t12
-rw-r--r--dist/Env/t/env.t115
2 files changed, 47 insertions, 80 deletions
diff --git a/dist/Env/t/array.t b/dist/Env/t/array.t
index ed84834525..d6a15a6c26 100644
--- a/dist/Env/t/array.t
+++ b/dist/Env/t/array.t
@@ -5,16 +5,12 @@ BEGIN {
$ENV{BAR} = "bar";
}
+use strict;
+use Test::More tests => 2;
use Env qw(FOO $BAR);
$FOO .= "/bar";
$BAR .= "/baz";
-print "1..2\n";
-
-print "not " if $FOO ne 'foo/bar';
-print "ok 1\n";
-
-print "not " if $BAR ne 'bar/baz';
-print "ok 2\n";
-
+is($FOO, 'foo/bar');
+is($BAR, 'bar/baz');
diff --git a/dist/Env/t/env.t b/dist/Env/t/env.t
index 888120270c..9e87f4a6b2 100644
--- a/dist/Env/t/env.t
+++ b/dist/Env/t/env.t
@@ -2,11 +2,11 @@
$| = 1;
-if ($^O eq 'VMS') {
- print "1..11\n";
- foreach (1..11) { print "ok $_ # skipped for VMS\n"; }
- exit 0;
-}
+use strict;
+use Test::More;
+
+plan(skip_all => "skipped for VMS") if $^O eq 'VMS';
+plan(tests => 11);
use Env qw(@FOO);
use vars qw(@BAR);
@@ -21,75 +21,46 @@ sub array_equal
return 1;
}
-sub test
-{
- my ($desc, $code) = @_;
+@FOO = qw(a B c);
+@BAR = qw(a B c);
+is_deeply(\@FOO, \@BAR, "Assignment");
- &$code;
+$FOO[1] = 'b';
+$BAR[1] = 'b';
+is_deeply(\@FOO, \@BAR, "Storing");
- print "# $desc...\n";
- print "# FOO = (", join(", ", @FOO), ")\n";
- print "# BAR = (", join(", ", @BAR), ")\n";
+$#FOO = 0;
+$#BAR = 0;
+is_deeply(\@FOO, \@BAR, "Truncation");
- if (defined $check) { print "not " unless &$check; }
- else { print "not " unless array_equal(\@FOO, \@BAR); }
+push @FOO, 'b', 'c';
+push @BAR, 'b', 'c';
+is_deeply(\@FOO, \@BAR, "Push");
- print "ok ", ++$i, "\n";
-}
+pop @FOO;
+pop @BAR;
+is_deeply(\@FOO, \@BAR, "Pop");
+
+shift @FOO;
+shift @BAR;
+is_deeply(\@FOO, \@BAR, "Shift");
+
+push @FOO, 'c';
+push @BAR, 'c';
+is_deeply(\@FOO, \@BAR, "Push");
+
+unshift @FOO, 'a';
+unshift @BAR, 'a';
+is_deeply(\@FOO, \@BAR, "Unshift");
+
+@FOO = reverse @FOO;
+@BAR = reverse @BAR;
+is_deeply(\@FOO, \@BAR, "Reverse");
+
+@FOO = sort @FOO;
+@BAR = sort @BAR;
+is_deeply(\@FOO, \@BAR, "Sort");
-print "1..11\n";
-
-test "Assignment", sub {
- @FOO = qw(a B c);
- @BAR = qw(a B c);
-};
-
-test "Storing", sub {
- $FOO[1] = 'b';
- $BAR[1] = 'b';
-};
-
-test "Truncation", sub {
- $#FOO = 0;
- $#BAR = 0;
-};
-
-test "Push", sub {
- push @FOO, 'b', 'c';
- push @BAR, 'b', 'c';
-};
-
-test "Pop", sub {
- pop @FOO;
- pop @BAR;
-};
-
-test "Shift", sub {
- shift @FOO;
- shift @BAR;
-};
-
-test "Push", sub {
- push @FOO, 'c';
- push @BAR, 'c';
-};
-
-test "Unshift", sub {
- unshift @FOO, 'a';
- unshift @BAR, 'a';
-};
-
-test "Reverse", sub {
- @FOO = reverse @FOO;
- @BAR = reverse @BAR;
-};
-
-test "Sort", sub {
- @FOO = sort @FOO;
- @BAR = sort @BAR;
-};
-
-test "Splice", sub {
- splice @FOO, 1, 1, 'B';
- splice @BAR, 1, 1, 'B';
-};
+splice @FOO, 1, 1, 'B';
+splice @BAR, 1, 1, 'B';
+is_deeply(\@FOO, \@BAR, "Splice");