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