Skip to content

Instantly share code, notes, and snippets.

@ingydotnet
Created July 13, 2010 00:12
Show Gist options
  • Save ingydotnet/473265 to your computer and use it in GitHub Desktop.
Save ingydotnet/473265 to your computer and use it in GitHub Desktop.
> cat test.pl
use TestML::Parser;
use YAML;
my $testml = '
# A comment
%TestML: 1.0 #A line comment
%Plan: 2
%Title: O HAI TEST
*input.uppercase() == *output;
=== Test mixed case string
--- input: I Like Pie
--- output: I LIKE PIE
=== Test lower case string
--- input: i love lucy
--- output: I LOVE LUCY
';
my $match = TestML::Parser.parse($testml);
say YAML::dump($match);
> perl6 test.pl
--- !TestML::Document
$.data: !TestML::Document::Data
$.blocks:
- !TestML::Block
$.label: Test mixed case string
$.points:
input: I Like Pie
output: I LIKE PIE
- !TestML::Block
$.label: Test lower case string
$.points:
input: i love lucy
output: I LOVE LUCY
$.meta: !TestML::Document::Meta
$.data:
BlockMarker: ===
Data: []
Plan: 2
PointMarker: ---
TestML: 1.0
Title: O HAI TEST
$.test: !TestML::Document::Tests
$.statements:
- !TestML::Statement
$.assertion: !TestML::Assertion
$.expression: !TestML::Expression
$.transforms:
- !TestML::Transform
$.args:
- output
$.name: Point
$.name: EQ
$.expression: !TestML::Expression
$.transforms:
- !TestML::Transform
$.args:
- input
$.name: Point
- !TestML::Transform
$.args: []
$.name: uppercase
$.points:
- input
- output
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment