]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/25-copy.t
Tweak some optional module loading in tests
[perl/modules/Variable-Magic.git] / t / 25-copy.t
index 0630ae33502d7c659616d1df4de0b9bebb809d9f..7e13dfdf324fdd525986dbaba8b23456f23d9a1f 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use Test::More;
 
-use Variable::Magic qw/cast dispell MGf_COPY/;
+use Variable::Magic qw<cast dispell MGf_COPY>;
 
 if (MGf_COPY) {
  plan tests => 2 + ((2 * 5 + 3) + (2 * 2 + 1)) + (2 * 9 + 6) + 1;
@@ -20,9 +20,9 @@ use Variable::Magic::TestValue;
 my $wiz = init_watcher 'copy', 'copy';
 
 SKIP: {
eval "use Tie::Array";
my $has_tie_array = do { local $@; eval { require Tie::Array; 1 } };
  skip 'Tie::Array required to test copy magic on arrays'
-                                             => (2 * 5 + 3) + (2 * 2 + 1) if $@;
+                             => (2 * 5 + 3) + (2 * 2 + 1) unless $has_tie_array;
  defined and diag "Using Tie::Array $_" for $Tie::Array::VERSION;
 
  tie my @a, 'Tie::StdArray';
@@ -55,8 +55,9 @@ SKIP: {
 }
 
 SKIP: {
- eval "use Tie::Hash";
- skip 'Tie::Hash required to test copy magic on hashes' => 2 * 9 + 6 if $@;
+ my $has_tie_hash = do { local $@; eval { require Tie::Hash; 1 } };
+ skip 'Tie::Hash required to test copy magic on hashes'
+                                              => 2 * 9 + 6 unless $has_tie_hash;
  defined and diag "Using Tie::Hash $_" for $Tie::Hash::VERSION;
 
  tie my %h, 'Tie::StdHash';
@@ -79,7 +80,7 @@ SKIP: {
  watch { my ($k, $v) = each %h } { copy => 1 }, 'tied hash each';
 
  my @k = watch { keys %h } { }, 'tied hash keys';
- is_deeply [ sort @k ], [ qw/a c/ ], 'copy: tied hash keys correctly';
+ is_deeply [ sort @k ], [ qw<a c> ], 'copy: tied hash keys correctly';
 
  my @v = watch { values %h } { copy => 2 }, 'tied hash values';
  is_deeply [ sort { $a <=> $b } @v ], [ 1, 3 ], 'copy: tied hash values correctly';