line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::More::UTF8; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
88600
|
use warnings; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
174
|
|
4
|
5
|
|
|
5
|
|
32
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
103
|
|
5
|
5
|
|
|
5
|
|
27
|
use Test::More (); |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
91
|
|
6
|
5
|
|
|
5
|
|
27
|
use Carp; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
1350
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Test::More::UTF8 - Enhancing Test::More for UTF8-based projects |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
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
|
|
44
|
my $pkg = shift; |
44
|
5
|
|
|
|
|
14
|
my %args = map {$_ => 1} @_; |
|
3
|
|
|
|
|
14
|
|
45
|
5
|
|
|
|
|
14
|
my ($do_utf8,@h) = (1); |
46
|
5
|
100
|
66
|
|
|
43
|
push @h, 'failure_output' if delete $args{failure} or delete $args{failure_output}; |
47
|
5
|
50
|
33
|
|
|
36
|
push @h, 'todo_output' if delete $args{todo} or delete $args{todo_output}; |
48
|
5
|
50
|
33
|
|
|
28
|
push @h, 'output' if delete $args{out} or delete $args{output}; |
49
|
5
|
100
|
66
|
|
|
34
|
$do_utf8 = 0 if delete $args{-utf8} or delete $args{-utf}; |
50
|
5
|
50
|
|
|
|
17
|
%args and croak "Unsupported options to $pkg: ".join ', ', keys %args; |
51
|
5
|
100
|
|
|
|
20
|
@h or @h = qw(failure_output todo_output output); |
52
|
5
|
|
|
|
|
28
|
binmode Test::More->builder->$_, ':utf8' for @h; |
53
|
5
|
100
|
|
|
|
199
|
if ($do_utf8) { |
54
|
3
|
|
|
|
|
1373
|
require utf8; |
55
|
3
|
|
|
|
|
39
|
@_ = ('utf8'); |
56
|
3
|
|
|
|
|
33
|
goto &utf8::import; |
57
|
|
|
|
|
|
|
} |
58
|
2
|
|
|
|
|
45
|
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 |