1N/A#!./perl
1N/Ause FileCache maxopen=>2;
1N/Ause Test;
1N/Ause vars qw(@files);
1N/ABEGIN {
1N/A @files = qw(foo bar baz quux);
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 plan tests=>5;
1N/A}
1N/AEND{
1N/A 1 while unlink @files;
1N/A}
1N/A
1N/A{# Test 2: that we actually adhere to maxopen
1N/A for my $path ( @files ){
1N/A cacheout $path;
1N/A print $path "$path 1\n";
1N/A }
1N/A
1N/A my @cat;
1N/A for my $path ( @files ){
1N/A ok(fileno($path) || $path =~ /^(?:foo|bar)$/);
1N/A next unless fileno($path);
1N/A print $path "$path 2\n";
1N/A close($path);
1N/A open($path, $path);
1N/A <$path>;
1N/A push @cat, <$path>;
1N/A close($path);
1N/A }
1N/A ok( grep(/^(?:baz|quux) 2$/, @cat) == 2 );
1N/A}