This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate Memoize 0.64. Few tweaks were required in
[perl5.git] / lib / Memoize / t / errors.t
CommitLineData
a0cb3900
JH
1#!/usr/bin/perl
2
3use lib '..';
4use Memoize;
5use Config;
6
7print "1..11\n";
8
9eval { memoize({}) };
10print $@ ? "ok 1\n" : "not ok 1 # $@\n";
11
12eval { memoize([]) };
13print $@ ? "ok 2\n" : "not ok 2 # $@\n";
14
15eval { my $x; memoize(\$x) };
16print $@ ? "ok 3\n" : "not ok 3 # $@\n";
17
18# 4--8
19$n = 4;
20for $mod (qw(DB_File GDBM_File SDBM_File ODBM_File NDBM_File)) {
21 eval { memoize(sub {}, LIST_CACHE => ['TIE', $mod]) };
22 print $@ ? "ok $n\n" : "not ok $n # $@\n";
23 $n++;
24}
25
26# 9
27eval { memoize(sub {}, LIST_CACHE => ['TIE', WuggaWugga]) };
28print $@ ? "ok 9\n" : "not ok 9 # $@\n";
29
30# 10
31eval { memoize(sub {}, LIST_CACHE => 'YOB GORGLE') };
32print $@ ? "ok 10\n" : "not ok 10 # $@\n";
33
34# 11
35eval { memoize(sub {}, SCALAR_CACHE => ['YOB GORGLE']) };
36print $@ ? "ok 11\n" : "not ok 11 # $@\n";
37