Subject: | App::Cmd::Tester 0.312 print vs say |
Date: | Fri, 9 Dec 2011 06:59:30 -0800 |
To: | bug-App-Cmd [...] rt.cpan.org |
From: | zengargoyle <zengargoyle [...] gmail.com> |
This may be in IO::TieCombine, I'm not really sure. I was creating a simple
App::Cmd application starter template and ran across this in testing.
Using Test::Output to capture (like from old App::Cmd presentation slides)
works with print:
sub execute {
print "foo bar\n";
print "baz bat\n";
}
like $stdout, qr/^foo bar$/m;
like $stdout, qr/^baz bat$/m;
and works with say:
use 5.014;
sub execute {
say "foo bar";
say "baz bat";
}
like $stdout, qr/^foo bar$/m;
like $stdout, qr/^baz bat$/m;
But using App::Cmd::Tester fails when using say, the newlines get squashed....
like $result->stdout, qr/^foo bar$/m, "got foo bar";
like $result->stdout, qr/^baz bat$/m, "got baz bat";
but does work when using print....
Attached is a tarball of my reduced as much as possible test app.
hayter@io:~/broken_app$ prove broken_app.t --verbose
broken_app.t ..
ok 1
ok 2
ok 3
ok 4 - got foo bar
ok 5 - got baz bat
ok 6
ok 7
ok 8
not ok 9 - got foo bar
not ok 10 - got baz bat
1..10
# Failed test 'got foo bar'
# at broken_app.t line 42.
# 'foo barbaz bat'
# doesn't match '(?^m:^foo bar$)'
# Failed test 'got baz bat'
# at broken_app.t line 43.
# 'foo barbaz bat'
# doesn't match '(?^m:^baz bat$)'
# Looks like you failed 2 tests of 10.
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/10 subtests
----
zengargoyle
Message body not shown because it is not plain text.