Re: Patches: B, CGI, ExtUtils::MM_Unix
Joshua ben Jore [Mon, 20 Feb 2006 09:50:15 +0000 (03:50 -0600)]
From: "Joshua ben Jore" <twists@gmail.com>
Message-ID: <dc5c751d0602200750j21447031m86ea670b04ac27ed@mail.gmail.com>

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

ext/B/B.pm
ext/B/B.xs
ext/B/t/b.t
ext/B/t/concise-xs.t

index 5b6c04e..f157e78 100644 (file)
@@ -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
index bfccf7d..23034c1 100644 (file)
@@ -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()
 
index 12e9092..95a5059 100755 (executable)
@@ -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" );
+}
index fa0e7df..dcd868f 100644 (file)
@@ -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
                  )],
     },