Fix the bug introduced with MRO, whereby the internals were not saving
[p5sagit/p5-mst-13.2.git] / t / comp / retainedlines.t
CommitLineData
aac018bb 1#!./perl -w
2
3# Check that lines from eval are correctly retained by the debugger
4
5BEGIN {
6 chdir 't' if -d 't';
7 @INC = '../lib';
8 require "./test.pl";
9}
10
11use strict;
12
13plan( tests => 10 );
14
15my @before = grep { /eval/ } keys %::;
16
17is (@before, 0, "No evals");
18
19for my $sep (' ') {
20 $^P = 0xA;
21
22 my $prog = "sub foo {
23 'Perl${sep}Rules'
24};
251;
26";
27
28 eval $prog or die;
29 # Is there a more efficient way to write this?
30 my @expect_lines = (undef, map ({"$_\n"} split "\n", $prog), "\n", ';');
31
32 my @keys = grep { /eval/ } keys %::;
33
34 is (@keys, 1, "1 eval");
35
36 my @got_lines = @{$::{$keys[0]}};
37
38 is (@got_lines, @expect_lines, "Right number of lines for " . ord $sep);
39
40 for (0..$#expect_lines) {
41 is ($got_lines[$_], $expect_lines[$_], "Line $_ is correct");
42 }
43}