From: Jarkko Hietaniemi Date: Thu, 26 Apr 2001 23:48:10 +0000 (+0000) Subject: Deparse nits. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f99a63a2847c6b782592a184fb425a1f34215fb8;p=p5sagit%2Fp5-mst-13.2.git Deparse nits. p4raw-id: //depot/perl@9875 --- diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 03e5e6c..a982575 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -953,9 +953,9 @@ sub lineseq { } $expr .= $self->deparse($ops[$i], 0); $expr =~ s/;\n?\z//; - push @exprs, $expr if length $expr; + push @exprs, $expr; } - return join(";\n", @exprs); + return join(";\n", grep {length} @exprs); } sub scopeop { diff --git a/t/lib/b-deparse.t b/t/lib/b-deparse.t index b321213..e0d3546 100644 --- a/t/lib/b-deparse.t +++ b/t/lib/b-deparse.t @@ -113,7 +113,7 @@ LINE: while (defined($_ = )) { } EOF -print "# [$a]\n\# vs\n# [$b]\nnot " if $a ne $b; +print "# [$a]\n\# vs expected\n# [$b]\nnot " if $a ne $b; ok; @@ -124,6 +124,9 @@ my $foo = $deparse->coderef2text(sub { { 234; }}); print "not " unless $foo =~ /{.*{.*234;.*}.*}/sm; ok; $foo = $deparse->coderef2text(sub { { 234; } continue { 123; } }); -print "not " unless $foo =~ /{.*{.*234;.*}.*continue.*{.*123.*}/sm; +unless ($foo =~ /{\s*{\s*234\s*}\s*continue\s*{\s*123;\s*}/sm) { + print "# [$foo]\n\# vs expected\n# [sub { { 234 } continue { 123; } }]\n"; + print "not "; +} ok; }