Skip Menu |

This queue is for tickets about the Test-Output CPAN distribution.

Report information
The Basics
Id: 12344
Status: rejected
Priority: 0/
Queue: Test-Output

People
Owner: Nobody in particular
Requestors: Bernhard.Schmalhofer [...] biomax.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.07
Fixed in: (no value)



Subject: Testing anonymout subs?
Hi, I have been trying to test anonymous subs: use Test::More tests => 1; use Test::Output; # Use anonymous subs. my $writer = sub { print 'STDOUT', ' '; print STDERR 'STDERR' }; combined_is( $writer, 'STDOUT STDERR', 'Test combined output' ); Under "This is perl, v5.8.4 built for i386-linux-thread-multi" I get: Show quoted text
> Type of arg 1 to Test::Output::combined_is must be block or sub {} > (not private variable) at test_output.t line 9, near "'Test combined output' )"
This is quite understandable from the the function prototype, however I would be nice if one wouldn't have to worry about that. CU, Bernhard
I'd like to support that syntax too, but without the prototype you can't have the block syntax. We're going to have to stick with the original design unfortunately. Although it's little consolation, if you have a coderef already, you just have to dereference it yourself. Annoying, but that's life. :( stdout_is { $writer->() }, ...;