Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Commit

Permalink
[v6.pm] more tests
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@21650 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
fglock committed Jul 31, 2008
1 parent c3952aa commit ca830ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Pugs-Compiler-Perl6/MANIFEST
Expand Up @@ -163,6 +163,7 @@ t/regex/rx_perl5_escape.t
t/regex/smartparse.t
t/spec/S02-builtin_data_types/array_extending.t
t/spec/S02-builtin_data_types/nested_arrays.t
t/spec/S04-statements/do.t
t/spec/S04-statements/until.t
t/spec/S10-packages/import.t
t/spec/S12-class/inheritance-class-methods.t
Expand Down
5 changes: 5 additions & 0 deletions Pugs-Compiler-Perl6/Makefile.PL
Expand Up @@ -142,6 +142,11 @@ $rewrite_test = sub {
$text =~ s/^\s*plan \d+;/plan 84;/m;
$text =~ s/^\s*force_todo.*?\n/force_todo(18,34,40,51,57,66,67);\n/m;
}
if ( $out eq 't/spec/S04-statements/do.t' ) {
$text = "force_todo(1..8,10..16,20..23);\n" . $text;
# redo works in perl5 blocks
$text =~ s/^([^\n]*?\; *redo\;)/ok( 0, "redo works in perl5 blocks", :todo ) ; # $1/mg;
}

# add "use Test" to most files
if ( $out ne 't/01-sanity/05-sub.t' ) {
Expand Down
11 changes: 10 additions & 1 deletion Pugs-Compiler-Perl6/lib/Pugs/Emitter/Perl6/Perl5.pm
Expand Up @@ -835,6 +835,15 @@ sub default {
# TODO - other builtins
my $subname = $n->{sub}{bareword};
if ( $subname ) {
if ($subname eq 'next') {
my $param = $n->{param} ? _emit( $n->{param} ) : '';
return " next $param ";
}
if ($subname eq 'redo') {
my $param = $n->{param} ? _emit( $n->{param} ) : '';
return " redo $param ";
}

if ($subname eq 'defined') {
my $param = _emit( $n->{param} );
# when testing defined-ness of $!, it is testing the emptiness of $@ in perl5.
Expand Down Expand Up @@ -1116,7 +1125,7 @@ sub statement {
}

if ( $n->{statement} eq 'do' ) {
return 'do ' . emit_block( $n->{exp1} );
return 'do { for($_) ' . emit_block( $n->{exp1} ) . ' }';
}
if ( $n->{statement} eq 'given' ) {
return 'for (1) { local $_ = ' . _emit( $n->{exp1} ) . '; ' .
Expand Down

0 comments on commit ca830ef

Please sign in to comment.