From: Vincent Pit Date: Sun, 21 Nov 2010 22:56:26 +0000 (+0100) Subject: A terser way to display versions for modules used in tests X-Git-Tag: v0.45~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=e5e39f5e8bec67b3a08f861da63c5eb4cafed09f;p=perl%2Fmodules%2FVariable-Magic.git A terser way to display versions for modules used in tests --- diff --git a/t/16-huf.t b/t/16-huf.t index da2e674..0934219 100644 --- a/t/16-huf.t +++ b/t/16-huf.t @@ -16,8 +16,8 @@ if ($@) { plan skip_all => 'Hash::Util::FieldHash required for testing uvar interaction'; } else { plan tests => 2 * 5 + 7 + 1; - my $v = $Hash::Util::FieldHash::VERSION; - diag "Using Hash::Util::FieldHash $v" if defined $v; + defined and diag "Using Hash::Util::FieldHash $_" + for $Hash::Util::FieldHash::VERSION; } use lib 't/lib'; diff --git a/t/25-copy.t b/t/25-copy.t index 98fbf22..0630ae3 100644 --- a/t/25-copy.t +++ b/t/25-copy.t @@ -23,7 +23,7 @@ SKIP: { eval "use Tie::Array"; skip 'Tie::Array required to test copy magic on arrays' => (2 * 5 + 3) + (2 * 2 + 1) if $@; - diag "Using Tie::Array $Tie::Array::VERSION" if defined $Tie::Array::VERSION; + defined and diag "Using Tie::Array $_" for $Tie::Array::VERSION; tie my @a, 'Tie::StdArray'; @a = (1 .. 10); @@ -57,7 +57,7 @@ SKIP: { SKIP: { eval "use Tie::Hash"; skip 'Tie::Hash required to test copy magic on hashes' => 2 * 9 + 6 if $@; - diag "Using Tie::Hash $Tie::Hash::VERSION" if defined $Tie::Hash::VERSION; + defined and diag "Using Tie::Hash $_" for $Tie::Hash::VERSION; tie my %h, 'Tie::StdHash'; %h = (a => 1, b => 2, c => 3); diff --git a/t/28-uvar.t b/t/28-uvar.t index b0114ad..acc761f 100644 --- a/t/28-uvar.t +++ b/t/28-uvar.t @@ -53,7 +53,7 @@ is $x, 1, 'uvar: fetch directly with also non uvar magic correctly'; SKIP: { eval "use Tie::Hash"; skip 'Tie::Hash required to test uvar magic on tied hashes' => 2 * 5 + 4 if $@; - diag "Using Tie::Hash $Tie::Hash::VERSION" if defined $Tie::Hash::VERSION; + defined and diag "Using Tie::Hash $_" for $Tie::Hash::VERSION; tie my %h, 'Tie::StdHash'; %h = (x => 7, y => 8); diff --git a/t/30-scalar.t b/t/30-scalar.t index f6faea4..ab20ed6 100644 --- a/t/30-scalar.t +++ b/t/30-scalar.t @@ -112,7 +112,7 @@ SKIP: { } skip $SKIP => 3 if $SKIP; - diag "Using Tie::Array $Tie::Array::VERSION" if defined $Tie::Array::VERSION; + defined and diag "Using Tie::Array $_" for $Tie::Array::VERSION; tie my @a, 'Tie::StdArray'; $a[0] = $$; diff --git a/t/34-glob.t b/t/34-glob.t index b5c8394..bbfbeee 100644 --- a/t/34-glob.t +++ b/t/34-glob.t @@ -10,7 +10,7 @@ if ($@) { plan skip_all => "Symbol::gensym required for testing magic for globs"; } else { plan tests => 2 * 12 + 1; - diag "Using Symbol $Symbol::VERSION" if defined $Symbol::VERSION; + defined and diag "Using Symbol $_" for $Symbol::VERSION; } use Variable::Magic qw/cast dispell VMG_COMPAT_GLOB_GET/; diff --git a/t/40-threads.t b/t/40-threads.t index e483b7f..b86a4b4 100644 --- a/t/40-threads.t +++ b/t/40-threads.t @@ -32,10 +32,8 @@ use Variable::Magic qw/wizard cast dispell getdata VMG_THREADSAFE VMG_OP_INFO_NA BEGIN { skipall 'This Variable::Magic isn\'t thread safe' unless VMG_THREADSAFE; plan tests => (4 * 18 + 1) + (4 * 13 + 1); - my $v = $threads::VERSION; - diag "Using threads $v" if defined $v; - $v = $threads::shared::VERSION; - diag "Using threads::shared $v" if defined $v; + defined and diag "Using threads $_" for $threads::VERSION; + defined and diag "Using threads::shared $_" for $threads::shared::VERSION; } my $destroyed : shared = 0; diff --git a/t/41-clone.t b/t/41-clone.t index eb1e8c2..d66d098 100644 --- a/t/41-clone.t +++ b/t/41-clone.t @@ -32,10 +32,8 @@ use Variable::Magic qw/wizard cast dispell getdata VMG_THREADSAFE VMG_OP_INFO_NA BEGIN { skipall 'This Variable::Magic isn\'t thread safe' unless VMG_THREADSAFE; plan tests => 2 * 3 + 2 * (2 * 10 + 2) + 2 * (2 * 7 + 2); - my $v = $threads::VERSION; - diag "Using threads $v" if defined $v; - $v = $threads::shared::VERSION; - diag "Using threads::shared $v" if defined $v; + defined and diag "Using threads $_" for $threads::VERSION; + defined and diag "Using threads::shared $_" for $threads::shared::VERSION; } my $destroyed : shared = 0;