This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fixup new hash benchmarks to be lighter
[perl5.git] / t / comp / line_debug.t
1 #!./perl
2
3 BEGIN { unshift @INC, '.' }
4
5 chdir 't' if -d 't';
6
7 sub ok {
8     my($test,$ok) = @_;
9     print "not " unless $ok;
10     print "ok $test\n";
11     $ok;
12 }
13
14 # The auxiliary file contains a bunch of code that systematically exercises
15 # every place that can call lex_next_chunk() (except for the one that's not
16 # used by the main Perl parser).
17 open AUX, "<", "comp/line_debug_0.aux" or die $!;
18 my @lines = <AUX>;
19 close AUX;
20 my $nlines = @lines;
21
22 print "1..", 2+$nlines, "\n";
23
24 $^P = 0x2;
25 do "comp/line_debug_0.aux";
26
27 ok 1, scalar(@{"_<comp/line_debug_0.aux"}) == 1+$nlines;
28 ok 2, !defined(${"_<comp/line_debug_0.aux"}[0]);
29
30 for(1..$nlines) {
31     if (!ok 2+$_, ${"_<comp/line_debug_0.aux"}[$_] eq $lines[$_-1]) {
32         print "# Got: ", ${"_<comp/line_debug_0.aux"}[$_]//"undef\n";
33         print "# Expected: $lines[$_-1]";
34     }
35 }
36
37 1;