1N/A#!./perl
1N/Ause FileCache maxopen=>2;
1N/Ause vars qw(@files);
1N/ABEGIN {
1N/A @files = qw(foo bar baz quux Foo_Bar);
1N/A chdir 't' if -d 't';
1N/A
1N/A #For tests within the perl distribution
1N/A @INC = '../lib' if -d '../lib';
1N/A END;
1N/A}
1N/AEND{
1N/A 1 while unlink @files;
1N/A}
1N/A
1N/Aprint "1..2\n";
1N/A
1N/A{# Test 3: that we open for append on second viewing
1N/A my @cat;
1N/A for my $path ( @files ){
1N/A cacheout $path;
1N/A print $path "$path 3\n";
1N/A }
1N/A for my $path ( @files ){
1N/A cacheout $path;
1N/A print $path "$path 33\n";
1N/A }
1N/A for my $path ( @files ){
1N/A open($path, '<', $path);
1N/A push @cat, do{ local $/; <$path>};
1N/A close($path);
1N/A }
1N/A print 'not ' unless scalar grep(/\b3$/m, @cat) == scalar @files;
1N/A print "ok 1\n";
1N/A @cat = ();
1N/A for my $path ( @files ){
1N/A cacheout $path;
1N/A print $path "$path 333\n";
1N/A }
1N/A for my $path ( @files ){
1N/A open($path, '<', $path);
1N/A push @cat, do{ local $/; <$path>};
1N/A close($path);
1N/A }
1N/A print 'not ' unless scalar grep(/\b33$/m, @cat) == scalar @files;
1N/A print "ok 2\n";
1N/A}