Skip to content

Commit

Permalink
more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
renormalist committed Jun 1, 2012
1 parent 467f4ec commit 315e4a8
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 11 deletions.
56 changes: 54 additions & 2 deletions lib/Test/TAPv13.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use strict;
use warnings;
package Test::TAPv13;
# ABSTRACT: provide TAPv13 support to test scripts
# ABSTRACT: provide TAP v13 support to test scripts

use Test::Builder;
use TAP::Parser::YAMLish::Writer;
Expand All @@ -12,7 +12,7 @@ my $OUT;
BEGIN {
$Test = Test::Builder->new;
$OUT = $Test->output;
print $OUT "TAP Version 13\n";
print $OUT "TAP version 13\n";
}

sub import {
Expand Down Expand Up @@ -44,3 +44,55 @@ sub tap13_yaml {
}

1;

__END__
=head1 ABOUT
This module is to utilize TAP version 13 features in your test
scripts.
TAP, the L<Test Anything Protocol|http://testanything.org/>, allows
some new elements beginning with L<version
13|http://testanything.org/wiki/index.php/TAP_version_13_specification>. The
most prominent one is to embed data as indented L<YAML
blocks|http://testanything.org/wiki/index.php/YAMLish>.
This module automatically declares C<TAP version 13> first in the TAP
stream which is needed to tell the TAP::Parser to actually parse those
new features. With some utility functions you can then actually
include data, etc.
=head1 SYNOPSIS
use Test::TAPv13; # must come before Test::More
use Test::More tests => 2;
my $data = { affe => { one => 111,
birne => "amazing",
kram => [ qw( one two three) ],
},
zomtec => "here's another one",
};
ok(1, "hot stuff");
tap13_pragma "0xAFFE";
tap13_yaml($data);
ok(1, "more hot stuff");
This would create TAP like this:
TAP version 13
1..2
ok 1 - hot stuff
---
affe:
birne: amazing
kram:
- one
- two
- three
one: 111
zomtec: "here's another one"
...
ok 2 - more hot stuff
20 changes: 11 additions & 9 deletions t/tap13.t
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#! /usr/bin/perl

use Test::More 0.88;
use Test::TAPv13;
use Test::TAPv13; # must come before Test::More
use Test::More tests => 2;

my $data = { affe => { one => 111,
birne => "amazing",
kram => [ qw( one two three) ],
},
zomtec => "here's another one",
};

ok(1, "hot stuff");
tap13_pragma "0xAFFE";
tap13_yaml( { affe => { one => 111,
birne => "amazing",
kram => [ qw( one two three) ],
},
zomtec => "here's another one",
});
done_testing;
tap13_yaml($data);
ok(1, "more hot stuff");

0 comments on commit 315e4a8

Please sign in to comment.