diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-10-13 21:04:47 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-10-13 21:04:47 +0100 |
commit | 89c9327b73584fd6fb886b2224d388ab6fa04629 (patch) | |
tree | d498d219a30d3ae8ea215851c8a74be12e0cc7e8 /t | |
parent | e5351d2f75041bd3be301f77a78e9cb964606504 (diff) | |
download | perl-89c9327b73584fd6fb886b2224d388ab6fa04629.tar.gz |
Add tests for the usage messages for Tie::Hash::NamedCapture::*
Diffstat (limited to 't')
-rw-r--r-- | 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 17f35bc112..b2c49ca7a8 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"); +} |