File: chaining.t

package info (click to toggle)
libtest-mockmodule-perl 0.178.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 192 kB
  • sloc: perl: 245; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use warnings;
use strict;

use Test::More;
use Test::Warnings;

use Test::MockModule;

my $mocker = Test::MockModule->new('Mockee')->mock( good => 51 )
  ->redefine( to_redefine => sub { 42 } )->define( something => 1234 );

isa_ok $mocker, 'Test::MockModule';

is( Mockee::good(),        51,   'mock() works when chaining with new' );
is( Mockee::to_redefine(), 42,   'redefine() works when chaining with new' );
is( Mockee::something(),   1234, 'something() works when chaining with new' );

done_testing();

#----------------------------------------------------------------------

package Mockee;

our $VERSION;
BEGIN { $VERSION = 1 }

sub good        { 1 }
sub to_redefine { 1 }

1;