Skip to content

Commit

Permalink
Make tests work with matrix.yaml.io
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Oct 3, 2021
1 parent 7a5c87e commit 1c12840
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 21 deletions.
1 change: 0 additions & 1 deletion coffeescript/lib/test-receiver.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ global.TestReceiver = class TestReceiver extends Receiver
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\x20$/g, '<SPC>')
event.push "#{style}#{value}"
event.join(' ') + "\n"
list.join ''
Expand Down
8 changes: 4 additions & 4 deletions coffeescript/test/testml-bridge.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class TestMLBridge extends TestML.Bridge
else
parser.receiver.output()

unescape: (yaml)->
yaml.replace(/<SPC>/g, ' ')
unescape: (text)->
text.replace(/<SPC>/g, ' ')
.replace(/<TAB>/g, "\t")

fix1: (events)->
return events
fix_test_output: (text)->
return text
.replace(/^\+MAP\ \{\}/gm, '+MAP')
.replace(/^\+SEQ\ \[\]/gm, '+SEQ')
2 changes: 1 addition & 1 deletion javascript/lib/test-receiver.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions javascript/test/testml-bridge.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion perl/lib/TestReceiver.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ sub output {
$value =~ s/\t/\\t/g;
$value =~ s/\n/\\n/g;
$value =~ s/\r/\\r/g;
$value =~ s/\x20\z/<SPC>/;
push @event, "$style$value";
}
join(' ', @event) . "\n";
Expand Down
18 changes: 9 additions & 9 deletions perl/test/TestMLBridge.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ sub parse {
}

sub unescape {
my ($self, $yaml) = @_;
$yaml =~ s/<SPC>/ /g;
$yaml =~ s/<TAB>/\t/g;
return $yaml;
my ($self, $text) = @_;
$text =~ s/<SPC>/ /g;
$text =~ s/<TAB>/\t/g;
return $text;
}

sub fix1 {
my ($self, $events) = @_;
$events =~ s/^\+MAP\ \{\}/+MAP/gm;
$events =~ s/^\+SEQ\ \[\]/+SEQ/gm;
return $events;
sub fix_test_output {
my ($self, $text) = @_;
$text =~ s/^\+MAP\ \{\}/+MAP/gm;
$text =~ s/^\+SEQ\ \[\]/+SEQ/gm;
return $text;
}

1;
2 changes: 1 addition & 1 deletion test/parse-suite.tml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


"({*Name}) {*Label} -- '{*in-yaml}'":
*in-yaml.unescape.parse.fix1 == *test-event
*in-yaml.unescape.parse.fix-test-output == *test-event.unescape


%Import 229Q # Spec Example 2.4. Sequence of Mappings
Expand Down

0 comments on commit 1c12840

Please sign in to comment.