6 use Test::Requires 'Test::Output';
10 # XXX this whole test isn't very useful anymore, since we no longer do
11 # memoization. it would be nice to bring it back at some point though, if there
12 # was a way to do this without breaking the other tests
14 plan skip_all => "disabling this test for now";
17 my $source = 'BEGIN { warn "foo\n" } sub { $foo * 2 }';
28 } "foo\n", "BEGIN was run";
30 is($code->(), 30, "got the right sub");
35 $code2 = eval_closure(
41 } '', "BEGIN was not run twice";
43 is($code2->(), 16, "got the right sub");
47 my $source = 'BEGIN { warn "bar\n" } sub { $bar * 2 }';
59 } "bar\n", "BEGIN was run";
61 is($code->(), 120, "got the right sub");
65 { local $TODO = "description breaks memoization";
67 $code2 = eval_closure(
74 } '', "BEGIN was not run twice";
77 is($code2->(), 46, "got the right sub");
81 my $source = 'BEGIN { warn "baz\n" } sub { Carp::confess "baz" }';
87 description => 'first',
89 } "baz\n", "BEGIN was run";
91 like(exception { $code->() }, qr/baz at first line 1/,
92 "got the right description");
95 { local $TODO = "description breaks memoization";
97 $code2 = eval_closure(
99 description => 'second',
101 } '', "BEGIN was not run twice";
104 like(exception { $code2->() }, qr/baz at second line 1/,
105 "got the right description");