line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rofi::Script::TestHelpers; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
361
|
use Test2::API qw( context ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use base 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
81
|
|
6
|
|
|
|
|
|
|
our @EXPORT = qw( |
7
|
|
|
|
|
|
|
rofi_shows |
8
|
|
|
|
|
|
|
); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# need a rofi object |
11
|
1
|
|
|
1
|
|
5
|
use Rofi::Script; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
153
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub rofi_shows($$;$) { |
14
|
3
|
|
|
3
|
0
|
12
|
my ($want, $name) = @_; |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
|
|
3
|
my $shown = ''; |
17
|
1
|
|
|
1
|
|
5
|
open my $show_handle, '>', \$shown; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
41
|
|
18
|
3
|
|
|
|
|
632
|
rofi->set_show_handle($show_handle); |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
|
|
7
|
rofi->show(); |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
6
|
close $show_handle; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
7
|
my $ctx = context(); # Get a context |
25
|
3
|
50
|
|
|
|
219
|
if ($shown eq $want) { |
26
|
3
|
|
|
|
|
7
|
$ctx->pass_and_release($name); |
27
|
|
|
|
|
|
|
} else { |
28
|
0
|
|
|
|
|
0
|
my $diag = sprintf(<
|
29
|
|
|
|
|
|
|
Wanted: |
30
|
|
|
|
|
|
|
------- |
31
|
|
|
|
|
|
|
%s |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
but got: |
34
|
|
|
|
|
|
|
-------- |
35
|
|
|
|
|
|
|
%s |
36
|
|
|
|
|
|
|
DIAG |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
$ctx->fail_and_release($name, $diag); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
3
|
|
|
|
|
388
|
return $shown; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |