2 # Before `make install' is performed this script should be runnable with
3 # `make test'. After `make install' it should work as `perl File-Temp.t'
5 #########################
7 # change 'tests => 1' to 'tests => last_test_to_print';
9 use Test::More tests => 10;
10 BEGIN { use_ok('File::Temp') };
12 #########################
14 # Insert your test code below, the Test::More module is use()ed here so read
15 # its man page ( perldoc Test::More ) for help writing this test script.
17 # make sure we can create a tmp file...
18 $tmp = File::Temp->new;
19 isa_ok( $tmp, 'File::Temp' );
20 isa_ok( $tmp, 'IO::Handle' );
21 isa_ok( $tmp, 'IO::Seekable' );
23 # make sure the seek method is available...
24 # Note that we need a reasonably modern IO::Seekable
26 skip "IO::Seekable is too old", 1 if IO::Seekable->VERSION <= 1.06;
27 ok( File::Temp->can('seek'), 'tmp can seek' );
30 # make sure IO::Handle methods are still there...
31 ok( File::Temp->can('print'), 'tmp can print' );
33 # let's see what we're exporting...
34 $c = scalar @File::Temp::EXPORT;
35 $l = join ' ', @File::Temp::EXPORT;
36 ok( $c == 9, "really exporting $c: $l" );
38 ok(defined eval { SEEK_SET() }, 'SEEK_SET defined by File::Temp') or diag $@;
39 ok(defined eval { SEEK_END() }, 'SEEK_END defined by File::Temp') or diag $@;
40 ok(defined eval { SEEK_CUR() }, 'SEEK_CUR defined by File::Temp') or diag $@;