Browse files

Small test idiom things. The changes allow tests to be run in more wa…

…ys from more directories and with more information shown.
  • Loading branch information...
1 parent e7a70de commit 6c574ad51a6fd3de80d0c29f2961d359aa7c27a7 @rocky committed Aug 6, 2011
Showing with 72 additions and 47 deletions.
  1. +7 −4 t/00.load.t
  2. +2 −1 t/01.pod-coverage.t
  3. +5 −2 t/01.pod.t
  4. +7 −5 t/02.default.t
  5. +6 −4 t/05.ops.t
  6. +6 −3 t/06.bincue.t
  7. +6 −4 t/06.image.t
  8. +6 −4 t/06.toc.t
  9. +10 −10 t/07.iso.t
  10. +3 −2 t/07.iso1.t
  11. +3 −2 t/07.iso2.t
  12. +3 −2 t/07.iso3.t
  13. +4 −2 t/10.cdda.t
  14. +4 −2 t/10.read.t
View
11 t/00.load.t
@@ -1,15 +1,18 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
use strict;
+use warnings;
BEGIN {
- chdir 't' if -d 't';
+ use File::Basename;
+ chdir basename(__FILE__);
}
use lib '../lib';
use blib;
-use Test::More tests => 1;
+use Test::More tests => 2;
+note( "Testing Device::Cdio $Device::Cdio::VERSION" );
BEGIN {
use_ok( 'Device::Cdio' );
}
-diag( "Testing Device::Cdio $Device::Cdio::VERSION" );
+ok(defined($Device::Cdio::VERSION), "\$Device::Cdio::VERSION number is set");
View
3 t/01.pod-coverage.t
@@ -1,7 +1,8 @@
#!/usr/bin/perl -T
use strict;
BEGIN {
- chdir '..' if ! -d 't';
+ use File::Basename;
+ chdir basename(__FILE__);
push @INC, ('blib/lib', 'blib/arch');
}
View
7 t/01.pod.t
@@ -1,11 +1,14 @@
-#!perl -T
+#!/usr/bin/perl -T
use strict;
+use warnings;
BEGIN {
- chdir '..' if ! -d 't';
+ use File::Basename;
+ chdir basename(__FILE__);
push @INC, ('blib/lib', 'blib/arch');
}
use Test::More;
+note("Test POD Documentation");
eval "use Test::Pod 1.14";
plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
all_pod_files_ok();
View
12 t/02.default.t
@@ -1,15 +1,18 @@
-#!/usr/bin/perl -w
-# Test getting default device
+#!/usr/bin/env perl
use strict;
+use warnings;
BEGIN {
- chdir 't' if -d 't';
+ use File::Basename;
+ chdir basename(__FILE__);
+ push @INC, ('blib/lib', 'blib/arch');
}
use lib '../lib';
use blib;
use Device::Cdio::Device;
-use Test::Simple tests => 3;
+use Test::More tests => 3;
+note 'Test getting a default device driver';
my $result1=Device::Cdio::get_default_device_driver($perlcdio::DRIVER_DEVICE);
my $result2=Device::Cdio::get_default_device_driver();
@@ -32,4 +35,3 @@ if (defined($result2)) {
# Didn't find any default device. So we have to skip this.
ok(1, "get_default_device_driver array form skipped - no device");
}
-
View
10 t/05.ops.t
@@ -1,20 +1,22 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Test running miscellaneous operations
# No assumption about the CD-ROM drives is made, so
# we're just going to run operations and see that they
# don't crash.
use strict;
-
+use warnings;
BEGIN {
- chdir 't' if -d 't';
+ use File::Basename;
+ chdir basename(__FILE__);
}
use lib '../lib';
use blib;
use Device::Cdio;
use Device::Cdio::Device;
-use Test::Simple tests => 6;
+use Test::More tests => 6;
+note 'Test running miscellaneous operations';
my @drives = Device::Cdio::get_devices();
ok ( 1 , 'Device::Cdio::get_devices');
View
9 t/06.bincue.t
@@ -1,16 +1,19 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
#Test functioning of BIN/CUE image routines
use strict;
+use warnings;
BEGIN {
- chdir 't' if -d 't';
+ use File::Basename;
+ chdir basename(__FILE__);
}
use lib '../lib';
use blib;
use Device::Cdio::Device;
-use Test::Simple tests => 14;
+use Test::More tests => 14;
+note "Test BIN/CUE image routines";
my $cuefile="data/cdda.cue";
$cuefile = '../data/cdda.cue' if ! -f $cuefile;
View
10 t/06.image.t
@@ -1,16 +1,19 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Test that we have image drivers
use strict;
+use warnings;
BEGIN {
- chdir 't' if -d 't';
+ use File::Basename;
+ chdir basename(__FILE__);
}
use lib '../lib';
use blib;
use Device::Cdio::Device;
-use Test::Simple tests => 6;
+use Test::More tests => 6;
+note "Test we have image drivers";
my $result = Device::Cdio::have_driver('CDRDAO');
ok($result, "Have cdrdrao driver via string");
@@ -24,4 +27,3 @@ $result = Device::Cdio::have_driver('BIN/CUE');
ok($result, "Have BIN/CUE driver via string");
$result = Device::Cdio::have_driver($perlcdio::DRIVER_BINCUE);
ok($result, "Have BIN/CUE driver via driver_id");
-
View
10 t/06.toc.t
@@ -1,16 +1,19 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
#Test functioning of cdrdao image routines
use strict;
+use warnings;
BEGIN {
- chdir 't' if -d 't';
+ use File::Basename;
+ chdir basename(__FILE__);
}
use lib '../lib';
use blib;
use Device::Cdio::Device;
-use Test::Simple tests => 12;
+use Test::More tests => 12;
+note "Test cdrdao image routines";
## TOC reading needs to be done in the directory where the
## TOC/BIN files reside.
@@ -55,4 +58,3 @@ ok($perlcdio::DRIVER_OP_UNSUPPORTED == $drc, "set blocksize");
$drc = $device->set_speed(5);
ok($perlcdio::DRIVER_OP_UNSUPPORTED == $drc, "set speed");
$device->close();
-
View
20 t/07.iso.t 100644 → 100755
@@ -1,18 +1,21 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Test some low-level ISO9660 routines
# This is basically the same thing as libcdio's testiso9660.c
use strict;
+use warnings;
use Config;
BEGIN {
- chdir 't' if -d 't';
+ use File::Basename;
+ chdir basename(__FILE__);
}
use lib '../lib';
use blib;
use perliso9660;
use Test::More tests => 14;
+note 'Test low-level ISO9660 routines';
sub is_eq($$) {
my ($a_ref, $b_ref) = @_;
@@ -183,13 +186,10 @@ my ($bool, @new_tm) = perliso9660::get_dtime($dtime, 1);
ok(is_eq(\@new_tm, \@tm), 'get_dtime(set_dtime())');
-#if ($perliso9660::VERSION_NUM >= 77) {
-# @tm = gmtime(0);
-# my $ltime = perliso9660::set_ltime($tm[0], $tm[1], $tm[2], $tm[3], $tm[4],
-# $tm[5]);
-# ($bool, @new_tm) = perliso9660::get_ltime($ltime);
-# ok(is_eq(\@new_tm, \@tm), 'get_ltime(set_ltime())');
-#}
+# @tm = gmtime(0);
+# my $ltime = perliso9660::set_ltime($tm[0], $tm[1], $tm[2], $tm[3], $tm[4],
+# $tm[5]);
+# ($bool, @new_tm) = perliso9660::get_ltime($ltime);
+# ok(is_eq(\@new_tm, \@tm), 'get_ltime(set_ltime())');
-exit 0;
View
5 t/07.iso1.t 100644 → 100755
@@ -1,8 +1,9 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Test of some ISO9660::IFS routines
# This is similar to example/iso1.pl
use strict;
+use warnings;
use Config;
BEGIN {
@@ -18,6 +19,7 @@ use Device::Cdio::ISO9660::IFS;
use File::Spec;
use Test::More tests => 5;
+note 'Test ISO9660::IFS routines';
# The test ISO 9660 image
my $ISO9660_IMAGE_PATH="../data";
@@ -46,4 +48,3 @@ my @okay_stats = (
is_deeply(\@file_stats, \@okay_stats, 'ISO 9660 file stats');
$iso->close();
-exit 0;
View
5 t/07.iso2.t 100644 → 100755
@@ -1,8 +1,9 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Test of some ISO9660::IFS routines
# This is similar to example/iso2.pl
use strict;
+use warnings;
use Config;
BEGIN {
@@ -19,6 +20,7 @@ use File::Spec;
use POSIX;
use Test::More tests => 5;
+note 'Test ISO9660::IFS routines';
# The test CD image
my $CD_IMAGE_PATH="../data";
@@ -415,4 +417,3 @@ ok(substr($file_contents, 0, $len) eq substr($file_contents, 0, $len),
'File contents comparison') ;
$cd->close();
-exit 0;
View
5 t/07.iso3.t 100644 → 100755
@@ -1,8 +1,9 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Test of some ISO9660::IFS routines
# This is similar to example/iso2.pl
use strict;
+use warnings;
use Config;
BEGIN {
@@ -19,6 +20,7 @@ use File::Spec;
use POSIX;
use Test::More tests => 3;
+note 'Test ISO9660::IFS routines';
# The test CD image
my $ISO9660_IMAGE_PATH="../data";
@@ -398,4 +400,3 @@ ok(substr($file_contents, 0, $len) eq substr($file_contents, 0, $len),
'File contents comparison') ;
$iso->close();
-exit 0;
View
6 t/10.cdda.t
@@ -1,7 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
##Test functioning CD-DA
use strict;
+use warnings;
BEGIN {
chdir 't' if -d 't';
@@ -10,7 +11,8 @@ use lib '../lib';
use blib;
use Device::Cdio::Device;
-use Test::Simple tests => 10;
+use Test::More tests => 10;
+note('Test functioning CD-DA');
my $cuefile = '../data/cdda.cue';
my $device = Device::Cdio::Device->new(-source=>$cuefile);
View
6 t/10.read.t
@@ -1,7 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Test functioning of read routines
use strict;
+use warnings;
BEGIN {
chdir 't' if -d 't';
@@ -10,7 +11,8 @@ use lib '../lib';
use blib;
use Device::Cdio::Device;
-use Test::Simple tests => 6;
+use Test::More tests => 6;
+note "Test functioning of read routines";
my $cuefile="../data/isofs-m1.cue";
my $device = Device::Cdio::Device->new(-source=>$cuefile);

0 comments on commit 6c574ad

Please sign in to comment.