Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.84k stars 524 forks source link

[PATCH] t/lib/b.t #1734

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#2985 (status was 'resolved')

Searchable as RT2985$

p5pRT commented 24 years ago

From @simoncozens

This appears not to have properly come through my dodgy Perl sendmail\, so I'm resending it through the even dodgier Lotus Notes. Apologies if the original post hits you later.

Simon

Here are some tests for B​:

#!./perl

BEGIN {   chdir 't' if -d 't';   unshift @​INC\, '../lib'; }

$| = 1; use warnings; use strict;

print "1..10\n";

my $test = 1;

sub ok { print "ok $test\n"; $test++ }

use B​::Deparse; my $deparse = B​::Deparse->new() or print "not "; ok;

print "not " if "{\n 1;\n}" ne $deparse->coderef2text(sub {1}); ok;

print "not " if "{\n '???';\n 2;\n}" ne   $deparse->coderef2text(sub {1;2}); ok;

print "not " if "{\n \$test /= 2 if ++\$test;\n}" ne   $deparse->coderef2text(sub {++$test and $test/=2;}); ok;

my $a = `$^X -I../lib -MO=Deparse -anle 1 2>&1`; $b = \<\<'EOF';

LINE​: while (defined($_ = \)) {   chomp $_;   @​F = split(/\s+/\, $_\, 0);   '???'; }

-e syntax OK EOF print "not " if $a ne $b; ok;

$a = `$^X -I../lib -MO=Debug -e 1 2>&1`; print "not " unless $a =~ /\bLISTOP\b.*\bOP\b.*\bCOP\b.*\bOP\b/s; ok;

$a = `$^X -I../lib -MO=Terse -e 1 2>&1`; print "not " unless $a =~ /\bLISTOP\b.*leave.*\bOP\b.*enter.*\bCOP\b.*nextstate.*\bOP\b.*null/s; ok;

$a = `$^X -I../lib -MO=Terse -ane 's/foo/bar/' 2>&1`; $a =~ s/\(0x[^)]+\)//g; $a =~ s/\[[^\]]+\]//g; $a =~ s/\s+/ /g; $b = 'LISTOP leave OP enter COP nextstate label "LINE" BINOP leaveloop LOOP '.   'enterloop UNOP null LOGOP and UNOP defined UNOP null UNOP null SVOP gvsv'.   ' GV *_ UNOP readline SVOP gv GV *ARGV LISTOP lineseq COP nextstate BINOP'.   ' aassign UNOP null OP pushmark LISTOP split PMOP pushre /\s+/ UNOP null '.   'SVOP gvsv GV *_ SVOP const IV 0 UNOP null OP pushmark UNOP rv2av SVOP '.   'gv GV *F COP nextstate PMOP subst /foo/ SVOP const PV "bar" OP unstack '.   'COP nextstate -e syntax OK '; # my @​a = split //\, $a; my @​b = split //\, $b; # for (0..@​a) { print "ch. $_ : |$a[$_]| vs. |$b[$_]|\n" if $a[$_] ne $b[$_]} print "not " if $a ne $b; ok;

$a = `$^X -I../lib -MB​::Stash -Mwarnings -e1`; $b = '-umain\,-uattributes\,-uDB\,-uCwd\,-uExporter\,-uExporter​::Heavy\,-uwarnings\,'   ."-uCarp\,-uCarp​::Heavy\n"; print "not " if $a ne $b; ok;

$a = `$^X -I../lib -MO=Showlex -e "my %one" 2>&1`; print "not " unless $a =~ /sv_undef.*PVNV.*%one.*sv_undef.*HV/s; ok;


The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review\, retransmission\, dissemination or other use of\, or taking of any action in reliance upon\, this information by persons or entities other than the intended recipient is prohibited. If you received this in error\, please contact the sender and delete the material from any computer.

p5pRT commented 24 years ago

From @gsar

On Mon\, 03 Apr 2000 14​:36​:03 +0900\, simon.p.cozens@​jp.pwcglobal.com wrote​:

This appears not to have properly come through my dodgy Perl sendmail\, so I'm resending it through the even dodgier Lotus Notes. Apologies if the original post hits you later.

Simon

Here are some tests for B​:

This testsuite fails tests 5\, 8 and 9 with the B​::Deparse that's in perl-current. A revised version will be appreciated.

I imagine having a formatting-sensitive testsuite like it is now is going to be maintenance intensive\, though it is certainly better than not having a testsuite at all. :-)

Thanks.

Sarathy gsar@​activestate.com