Skip to content

Commit

Permalink
get rid of outputs-during-parse
Browse files Browse the repository at this point in the history
We have `outputs` now, which covers this case much better.
  • Loading branch information
Carl Masak committed Oct 18, 2015
1 parent c423636 commit c730955
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
9 changes: 0 additions & 9 deletions lib/_007/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,6 @@ sub parse-error($program, $expected-error, $desc = $expected-error.^name) is exp
flunk $desc;
}

sub outputs-during-parse($program, $expected, $desc = "MISSING TEST DESCRIPTION") is export {
my $parser = _007.parser;
my $output = Output.new;
my $runtime = _007.runtime(:$output);
$parser.parse($program, :$runtime);

is $output.result, $expected, $desc;
}

sub outputs($program, $expected, $desc = "MISSING TEST DESCRIPTION") is export {
my $parser = _007.parser;
my $output = Output.new;
Expand Down
14 changes: 9 additions & 5 deletions t/features/begin.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,32 @@ use _007::Test;

{
my $program = q:to/./;
say("Why, the early bird gets the villain.");
BEGIN {
say("So early, Mr. Bond");
}
.

outputs-during-parse
outputs
$program,
"So early, Mr. Bond\n",
"So early, Mr. Bond\nWhy, the early bird gets the villain.\n",
"BEGIN blocks execute during parse";
}

{
my $program = q:to/./;
my r = 7;
say(r);
BEGIN {
say(r);
}
.

outputs-during-parse
outputs
$program,
"None\n",
"None\n7\n",
"variables are declared already at parse time (but not assigned)";
}

Expand All @@ -53,7 +57,7 @@ use _007::Test;
}
.

outputs-during-parse
outputs
$program,
"None\n",
"BEGIN blocks are scoped just like everything else";
Expand Down

0 comments on commit c730955

Please sign in to comment.