line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::More::UTF8; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
154937
|
use warnings; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
159
|
|
4
|
5
|
|
|
5
|
|
27
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
169
|
|
5
|
5
|
|
|
5
|
|
25
|
use Test::More (); |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
102
|
|
6
|
5
|
|
|
5
|
|
25
|
use Carp; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
1791
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Test::More::UTF8 - Enhancing Test::More for UTF8-based projects |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Test::More; |
19
|
|
|
|
|
|
|
use Test::More::UTF8; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# now we can easily use flagged strings without warnings like "Wide character in print ..." |
22
|
|
|
|
|
|
|
is("\x{410}","\x{420}"); # got a failure message without warnings |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 LIMITATIONS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This module have reason only for perl 5.8 and higher |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 FEATURES |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This module also switch on by default utf8 pragma. To disable this, add "-utf8" option |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use Test::More::UTF8 qw(-utf8); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
By default binmode ':utf8' will be done on all output handles: failure_output, todo_output, output. It is possible to choose only some of them |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use Test::More::UTF8 qw(failure); # enable :utf8 only on failure_output |
37
|
|
|
|
|
|
|
use Test::More::UTF8 qw(todo); # enable :utf8 only on todo_output |
38
|
|
|
|
|
|
|
use Test::More::UTF8 qw(out); # enable :utf8 only on output |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub import { |
43
|
5
|
|
|
5
|
|
40
|
my $pkg = shift; |
44
|
5
|
|
|
|
|
12
|
my %args = map {$_ => 1} @_; |
|
3
|
|
|
|
|
12
|
|
45
|
5
|
|
|
|
|
12
|
my ($do_utf8,@h) = (1); |
46
|
5
|
100
|
66
|
|
|
54
|
push @h, 'failure_output' if delete $args{failure} or delete $args{failure_output}; |
47
|
5
|
50
|
33
|
|
|
45
|
push @h, 'todo_output' if delete $args{todo} or delete $args{todo_output}; |
48
|
5
|
50
|
33
|
|
|
36
|
push @h, 'output' if delete $args{out} or delete $args{output}; |
49
|
5
|
100
|
66
|
|
|
39
|
$do_utf8 = 0 if delete $args{-utf8} or delete $args{-utf}; |
50
|
5
|
50
|
|
|
|
22
|
%args and croak "Unsupported options to $pkg: ".join ', ', keys %args; |
51
|
5
|
100
|
|
|
|
25
|
@h or @h = qw(failure_output todo_output output); |
52
|
5
|
|
|
|
|
31
|
binmode Test::More->builder->$_, ':utf8' for @h; |
53
|
5
|
100
|
|
|
|
213
|
if ($do_utf8) { |
54
|
3
|
|
|
|
|
3414
|
require utf8; |
55
|
3
|
|
|
|
|
35
|
@_ = ('utf8'); |
56
|
3
|
|
|
|
|
1160
|
goto &utf8::import; |
57
|
|
|
|
|
|
|
} |
58
|
2
|
|
|
|
|
56
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Mons Anderson, |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 BUGS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
None known |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Copyright 2009 Mons Anderson, all rights reserved. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
74
|
|
|
|
|
|
|
under the same terms as Perl itself. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; # End of Test::More::UTF8 |