Commit | Line | Data |
1673d79e |
1 | #!./perl |
304efdcb |
2 | |
d9268716 |
3 | use FileCache maxopen => 2; |
1673d79e |
4 | use vars qw(@files); |
d9268716 |
5 | BEGIN { @files = qw(foo bar baz quux Foo_Bar) } |
6 | END { 1 while unlink @files } |
1673d79e |
7 | |
d9268716 |
8 | use Test::More tests => 2; |
1673d79e |
9 | |
10 | {# Test 3: that we open for append on second viewing |
11 | my @cat; |
12 | for my $path ( @files ){ |
13 | cacheout $path; |
14 | print $path "$path 3\n"; |
15 | } |
16 | for my $path ( @files ){ |
17 | cacheout $path; |
18 | print $path "$path 33\n"; |
19 | } |
20 | for my $path ( @files ){ |
21 | open($path, '<', $path); |
22 | push @cat, do{ local $/; <$path>}; |
23 | close($path); |
24 | } |
d9268716 |
25 | |
26 | ok(scalar(grep/\b3$/m, @cat) == scalar(@files)); |
27 | |
1673d79e |
28 | @cat = (); |
29 | for my $path ( @files ){ |
30 | cacheout $path; |
31 | print $path "$path 333\n"; |
32 | } |
33 | for my $path ( @files ){ |
34 | open($path, '<', $path); |
35 | push @cat, do{ local $/; <$path>}; |
36 | close($path); |
37 | } |
d9268716 |
38 | ok(scalar(grep /\b33$/m, @cat) == scalar(@files)); |
1673d79e |
39 | } |