In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/89c9327b73584fd6fb886b2224d388ab6fa04629?hp=e5351d2f75041bd3be301f77a78e9cb964606504>
- Log ----------------------------------------------------------------- commit 89c9327b73584fd6fb886b2224d388ab6fa04629 Author: Nicholas Clark <n...@ccl4.org> Date: Wed Oct 13 21:04:47 2010 +0100 Add tests for the usage messages for Tie::Hash::NamedCapture::* ----------------------------------------------------------------------- Summary of changes: t/re/reg_nc_tie.t | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/t/re/reg_nc_tie.t b/t/re/reg_nc_tie.t index 17f35bc..b2c49ca 100644 --- a/t/re/reg_nc_tie.t +++ b/t/re/reg_nc_tie.t @@ -8,7 +8,7 @@ BEGIN { # Do a basic test on all the tied methods of Tie::Hash::NamedCapture -plan(tests => 21); +plan(tests => 37); # PL_curpm->paren_names can be a null pointer. See that this succeeds anyway. 'x' =~ /(.)/; @@ -66,3 +66,20 @@ is(Tie::Hash::NamedCapture::EXISTS(undef, undef), undef, 'EXISTS with undef'); is(Tie::Hash::NamedCapture::FIRSTKEY(undef), undef, 'FIRSTKEY with undef'); is(Tie::Hash::NamedCapture::NEXTKEY(undef, undef), undef, 'NEXTKEY with undef'); is(Tie::Hash::NamedCapture::SCALAR(undef), undef, 'SCALAR with undef'); + +my $obj = tied %+; +foreach ([FETCH => '$key'], + [STORE => '$key, $value'], + [DELETE => '$key'], + [CLEAR => ''], + [EXISTS => '$key'], + [FIRSTKEY => ''], + [NEXTKEY => '$lastkey'], + [SCALAR => ''], + ) { + my ($method, $error) = @$_; + + is(eval {$obj->$method(0..3); 1}, undef, "$method with undef"); + like($@, qr/Usage: Tie::Hash::NamedCapture::$method\(\Q$error\E\)/, + "usage method for $method"); +} -- Perl5 Master Repository