From: Vincent Pit Date: Wed, 30 Jan 2013 15:59:33 +0000 (-0200) Subject: Add some tests X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=e8344578d5e1adee2159ae5490719996d6834bdb;p=perl%2Fmodules%2FVPIT-TestHelpers.git Add some tests --- diff --git a/t/10-more-skip.t b/t/10-more-skip.t new file mode 100644 index 0000000..65013fc --- /dev/null +++ b/t/10-more-skip.t @@ -0,0 +1,24 @@ +#!perl -T + +use strict; +use warnings; + +use Test::More tests => 5; + +use VPIT::TestHelpers; + +pass 'first test'; + +SKIP: { + load_or_skip 'VPIT::NonExistent', '1.23', [ ], 1; + fail 'second test'; +} + +pass 'third test'; + +SKIP: { + load_or_skip 'Cwd', undef, [ 'not_in_cwd_pm' ], 1; + fail 'fourth test'; +} + +pass 'fifth test'; diff --git a/t/11-more-skip_all-load.t b/t/11-more-skip_all-load.t new file mode 100644 index 0000000..1de6125 --- /dev/null +++ b/t/11-more-skip_all-load.t @@ -0,0 +1,14 @@ +#!perl -T + +use strict; +use warnings; + +use Test::More; + +use VPIT::TestHelpers; + +load_or_skip_all 'VPIT::NonExistent', '1.23'; + +plan tests => 1; + +fail 'not reached'; diff --git a/t/12-more-skip_all-import.t b/t/12-more-skip_all-import.t new file mode 100644 index 0000000..dc7b3c4 --- /dev/null +++ b/t/12-more-skip_all-import.t @@ -0,0 +1,14 @@ +#!perl -T + +use strict; +use warnings; + +use Test::More; + +use VPIT::TestHelpers; + +load_or_skip_all 'Cwd', undef, [ 'not_in_cwd_pm' ]; + +plan tests => 1; + +fail 'not reached'; diff --git a/t/13-more-import.t b/t/13-more-import.t new file mode 100644 index 0000000..2dedf59 --- /dev/null +++ b/t/13-more-import.t @@ -0,0 +1,24 @@ +#!perl -T + +use strict; +use warnings; + +use Test::More; + +use VPIT::TestHelpers; + +load_or_skip_all 'Cwd', undef, [ 'abs_path' ]; + +plan tests => 1; + +my $result = do { + local $@; + eval 'abs_path $^X'; +}; + +my $expected = do { + require Cwd; + Cwd::abs_path($^X); +}; + +is $result, $expected, 'Cwd::abs_path() was imported into main'; diff --git a/t/20-leaner-skip.t b/t/20-leaner-skip.t new file mode 100644 index 0000000..2a98279 --- /dev/null +++ b/t/20-leaner-skip.t @@ -0,0 +1,24 @@ +#!perl -T + +use strict; +use warnings; + +use Test::Leaner tests => 5; + +use VPIT::TestHelpers; + +pass 'first test'; + +SKIP: { + load_or_skip 'VPIT::NonExistent', '1.23', [ ], 1; + fail 'second test'; +} + +pass 'third test'; + +SKIP: { + load_or_skip 'Cwd', undef, [ 'not_in_cwd_pm' ], 1; + fail 'fourth test'; +} + +pass 'fifth test'; diff --git a/t/21-leaner-skip_all-load.t b/t/21-leaner-skip_all-load.t new file mode 100644 index 0000000..352e867 --- /dev/null +++ b/t/21-leaner-skip_all-load.t @@ -0,0 +1,14 @@ +#!perl -T + +use strict; +use warnings; + +use Test::Leaner; + +use VPIT::TestHelpers; + +load_or_skip_all 'VPIT::NonExistent', '1.23'; + +plan tests => 1; + +fail 'not reached'; diff --git a/t/22-leaner-skip_all-import.t b/t/22-leaner-skip_all-import.t new file mode 100644 index 0000000..df2b186 --- /dev/null +++ b/t/22-leaner-skip_all-import.t @@ -0,0 +1,14 @@ +#!perl -T + +use strict; +use warnings; + +use Test::Leaner; + +use VPIT::TestHelpers; + +load_or_skip_all 'Cwd', undef, [ 'not_in_cwd_pm' ]; + +plan tests => 1; + +fail 'not reached'; diff --git a/t/23-leaner-import.t b/t/23-leaner-import.t new file mode 100644 index 0000000..8179206 --- /dev/null +++ b/t/23-leaner-import.t @@ -0,0 +1,24 @@ +#!perl -T + +use strict; +use warnings; + +use Test::Leaner; + +use VPIT::TestHelpers; + +load_or_skip_all 'Cwd', undef, [ 'abs_path' ]; + +plan tests => 1; + +my $result = do { + local $@; + eval 'abs_path $^X'; +}; + +my $expected = do { + require Cwd; + Cwd::abs_path($^X); +}; + +is $result, $expected, 'Cwd::abs_path() was imported into main';