Aozora2Epub
view release on metacpan or search on metacpan
t/gaiji-title-author.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Test::Base;
use Aozora2Epub::XHTML;
use lib qw/./;
use t::Util;
plan tests => 1 * blocks;
sub eval_unicode_notation {
my $s = shift;
$s =~ s|\\x\{([0-9a-fA-F]+)\}|chr(hex($1))|esg;
return $s;
}
filters {
input => 'chomp',
expected => ['chomp', 'eval_unicode_notation'],
};
run {
my $block = shift;
my $got = Aozora2Epub::XHTML::conv_gaiji_title_author($block->input);
is $got, $block->expected, $block->name;
};
__DATA__
=== normal jis
--- input
大åâ»ï¼»ï¼ãç«ï¼è¯ãã第3æ°´æº1-87-62ï¼½å
--- expected
大å\x{71c1}å
=== normal jis top
--- input
â»ï¼»ï¼ãããããï¼ï¼å£¥ï¼åã¸ãï¼åï¼ãã第3æ°´æº1-87-25ï¼½ä¸æ¼å²
--- expected
\x{6ff9}䏿¼å²
=== unchanged
--- input
å士ã¦â»ï¼»ï¼å°æ¸ãçä»®åã²ï¼½ã«ã¿ã¼
--- expected
å士ã¦â»ï¼»ï¼å°æ¸ãçä»®åã²ï¼½ã«ã¿ã¼
=== normal jis double
--- input
æãâ»ï¼»ï¼ãã¼ãæ°å1ã1-13-21ï¼½ã»â»ï¼»ï¼ãã¼ãæ°å2ã1-13-22ï¼½
--- expected
æã\x{2160}ã»\x{2161}
=== not kome
--- input
ï¼ï¼ï¼»ï¼ãï¼ãã¯ãã¼ãæ°åã1-13-22ï¼½ï¼
--- expected
ï¼\x{2161}ï¼
=== unicode
--- input
ãã¾â»ï¼»ï¼ããããã¸ãï¼æããU+897Bï¼½
--- expected
ãã¾\x{897b}
=== unicode bad font
--- input
失â»ï¼»ï¼ã人ãããï¼äºï¼å¿ããU+2B779ã表ç´ï¼½è¡è¬ç¾©
--- expected
失â»ï¼»ï¼ã人ãããï¼äºï¼å¿ããU+2B779ã表ç´ï¼½è¡è¬ç¾©
--- note
2b779ã¯kindleã ã¨è±è
ã«ãªã
=== no chuuki
--- input
ããããã
--- expected
ããããã
( run in 0.485 second using v1.01-cache-2.11-cpan-0b5f733616e )