BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ require './test.pl';
}
use strict;
use warnings;
-use Test::More tests => 122;
+plan tests => 122;
# The behaviour of the feature pragma should be tested by lib/switch.t
# using the tests in t/lib/switch/*. This file tests the behaviour of
# the switch ops themselves.
-
use feature 'switch';
-no warnings "numeric";
eval { continue };
like($@, qr/^Can't "continue" outside/, "continue outside");
# Code references
{
- no warnings "redefine";
my $called_foo = 0;
sub foo {$called_foo = 1; "@_" eq "foo"}
my $called_bar = 0;
default {$matched = 0}
}
- is($obj->{called}, 0, "$test: called");
- ok(!$matched, "$test: not matched");
+ is($obj->{called}, 1, "$test: called");
+ ok($matched, "$test: matched");
}
{
when ("other arg") {$matched = 1}
}
- is($obj->{called}, 0, "$test: called");
+ is($obj->{called}, 1, "$test: called");
ok(!$matched, "$test: not matched");
}