File: seekable.t

package info (click to toggle)
perl 5.20.2-3%2Bdeb8u11
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 102,964 kB
  • sloc: perl: 555,553; ansic: 214,041; sh: 38,121; pascal: 8,783; cpp: 3,895; makefile: 2,393; xml: 2,325; yacc: 1,741
file content (43 lines) | stat: -rw-r--r-- 1,420 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#  -*- perl -*-
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl File-Temp.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 10;
BEGIN { use_ok('File::Temp') };

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

# make sure we can create a tmp file...
$tmp = File::Temp->new;
isa_ok( $tmp, 'File::Temp' );
isa_ok( $tmp, 'IO::Handle' );
SKIP: {
  skip "->isa is broken on 5.6.0", 1 if $] == 5.006000;
  isa_ok( $tmp, 'IO::Seekable' );
}

# make sure the seek method is available...
# Note that we need a reasonably modern IO::Seekable
SKIP: {
  skip "IO::Seekable is too old", 1 if IO::Seekable->VERSION <= 1.06;
  ok( File::Temp->can('seek'), 'tmp can seek' );
}

# make sure IO::Handle methods are still there...
ok( File::Temp->can('print'), 'tmp can print' );

# let's see what we're exporting...
$c = scalar @File::Temp::EXPORT;
$l = join ' ', @File::Temp::EXPORT;
ok( $c == 9, "really exporting $c: $l" );

ok(defined eval { SEEK_SET() }, 'SEEK_SET defined by File::Temp') or diag $@;
ok(defined eval { SEEK_END() }, 'SEEK_END defined by File::Temp') or diag $@;
ok(defined eval { SEEK_CUR() }, 'SEEK_CUR defined by File::Temp') or diag $@;