On Fri Nov 30 20:58:17 2012, RJBS wrote:
Show quoted text>
> After a compact scalar document ("--- foo\n") YAML::Tiny seems to
> reset immediately to be
> ready for a new document, which is not to spec. A new document
> indicator is required.
>
> Here is a simple test case:
>
> use strict;
> use YAML::Tiny;
> use Test::More tests => 2;
>
> my $bad_str = <<'EOY';
> --- foo
> a: 1
> EOY
>
> my $ok_str = <<'EOY';
> --- foo
> ---
> a: 1
> EOY
>
> my $y = YAML::Tiny->read_string($bad_str);
> is_deeply(
> $y,
> undef,
> "invalid YAML: tried to append mapping after scalar",
> ) or diag explain($y);
>
> is_deeply(
> YAML::Tiny->read_string($bad_str),
> [ 'foo', { a => 1 } ],
> "valid YAML: two documents with markers",
> );
Output from above tests:
#########
$ prove -v 81859-run-together.t
81859-run-together.t ..
1..2
not ok 1 - invalid YAML: tried to append mapping after scalar
# Failed test 'invalid YAML: tried to append mapping after scalar'
# at 81859-run-together.t line 20.
# Structures begin differing at:
# $got = YAML::Tiny=ARRAY(0x1802770)
# $expected = undef
ok 2 - valid YAML: two documents with markers
# bless( [
# 'foo',
# {
# 'a' => '1'
# }
# ], 'YAML::Tiny' )
# Looks like you failed 1 test of 2.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
Test Summary Report
-------------------
81859-run-together.t (Wstat: 256 Tests: 2 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=1, Tests=2, 1 wallclock secs ( 0.13 usr 0.03 sys + 0.16 cusr 0.05 csys = 0.37 CPU)
Result: FAIL
##########