File: ignore.t

package info (click to toggle)
libtest-mockobject-perl 1.20161202-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 200 kB
  • ctags: 53
  • sloc: perl: 1,225; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

use strict;
use warnings;

my $package = 'Test::MockObject';
use Test::More tests => 6;
use_ok( $package );

my $mock = $package->new();
$mock->set_true( -somesub => 'anothersub' );

ok( $mock->somesub(), 'mocking a method with a leading dash should work' );
ok( $mock->anothersub(), '... not preventing subsequent mocks' );

is( $mock->next_call(), 'anothersub',
	'... but should prevent logging of endashed sub calls' );

$mock->set_false( 'somesub' );
ok( ! $mock->somesub(), 'unlogged call should be remockable' );
is( $mock->next_call(), 'somesub', '... and reloggable' );