xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/ext/B/t/concise.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateBEGIN {
4*0Sstevel@tonic-gate    chdir 't';
5*0Sstevel@tonic-gate    @INC = '../lib';
6*0Sstevel@tonic-gate    require './test.pl';
7*0Sstevel@tonic-gate}
8*0Sstevel@tonic-gate
9*0Sstevel@tonic-gateplan tests => 5;
10*0Sstevel@tonic-gate
11*0Sstevel@tonic-gaterequire_ok("B::Concise");
12*0Sstevel@tonic-gate
13*0Sstevel@tonic-gate$out = runperl(switches => ["-MO=Concise"], prog => '$a', stderr => 1);
14*0Sstevel@tonic-gate
15*0Sstevel@tonic-gate# If either of the next two tests fail, it probably means you need to
16*0Sstevel@tonic-gate# fix the section labeled 'fragile kludge' in Concise.pm
17*0Sstevel@tonic-gate
18*0Sstevel@tonic-gate($op_base) = ($out =~ /^(\d+)\s*<0>\s*enter/m);
19*0Sstevel@tonic-gate
20*0Sstevel@tonic-gateis($op_base, 1, "Smallest OP sequence number");
21*0Sstevel@tonic-gate
22*0Sstevel@tonic-gate($op_base_p1, $cop_base)
23*0Sstevel@tonic-gate  = ($out =~ /^(\d+)\s*<;>\s*nextstate\(main (-?\d+) /m);
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gateis($op_base_p1, 2, "Second-smallest OP sequence number");
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gateis($cop_base, 1, "Smallest COP sequence number");
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gate# test that with -exec B::Concise navigates past logops (bug #18175)
30*0Sstevel@tonic-gate
31*0Sstevel@tonic-gate$out = runperl(
32*0Sstevel@tonic-gate    switches => ["-MO=Concise,-exec"],
33*0Sstevel@tonic-gate    prog => q{$a||=$b && print q/foo/},
34*0Sstevel@tonic-gate    stderr => 1,
35*0Sstevel@tonic-gate);
36*0Sstevel@tonic-gate
37*0Sstevel@tonic-gatelike($out, qr/print/, "-exec option with ||=");
38