Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Maintainer(s)' notes

Test::Spec is managed with Github, not RT. Please report issues via Github's issues tracker: https://github.com/kingpong/perl-Test-Spec/issues

Report information
The Basics
Id: 86495
Status: new
Priority: 0/
Queue: Test-Spec

People
Owner: Nobody in particular
Requestors: victor [...] vsespb.ru
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.46
Fixed in: (no value)



Subject: with() function with class methods/imported subroutines
with() does not work now as one can expect when mocking plain function (not object methods). Seems it strips first argument, as expects it to be $self package A; sub mysub { } package B; @ISA = qw(A); sub t { mysub('123'); } package main; use strict; use warnings; use Test::Spec; describe "test1" => sub { it "should work using with()" => sub { B->expects("mysub")->with(123); B::t(); }; it "should work using returns()" => sub { B->expects("mysub")->returns(sub { is shift, 123 }); B::t(); }; }; runtests unless caller; __END__ not ok 1 - test1 should work using with() # Failed test 'test1 should work using with()' by dying: # Number of arguments don't match expectation # at /usr/local/share/perl/5.10.1/Test/Spec/Mocks.pm line 434. ok 2 - test1 should work using returns() 1..2 # Looks like you failed 1 test of 2.