root/lang/perl/HTTP-MobileAgent-Plugin-Charset/trunk/t/01_can_display_utf8.t @ 4851

Revision 4851, 1.7 kB (checked in by tokuhirom, 5 years ago)

lang/perl/HTTP-MobileAgent?-Plugin-Charset: refactoring

Line 
1use strict;
2use warnings;
3use Test::Base;
4use HTTP::MobileAgent;
5use HTTP::MobileAgent::Plugin::Charset;
6
7plan tests => 1*blocks;
8
9filters {
10    input => [qw/filt/],
11    expected => [qw/yaml/],
12};
13
14run_is_deeply input => 'expected';
15
16sub filt {
17    my $ua = shift;
18
19    local $ENV{HTTP_USER_AGENT} = $ua;
20    local $ENV{HTTP_ACCEPT_CHARSET};
21    if ($ua =~ /DDIPOCKET/) {
22        $ENV{HTTP_ACCEPT_CHARSET} =
23          ( $ua =~ /K3001V/ )
24          ? 'shift_jis, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1'
25          : 'shift_jis; q=0.6, *;q=0.1';
26    }
27
28    my $agent = HTTP::MobileAgent->new;
29    +{
30        can_display_utf8 => $agent->can_display_utf8 ? 'utf8' : 'no utf8',
31    };
32}
33
34__END__
35
36===
37--- input: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.8) Gecko/20071019 Firefox/2.0.0.8
38--- expected
39can_display_utf8: utf8
40
41=== docomo foma
42--- input: DoCoMo/2.0 N905iBiz(c100;TJ)
43--- expected
44can_display_utf8: utf8
45
46=== docomo mova
47--- input: DoCoMo/1.0/D501i
48--- expected
49can_display_utf8: no utf8
50
51===
52--- input: Vodafone/1.0/V802SE/SEJ001/SNXXXXXXXXX Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.10
53--- expected
54can_display_utf8: utf8
55
56===
57--- input: J-PHONE/2.0/J-DN02
58--- expected
59can_display_utf8: no utf8
60
61=== willcom
62--- input: Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0
63--- expected
64can_display_utf8: no utf8
65
66=== willcom
67--- input: Mozilla/3.0(DDIPOCKET;KYOCERA/AH-K3001V/1.4.1.67.000000/0.1/C100) Opera 7.0
68--- expected
69can_display_utf8: utf8
70
71=== ez
72--- input: UP.Browser/3.01-HI01 UP.Link/3.4.5.2
73--- expected
74can_display_utf8: no utf8
75
76=== ez
77--- input: KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1
78--- expected
79can_display_utf8: utf8
80
Note: See TracBrowser for help on using the browser.