VMS specific cleanup and strictness for tie_sdbm.t
[p5sagit/p5-mst-13.2.git] / lib / Memoize / t / prototype.t
1 #!/usr/bin/perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6 }
7 #use lib '..';
8 use Memoize;
9 $EXPECTED_WARNING = '(no warning expected)';
10
11
12 print "1..4\n";
13
14 sub q1 ($) { $_[0] + 1 }
15 sub q2 ()  { time }
16 sub q3     { join "--", @_ }
17
18 $SIG{__WARN__} = \&handle_warnings;
19
20 $RES = 'ok';
21 memoize 'q1';
22 print "$RES 1\n";
23
24 $RES = 'ok';
25 memoize 'q2';
26 print "$RES 2\n";
27
28 $RES = 'ok';
29 memoize 'q3';
30 print "$RES 3\n";
31
32 # Let's see if the prototype is actually honored
33 @q = (1..5);
34 $r = q1(@q); 
35 print (($r == 6) ? '' : 'not ', "ok 4\n");
36
37 sub handle_warnings {
38   print $_[0];
39   $RES = 'not ok' unless $_[0] eq $EXPECTED_WARNING;
40 }