From 01c3a48515f35a9a4fccaee79fafa1c4d6165b08 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sun, 24 Oct 2010 14:07:26 +0200 Subject: [PATCH] Tests for B::cchar(). --- ext/B/t/b.t | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ext/B/t/b.t b/ext/B/t/b.t index a9fdbd6..b32ce31 100644 --- a/ext/B/t/b.t +++ b/ext/B/t/b.t @@ -183,6 +183,16 @@ like(B::hash("wibble"), qr/0x[0-9a-f]*/, "Testing B::hash()"); is(B::perlstring($test), $expect, "B::perlstring($expect) (Unicode)"); } } +{ + my @tests = (map {eval(qq{"$_"}), $_} '\\n', '\\r', '\\t', + '\\b', '\\a', '\\f', '\\000', '\\\'', '?'), '"', '"', + ord 'N' == 78 ? (chr 11, q{'\013"'}, "\177", "'\\177'") : (); + + while (my ($test, $expect) = splice @tests, 0, 2) { + is(B::cchar($test), "'${expect}'", "B::cchar(qq{$expect})"); + } +} + is(B::class(bless {}, "Wibble::Bibble"), "Bibble", "Testing B::class()"); is(B::cast_I32(3.14), 3, "Testing B::cast_I32()"); is(B::opnumber("chop"), 38, "Testing opnumber with opname (chop)"); -- 2.7.4