summaryrefslogtreecommitdiff
path: root/lib/Memoize/t/errors.t
blob: 4c74954855065ad09132fea38d6a209afc04daba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl

use lib '..';
use Memoize;
use Config;

print "1..11\n";

eval { memoize({}) };
print $@ ? "ok 1\n" : "not ok 1 # $@\n";

eval { memoize([]) };
print $@ ? "ok 2\n" : "not ok 2 # $@\n";

eval { my $x; memoize(\$x) };
print $@ ? "ok 3\n" : "not ok 3 # $@\n";

# 4--8
$n = 4;
for $mod (qw(DB_File GDBM_File SDBM_File ODBM_File NDBM_File)) {
  eval { memoize(sub {}, LIST_CACHE => ['TIE', $mod]) };
  print $@ ? "ok $n\n" : "not ok $n # $@\n";
  $n++;
}

# 9
eval { memoize(sub {}, LIST_CACHE => ['TIE', WuggaWugga]) };
print $@ ? "ok 9\n" : "not ok 9 # $@\n";

# 10
eval { memoize(sub {}, LIST_CACHE => 'YOB GORGLE') };
print $@ ? "ok 10\n" : "not ok 10 # $@\n";

# 11
eval { memoize(sub {}, SCALAR_CACHE => ['YOB GORGLE']) };
print $@ ? "ok 11\n" : "not ok 11 # $@\n";