Skip to content

Commit

Permalink
Passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Jan 6, 2017
1 parent 3e2f2e5 commit df1181a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/TestML/Compiler/Lite.pm
Expand Up @@ -186,9 +186,9 @@ sub compile_data {
die "Failed to parse TestML string:\n$string_block";
}
$block->{points} ||= {};
$value =~ s/(\r?\n)\s*\z//;
my $eol = ($value =~ s/(\r?\n)\s*\z//) ? $1 : '';
if (length $value) {
$value .= $1;
$value .= $eol;
}
$block->{points}{$key} = $value;

Expand Down
9 changes: 6 additions & 3 deletions lib/TestML/Compiler/Pegex/AST.pm
Expand Up @@ -192,9 +192,12 @@ sub got_data_block {

sub got_block_point {
my ($self, $point) = @_;
return {
$point->[0] => $point->[1],
};
my ($name, $value) = @$point;
my $eol = ($value =~ s/(\r?\n)\s*\z//) ? $1 : '';
if (length $value) {
$value .= $eol;
}
return { $name => $value };
}

1;
2 changes: 0 additions & 2 deletions test/ast/basic.tml
Expand Up @@ -73,8 +73,6 @@ data:

Don''t spray it.



'
lower: 'say it,

Expand Down

0 comments on commit df1181a

Please sign in to comment.