| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Rofi::Script::TestHelpers; |
|
2
|
1
|
|
|
1
|
|
377
|
use strict; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
22
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
22
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use Carp qw( croak ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
36
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use Test2::API qw( context ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
66
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use base 'Exporter'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
116
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
## no critic (ProhibitAutomaticExportation) |
|
12
|
|
|
|
|
|
|
our @EXPORT = qw( |
|
13
|
|
|
|
|
|
|
mock_rofi_args |
|
14
|
|
|
|
|
|
|
rofi_shows |
|
15
|
|
|
|
|
|
|
init_rofi |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# need a rofi object |
|
19
|
1
|
|
|
1
|
|
7
|
use Rofi::Script; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
259
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
## no critic (ProhibitSubroutinePrototypes) |
|
22
|
|
|
|
|
|
|
sub rofi_shows($$;$) { |
|
23
|
3
|
|
|
3
|
0
|
11
|
my ($want, $name) = @_; |
|
24
|
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
4
|
my $shown = ''; |
|
26
|
1
|
50
|
|
1
|
|
6
|
open my $show_handle, '>', \$shown |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
54
|
|
|
27
|
|
|
|
|
|
|
or croak "Could not open show handle"; |
|
28
|
3
|
|
|
|
|
618
|
rofi->set_show_handle($show_handle); |
|
29
|
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
5
|
rofi->show(); |
|
31
|
|
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
7
|
close $show_handle; |
|
33
|
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
8
|
my $ctx = context(); # Get a context |
|
35
|
3
|
50
|
|
|
|
223
|
if ($shown eq $want) { |
|
36
|
3
|
|
|
|
|
9
|
$ctx->pass_and_release($name); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
else { |
|
39
|
0
|
|
|
|
|
0
|
my $diag = sprintf(<<"DIAG", $want, $shown); |
|
40
|
|
|
|
|
|
|
Wanted: |
|
41
|
|
|
|
|
|
|
------- |
|
42
|
|
|
|
|
|
|
%s |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
but got: |
|
45
|
|
|
|
|
|
|
-------- |
|
46
|
|
|
|
|
|
|
%s |
|
47
|
|
|
|
|
|
|
DIAG |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
0
|
$ctx->fail_and_release($name, $diag); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
417
|
return $shown; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# clear out the global rofi object, and provide a way to override the rofi |
|
56
|
|
|
|
|
|
|
# environment |
|
57
|
|
|
|
|
|
|
sub init_rofi(%) { |
|
58
|
6
|
|
50
|
6
|
0
|
6239
|
$ENV{ROFI_RETV} ||= 0; |
|
59
|
6
|
|
|
|
|
20
|
rofi->clear(); |
|
60
|
6
|
|
|
|
|
26
|
return; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# set the args slot on the global rofi object |
|
64
|
|
|
|
|
|
|
sub mock_rofi_args (@) { |
|
65
|
0
|
|
|
0
|
0
|
|
my (@mock_args) = @_; |
|
66
|
0
|
|
|
|
|
|
rofi->{args} = \@mock_args; |
|
67
|
0
|
|
|
|
|
|
return; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |