Perl

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Change 26206: Additional tests for B and POSIX. The POSIX ones concern me a bit,

    0 answers - 4552 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Change 26206 by stevep@stevep-mccoy on 2005/11/26 01:31:24
    Additional tests for B and PSIX. The PSIX ones concern me a bit,
    but I don't expect any black smokes because of testing on BSD,
    Linux, Win32, an Cygwin.
    Affected files
    //depot/perl/MANIFEST#1323 edit
    //depot/perl/ext/B/t/b.t#6 edit
    //depot/perl/ext/PSIX/t/time.t#1 add
    Differences
    //depot/perl/MANIFEST#1323 (text)
    Index: perl/MANIFEST
    perl/MANIFEST#1322~26200~Wed Nov 23 12:45:44 2005
    perl/MANIFESTFri Nov 25 17:31:24 2005
    @@ -833,6 +833,7 @@
    ext/PSIX/t/posix.tSee if PSIX works
    ext/PSIX/t/sigaction.tSee if PSIX::sigaction works
    ext/PSIX/t/taint.tSee if PSIX works with taint
    +ext/PSIX/t/time.tSee if PSIX time-related functions work
    ext/PSIX/t/waitpid.tSee if waitpid works
    ext/PSIX/typemapPSIX extension interface types
    ext/re/hints/mpeix.plHints for re for named architecture
    //depot/perl/ext/B/t/b.t#6 (xtext)
    Index: perl/ext/B/t/b.t
    perl/ext/B/t/b.t#5~23691~Wed Dec 29 03:57:57 2004
    perl/ext/B/t/b.tFri Nov 25 17:31:24 2005
    @@ -22,7 +22,7 @@
    $| = 1;
    use warnings;
    use strict;
    -use Test::More tests =41;
    +use Test::More tests =53;
    BEGIN { use_ok( 'B' ); }
    @@ -147,3 +147,19 @@
    is($gv_ref->NAME(), "gv", "Test NAME()");
    is($gv_ref->SAFENAME(), "gv", "Test SAFENAME()");
    like($gv_ref->FILE(), qr/b\.t$/, "Testing FILE()");
    +
    +# The following return B::SPECIALs.
    +is(ref B::sv_yes(), "B::SPECIAL", "B::sv_yes()");
    +is(ref B::sv_no(), "B::SPECIAL", "B::sv_no()");
    +is(ref B::sv_undef(), "B::SPECIAL", "B::sv_undef()");
    +
    +# More utility functions
    +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()");
    +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);
    //depot/perl/ext/PSIX/t/time.t#1 (text)
    Index: perl/ext/PSIX/t/time.t
    /dev/nullTue May 5 13:32:27 1998
    perl/ext/PSIX/t/time.tFri Nov 25 17:31:24 2005
    @@ -0,0 +1,56 @@
    +#!perl -w
    +
    +use strict;
    +
    +use Config;
    +use PSIX;
    +use Test::More qw(no_plan);
    +
    +# go to UTC to avoid DST issues around the world when testing
    +{
    + no warnings 'uninitialized';
    + $ENV{TZ} = undef;
    +}
    +
    +SKIP: {
    + # It looks like PSIX.xs claims that only VMS and Mac S traditional
    + # don't have tzset(). A config setting might be helpful. Win32 actually
    + # seems ambiguous
    + skip "No tzset()", 2
    + if $^ eq "MS" || $^ eq "VMS" || $^ eq "cygwin" ||
    + $^ eq "MSWin32" || $^ eq "dos" || $^ eq "interix";
    + tzset();
    + my @tzname = tzname();
    + like($tzname[0], qr/[GMT|UTC]/i, "tzset() to GMT/UTC");
    + like($tzname[1], qr/[GMT|UTC]/i, "The whole year?");
    +}
    +
    +# asctime and ctimeLet's stay below INT_MAX for 32-bits and
    +# positive for some picky systems.
    +
    +is(asctime(localtime(0)), ctime(0), "asctime() and ctime() at zero");
    +is(asctime(localtime(12345678)), ctime(12345678), "asctime() and ctime() at 12345678");
    +
    +# Careful! strftime() is locale sensative. Let's take care of that
    +SKIP: {
    + skip "Win32's is missing a %e" if $^ eq "MSWin32";
    + my $orig_loc = setlocale(LC_TIME, "C") || die "Cannot setlocale() to C: $!";
    + is(ctime(86400), strftime("%a %b %e %H:%M:%S %Y\n", localtime(86400)),
    + "get ctime() equal to strftime()");
    + setlocale(LC_TIME, $orig_loc) || die "Cannot setlocale() back to orig: $!";
    +}
    +
    +# Hard to test other than to make sure it returns something numeric and < 0
    +like(clock(), qr/\d*/, "clock() returns a numeric value");
    +ok(clock() 0, "and its greater than zero");
    +
    +SKIP: {
    + skip "No difftime()", 1 if $Config{d_difftime} ne 'define';
    + is(difftime(2, 1), 1, "difftime()");
    +}
    +
    +SKIP: {
    + skip "No mktime()", 1 if $Config{d_mktime} ne 'define';
    + my $time = time();
    + is(mktime(localtime($time)), $time, "mktime()");
    +}
    End of Patch.

Re: Change 26206: Additional tests for B and POSIX. The POSIX ones concern me a bit,


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 5 =
QUESTION ON "Perl"

EMSDN.COM