xref: /openbsd-src/gnu/usr.bin/perl/cpan/File-Temp/t/seekable.t (revision b39c515898423c8d899e35282f4b395f7cad3298)
1*b39c5158Smillert#  -*- perl -*-
2*b39c5158Smillert# Before `make install' is performed this script should be runnable with
3*b39c5158Smillert# `make test'. After `make install' it should work as `perl File-Temp.t'
4*b39c5158Smillert
5*b39c5158Smillert#########################
6*b39c5158Smillert
7*b39c5158Smillert# change 'tests => 1' to 'tests => last_test_to_print';
8*b39c5158Smillert
9*b39c5158Smillertuse Test::More tests => 10;
10*b39c5158SmillertBEGIN { use_ok('File::Temp') };
11*b39c5158Smillert
12*b39c5158Smillert#########################
13*b39c5158Smillert
14*b39c5158Smillert# Insert your test code below, the Test::More module is use()ed here so read
15*b39c5158Smillert# its man page ( perldoc Test::More ) for help writing this test script.
16*b39c5158Smillert
17*b39c5158Smillert# make sure we can create a tmp file...
18*b39c5158Smillert$tmp = File::Temp->new;
19*b39c5158Smillertisa_ok( $tmp, 'File::Temp' );
20*b39c5158Smillertisa_ok( $tmp, 'IO::Handle' );
21*b39c5158SmillertSKIP: {
22*b39c5158Smillert  skip "->isa is broken on 5.6.0", 1 if $] == 5.006000;
23*b39c5158Smillert  isa_ok( $tmp, 'IO::Seekable' );
24*b39c5158Smillert}
25*b39c5158Smillert
26*b39c5158Smillert# make sure the seek method is available...
27*b39c5158Smillert# Note that we need a reasonably modern IO::Seekable
28*b39c5158SmillertSKIP: {
29*b39c5158Smillert  skip "IO::Seekable is too old", 1 if IO::Seekable->VERSION <= 1.06;
30*b39c5158Smillert  ok( File::Temp->can('seek'), 'tmp can seek' );
31*b39c5158Smillert}
32*b39c5158Smillert
33*b39c5158Smillert# make sure IO::Handle methods are still there...
34*b39c5158Smillertok( File::Temp->can('print'), 'tmp can print' );
35*b39c5158Smillert
36*b39c5158Smillert# let's see what we're exporting...
37*b39c5158Smillert$c = scalar @File::Temp::EXPORT;
38*b39c5158Smillert$l = join ' ', @File::Temp::EXPORT;
39*b39c5158Smillertok( $c == 9, "really exporting $c: $l" );
40*b39c5158Smillert
41*b39c5158Smillertok(defined eval { SEEK_SET() }, 'SEEK_SET defined by File::Temp') or diag $@;
42*b39c5158Smillertok(defined eval { SEEK_END() }, 'SEEK_END defined by File::Temp') or diag $@;
43*b39c5158Smillertok(defined eval { SEEK_CUR() }, 'SEEK_CUR defined by File::Temp') or diag $@;
44