avoid temp file littering in tests
[p5sagit/p5-mst-13.2.git] / lib / Memoize / t / array_confusion.t
1 #!/usr/bin/perl
2
3 use lib '..';
4 use Memoize 'memoize', 'unmemoize';
5
6 sub reff {
7   return [1,2,3];
8
9 }
10
11 sub listf {
12   return (1,2,3);
13 }
14
15 print "1..6\n";
16
17 memoize 'reff', LIST_CACHE => 'MERGE';
18 print "ok 1\n";
19 memoize 'listf';
20 print "ok 2\n";
21
22 $s = reff();
23 @a = reff();
24 print @a == 1 ? "ok 3\n" : "not ok 3\n";
25
26 $s = listf();
27 @a = listf();
28 print @a == 3 ? "ok 4\n" : "not ok 4\n";
29
30 unmemoize 'reff';
31 memoize 'reff', LIST_CACHE => 'MERGE';
32 unmemoize 'listf';
33 memoize 'listf';
34
35 @a = reff();
36 $s = reff();
37 print @a == 1 ? "ok 5\n" : "not ok 5\n";
38
39 @a = listf();
40 $s = listf();
41 print @a == 3 ? "ok 6\n" : "not ok 6\n";
42
43