From: Joshua ben Jore Date: Mon, 20 Feb 2006 09:50:15 +0000 (-0600) Subject: Re: Patches: B, CGI, ExtUtils::MM_Unix X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5ce57cc063e43c30cba8f7b560bf201c2c4beb83;p=p5sagit%2Fp5-mst-13.2.git Re: Patches: B, CGI, ExtUtils::MM_Unix From: "Joshua ben Jore" Message-ID: Includes changes to increment test count in ext/B/t/concise-xs.t and uses "no warnings 'once';" in ext/B/t/b.t rather than kludging to avoid the warning. p4raw-id: //depot/perl@27254 --- diff --git a/ext/B/B.pm b/ext/B/B.pm index 5b6c04e..f157e78 100644 --- a/ext/B/B.pm +++ b/ext/B/B.pm @@ -18,7 +18,7 @@ require Exporter; @EXPORT_OK = qw(minus_c ppname save_BEGINs class peekop cast_I32 cstring cchar hash threadsv_names main_root main_start main_cv svref_2object opnumber - amagic_generation perlstring + sub_generation amagic_generation perlstring walkoptree_slow walkoptree walkoptree_exec walksymtable parents comppadlist sv_undef compile_stats timing_info begin_av init_av check_av end_av regex_padav dowarn @@ -935,9 +935,9 @@ underlying C "inheritance": B::OP | - +---------------+--------+--------+ - | | | | - B::UNOP B::SVOP B::PADOP B::COP + +---------------+--------+--------+-------+ + | | | | | + B::UNOP B::SVOP B::PADOP B::COP B::PVOP ,' `-. / `--. B::BINOP B::LOGOP diff --git a/ext/B/B.xs b/ext/B/B.xs index bfccf7d..23034c1 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -528,6 +528,7 @@ BOOT: #define B_main_root() PL_main_root #define B_main_start() PL_main_start #define B_amagic_generation() PL_amagic_generation +#define B_sub_generation() PL_sub_generation #define B_defstash() PL_defstash #define B_curstash() PL_curstash #define B_dowarn() PL_dowarn @@ -574,6 +575,9 @@ B_main_start() long B_amagic_generation() +long +B_sub_generation() + B::AV B_comppadlist() diff --git a/ext/B/t/b.t b/ext/B/t/b.t index 12e9092..95a5059 100755 --- a/ext/B/t/b.t +++ b/ext/B/t/b.t @@ -22,7 +22,7 @@ BEGIN { $| = 1; use warnings; use strict; -use Test::More tests => 55; +use Test::More tests => 57; BEGIN { use_ok( 'B' ); } @@ -164,4 +164,22 @@ is(B::cstring("wibble"), '"wibble"', "Testing B::cstring()"); is(B::perlstring("wibble"), '"wibble"', "Testing B::perlstring()"); is(B::class(bless {}, "Wibble::Bibble"), "Bibble", "Testing B::class()"); is(B::cast_I32(3.14), 3, "Testing B::cast_I32()"); -is(B::opnumber("localtime"), 294); +is(B::opnumber("localtime"), 294, "Testing opnumber with opname (localtime)"); + +{ + no warnings 'once'; + my $sg = B::sub_generation(); + *Whatever::hand_waving = sub { }; + ok( $sg < B::sub_generation, "sub_generation increments" ); +} + +{ + my $ag = B::amagic_generation(); + { + + package Whatever; + require overload; + overload->import( '""' => sub {"What? You want more?!"} ); + } + ok( $ag < B::amagic_generation, "amagic_generation increments" ); +} diff --git a/ext/B/t/concise-xs.t b/ext/B/t/concise-xs.t index fa0e7df..dcd868f 100644 --- a/ext/B/t/concise-xs.t +++ b/ext/B/t/concise-xs.t @@ -117,7 +117,7 @@ use Getopt::Std; use Carp; use Test::More tests => ( # per-pkg tests (function ct + require_ok) 40 + 16 # Data::Dumper, Digest::MD5 - + 511 + 233 # B::Deparse, B + + 511 + 234 # B::Deparse, B + 588 + 189 # POSIX, IO::Socket + 3 * ($] > 5.009) + 14 * ($] >= 5.009003) @@ -156,7 +156,7 @@ my $testpkgs = { main_start main_root main_cv init_av inc_gv hash formfeed end_av dowarn diehook defstash curstash cstring comppadlist check_av cchar cast_I32 bootstrap - begin_av amagic_generation address + begin_av amagic_generation sub_generation address )], },