/
readonly
44 lines (34 loc) · 995 Bytes
/
readonly
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl
# Copyright 2012, Paul Johnson (paul@pjcj.net)
# This software is free. It is licensed under the same terms as Perl itself.
# The latest version of this software should be available from my homepage:
# http://www.pjcj.net
# __COVER__ skip_test $] < 5.008002 || !(eval "use Moo; 23")
# __COVER__ skip_reason Readonly not available
use strict;
use warnings;
use Readonly;
Readonly my $REGEXP_MATCH => '2';
my @lines = ( '1', '2', '3', 'A', 'B', 'c' );
sub test_readonly_coverage {
# All branches executed.
foreach my $line (@lines) {
if ($line =~ /$REGEXP_MATCH/msx) {
print "true ($line)\n";
} else {
print "false ($line)\n";
}
}
}
sub test_posix_regexp {
# All branches executed.
foreach my $line (@lines) {
if ($line =~ /[[:upper:]]/msx) {
print "true ($line)\n";
} else {
print "false ($line)\n";
}
}
}
test_readonly_coverage;
test_posix_regexp;