|
Revision 4175, 0.6 kB
(checked in by tokuhirom, 5 years ago)
|
|
H::MA::P::Charset: support docomo and nonmobile :)
|
| Line | |
|---|
| 1 | use strict; |
|---|
| 2 | use warnings; |
|---|
| 3 | use Test::Base; |
|---|
| 4 | use HTTP::MobileAgent; |
|---|
| 5 | use HTTP::MobileAgent::Plugin::Charset; |
|---|
| 6 | |
|---|
| 7 | plan tests => 1*blocks; |
|---|
| 8 | |
|---|
| 9 | filters { |
|---|
| 10 | input => [qw/encoding/], |
|---|
| 11 | }; |
|---|
| 12 | |
|---|
| 13 | run_is input => 'expected'; |
|---|
| 14 | |
|---|
| 15 | sub encoding { |
|---|
| 16 | my $ua = shift; |
|---|
| 17 | |
|---|
| 18 | local $ENV{HTTP_USER_AGENT} = $ua; |
|---|
| 19 | my $agent = HTTP::MobileAgent->new; |
|---|
| 20 | $agent->encoding; |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | __END__ |
|---|
| 24 | |
|---|
| 25 | === |
|---|
| 26 | --- input: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.8) Gecko/20071019 Firefox/2.0.0.8 |
|---|
| 27 | --- expected: utf8 |
|---|
| 28 | |
|---|
| 29 | === docomo foma |
|---|
| 30 | --- input: DoCoMo/2.0 N905iBiz(c100;TJ) |
|---|
| 31 | --- expected: x-utf8-docomo |
|---|
| 32 | |
|---|
| 33 | === docomo mova |
|---|
| 34 | --- input: DoCoMo/1.0/D501i |
|---|
| 35 | --- expected: x-sjis-docomo |
|---|
| 36 | |
|---|