Skip Menu |

This queue is for tickets about the Test-MockTime CPAN distribution.

Report information
The Basics
Id: 24123
Status: resolved
Priority: 0/
Queue: Test-MockTime

People
Owner: Nobody in particular
Requestors: p.dumarchie [...] blinck.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.02
  • 0.04
Fixed in: (no value)



Subject: Function prototypes are missing
The functions exported to CORE::GLOBAL (time, localtime and gmtime) do not have the same prototypes as the overridden built-ins. This means that in some cases, they don't behave identically. I have added a test file that proves this (prototypes.t). The first test is obvious. The second and third are less obvious, but this is really the way the built-ins behave. I have added a diff file that shows which prototypes to add (prototypes.diff). Regards, Peter du Marchie van Voorthuysen
Subject: prototypes.diff
64c64 < sub time { --- > sub time () { 72c72 < sub localtime { --- > sub localtime (;$) { 80c80 < sub gmtime { --- > sub gmtime (;$) {
Subject: prototypes.t
#! /usr/bin/perl use Test::MockTime ':all'; use Test::More tests => 3; use strict; use warnings; set_fixed_time(2); my $four = time + 2; is($four, 4, "time() does not try so slurp any arguments"); my @arr = (0, 1, 2); my $got = localtime @arr; my $expect = localtime scalar @arr; is($got, $expect, "localtime() treats its argument as an expression"); $got = gmtime @arr; $expect = gmtime scalar @arr; is($got, $expect, "gmtime() treats its argument as an expression");
Thanks Peter. 0.05 has this patch incorporated.