1 #!/usr/local/bin/perl -w
10 my $file = 'slurp.data' ;
17 [ map( "aaaaaaaa\n\n", 1 .. 3 ) ],
18 [ map( "aaaaaaaa\n\n", 1 .. 3 ), 'aaaaaaaa' ],
19 [ map( "aaaaaaaa" . ( "\n" x (2 + rand 3) ), 1 .. 100 ) ],
20 [ map( "aaaaaaaa" . ( "\n" x (2 + rand 3) ), 1 .. 100 ), 'aaaaaaaa' ],
24 plan( tests => 3 * @text_data ) ;
26 #print "# text slurp\n" ;
28 foreach my $data ( @text_data ) {
30 test_text_slurp( $data ) ;
40 my( $data_ref ) = @_ ;
42 my @data_lines = @{$data_ref} ;
43 my $data_text = join( '', @data_lines ) ;
47 my $err = write_file( $file, $data_text ) ;
48 ok( $err, 'write_file - ' . length $data_text ) ;
51 my @array = read_file( $file ) ;
52 ok( eq_array( \@array, \@data_lines ),
53 'array read_file - ' . length $data_text ) ;
55 print "READ:\n", map( "[$_]\n", @array ),
56 "EXP:\n", map( "[$_]\n", @data_lines )
57 unless eq_array( \@array, \@data_lines ) ;
59 my $array_ref = read_file( $file, array_ref => 1 ) ;
60 ok( eq_array( $array_ref, \@data_lines ),
61 'array ref read_file - ' . length $data_text ) ;