diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-11-09 13:24:41 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-11-09 13:24:41 +0000 |
commit | c175ccb5febc8a76b30f78e84345b465464a9239 (patch) | |
tree | 32785f3311260ad51e4a7e9f2449fb3c20d9ccf0 /ext/Opcode | |
parent | ddd7db170665460ccedfef1ffcda100256dabfd6 (diff) | |
download | perl-c175ccb5febc8a76b30f78e84345b465464a9239.tar.gz |
Tidy up ext/Opcode/t/Opcode.t.
Convert a loop with a die into regular tests. Don't declare lexicals ahead of
use. Don't even declare a lexical @o3, which isn't used.
Diffstat (limited to 'ext/Opcode')
-rw-r--r-- | ext/Opcode/t/Opcode.t | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ext/Opcode/t/Opcode.t b/ext/Opcode/t/Opcode.t index 39d01cc636..a648373ebc 100644 --- a/ext/Opcode/t/Opcode.t +++ b/ext/Opcode/t/Opcode.t @@ -21,9 +21,6 @@ BEGIN { )); } -my($s1, $s2, $s3); -my(@o1, @o2, @o3); - # --- opset_to_ops and opset my @empty_l = opset_to_ops(empty_opset); @@ -45,9 +42,9 @@ is_deeply(\@empty_l, []); my @full_l3 = opset_to_ops(opset(':all')); is_deeply(\@full_l1, \@full_l3); -$s1 = opset( 'padsv'); -$s2 = opset($s1, 'padav'); -$s3 = opset($s2, '!padav'); +my $s1 = opset( 'padsv'); +my $s2 = opset($s1, 'padav'); +my $s3 = opset($s2, '!padav'); isnt($s1, $s2); is($s1, $s3); @@ -69,8 +66,8 @@ isnt(opcodes(), 0); # --- invert_opset $s1 = opset(qw(fileno padsv padav)); -@o2 = opset_to_ops(invert_opset($s1)); -is(scalar @o2, opcodes-3); +my @o1 = opset_to_ops(invert_opset($s1)); +is(scalar @o1, opcodes-3); # --- opmask @@ -103,11 +100,14 @@ is(($s2 ^ $s3), opset('padsv','padhv')); # The extra bits mean we can't just say ~mask eq invert_opset(mask). @o1 = opset_to_ops( ~ $s3); -@o2 = opset_to_ops(invert_opset $s3); +my @o2 = opset_to_ops(invert_opset $s3); is_deeply(\@o1, \@o2); # --- finally, check some opname assertions -foreach(@full_l1) { die "bad opname: $_" if /\W/ or /^\d/ } +foreach my $opname (@full_l1) { + unlike($opname, qr/\W/, "opname $opname has no non-'word' characters"); + unlike($opname, qr/^\d/, "opname $opname does not start with a digit"); +} done_testing(); |