line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Smart::Interface::Mock; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
694
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
76
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
5
|
2
|
|
|
2
|
|
10
|
use base 'Test::Smart::Interface'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
989
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Test::Smart::Interface::Mock - Mock interface for testing Test::Smart |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Test::Smart; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
initialize('Test::Smart::Interface::Mock', |
16
|
|
|
|
|
|
|
answer => 'always do this', |
17
|
|
|
|
|
|
|
comment => 'saying this about it', |
18
|
|
|
|
|
|
|
skip => 'or skip because of this', |
19
|
|
|
|
|
|
|
error => 'or give this error'); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# do some testing here to make sure Test::Smart |
22
|
|
|
|
|
|
|
# reacts properly. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This is for internal testing. If you're re-implementing Test::Smart you might |
27
|
|
|
|
|
|
|
find it useful yourself. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub load { |
32
|
7
|
|
|
7
|
1
|
708
|
my $class = shift; |
33
|
7
|
|
|
|
|
21
|
my %args = @_; |
34
|
7
|
|
|
|
|
38
|
my $self = {}; |
35
|
|
|
|
|
|
|
|
36
|
7
|
|
|
|
|
20
|
$self->{_answer} = $args{answer}; |
37
|
7
|
|
|
|
|
13
|
$self->{_comment} = $args{comment}; |
38
|
7
|
|
|
|
|
25
|
$self->{_skip} = $args{skip}; |
39
|
7
|
|
|
|
|
507
|
$self->{_error} = $args{error}; |
40
|
|
|
|
|
|
|
|
41
|
7
|
|
|
|
|
43
|
bless $self,$class; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub submit { |
45
|
10
|
|
|
10
|
1
|
394
|
my ($self,$question,$name) = @_; |
46
|
|
|
|
|
|
|
|
47
|
10
|
100
|
|
|
|
67
|
$self->err($self->{_error}), return undef if $self->{_error}; |
48
|
8
|
100
|
|
|
|
35
|
return Test::Smart::Question->new(question=>$question, |
49
|
|
|
|
|
|
|
name=>$name, |
50
|
|
|
|
|
|
|
id=>"id", |
51
|
|
|
|
|
|
|
skip=>$self->{_skip}) if $self->{_skip}; |
52
|
6
|
|
|
|
|
31
|
return Test::Smart::Question->new(question=>$question,name=>$name,id=>"id"); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub has_answer { |
56
|
7
|
|
|
7
|
1
|
362
|
return 1; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub answer { |
60
|
9
|
|
|
9
|
1
|
16
|
my ($self,$Qobj) = @_; |
61
|
|
|
|
|
|
|
|
62
|
9
|
100
|
|
|
|
43
|
$self->err($self->{_error}), return undef if $self->{_error}; |
63
|
7
|
|
|
|
|
32
|
$Qobj->answer($self->{_answer},$self->{_comment}); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 AUTHOR |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Edgar A. Bering, Etrizor@gmail.comE |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Copyright (C) 2007 by Edgar A. Bering |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
75
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
76
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |