for beter make distclean (was Re: [PATCH] Re: [ID 20020305.026] Not OK: perl v5.7...
[p5sagit/p5-mst-13.2.git] / lib / Memoize / t / flush.t
CommitLineData
a0cb3900 1#!/usr/bin/perl
2
5317c87c 3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
a0cb3900 7use Memoize 'flush_cache', 'memoize';
8print "1..8\n";
9print "ok 1\n";
10
11
12
13my $V = 100;
14sub VAL { $V }
15
16memoize 'VAL';
17print "ok 2\n";
18
19my $c1 = VAL();
20print (($c1 == 100) ? "ok 3\n" : "not ok 3\n");
21
22$V = 200;
23$c1 = VAL();
24print (($c1 == 100) ? "ok 4\n" : "not ok 4\n");
25
26flush_cache('VAL');
27$c1 = VAL();
28print (($c1 == 200) ? "ok 5\n" : "not ok 5\n");
29
30$V = 300;
31$c1 = VAL();
32print (($c1 == 200) ? "ok 6\n" : "not ok 6\n");
33
34flush_cache(\&VAL);
35$c1 = VAL();
36print (($c1 == 300) ? "ok 7\n" : "not ok 7\n");
37
38$V = 400;
39$c1 = VAL();
40print (($c1 == 300) ? "ok 8\n" : "not ok 8\n");
41
42
43
44
45