added todos from bug reports from cpan
[urisagit/File-Slurp.git] / t / data_scalar.t
CommitLineData
635c7876 1#!/usr/local/bin/perl -w
2
3use strict ;
4
5use Carp ;
6use POSIX qw( :fcntl_h ) ;
7use Test::More tests => 2 ;
8
9# in case SEEK_SET isn't defined in older perls. it seems to always be 0
10
11BEGIN {
12
13 *SEEK_SET = sub { 0 } unless eval { SEEK_SET() } ;
14}
15
16BEGIN{
17 use_ok( 'File::Slurp', ) ;
18}
19
20eval { require B } ;
21
22SKIP: {
23
24 skip <<TEXT, 1 if $@ ;
25B.pm not found in this Perl. Note this will cause slurping of
26the DATA handle to fail.
27TEXT
28
29 test_data_scalar_slurp() ;
30}
31
32exit ;
33
34
35
36exit ;
37
38sub test_data_scalar_slurp {
39
40 my $data_seek = tell( \*DATA );
41
42# first slurp in the text
43
44 my $slurp_text = read_file( \*DATA ) ;
45
46# now we need to get the golden data
47
48 seek( \*DATA, $data_seek, SEEK_SET ) || die "seek $!" ;
49 my $data_text = join( '', <DATA> ) ;
50
51 is( $slurp_text, $data_text, 'scalar slurp of DATA' ) ;
52}
53
54__DATA__
55line one
56second line
57more lines
58still more
59
60enough lines
61
62we can't test long handle slurps from DATA since i would have to type
63too much stuff
64
65so we will stop here