diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-10-24 16:05:55 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-10-24 16:05:55 +0200 |
commit | b45732d66ea1319bd17a11a2b11dc0e1942d0cef (patch) | |
tree | 9866b59e4adae2081712b2db4f274cc04714095b | |
parent | 9e380ad423cc802b5d0aaef3b223a4f53b62b307 (diff) | |
download | perl-b45732d66ea1319bd17a11a2b11dc0e1942d0cef.tar.gz |
More tests for B::hash().
-rw-r--r-- | ext/B/t/b.t | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/B/t/b.t b/ext/B/t/b.t index b32ce317b2..19694a08d2 100644 --- a/ext/B/t/b.t +++ b/ext/B/t/b.t @@ -156,7 +156,14 @@ is(ref B::sv_undef(), "B::SPECIAL", "B::sv_undef()"); is(B::ppname(0), "pp_null", "Testing ppname (this might break if opnames.h is changed)"); is(B::opnumber("null"), 0, "Testing opnumber with opname (null)"); is(B::opnumber("pp_null"), 0, "Testing opnumber with opname (pp_null)"); -like(B::hash("wibble"), qr/0x[0-9a-f]*/, "Testing B::hash()"); +{ + my $hash = B::hash("wibble"); + like($hash, qr/\A0x[0-9a-f]+\z/, "Testing B::hash(\"wibble\")"); + unlike($hash, qr/\A0x0+\z/, "Testing B::hash(\"wibble\")"); + + like(B::hash("\0" x $_), qr/\A0x0+\z/, "Testing B::hash(\"0\" x $_)") + for 0..19; +} { is(B::cstring(undef), '0', "Testing B::cstring(undef)"); is(B::perlstring(undef), '0', "Testing B::perlstring(undef)"); |