Aozora2Epub

 view release on metacpan or  search on metacpan

xt/gappon.t  view on Meta::CPAN

use strict;
use warnings;
use utf8;
use Test::More;
use Aozora2Epub;
use lib qw/./;
use xt::ZipDiff;
use t::Util;
use Path::Tiny;
use Aozora2Epub::Gensym;

{
    local($Aozora2Epub::AOZORA_CARDS_URL) = 'xt/input';
    local($Aozora2Epub::AOZORA_GAIJI_URL) = 'xt/input/gaiji/';

    subtest "gappon" => sub {
        my ($title, $author, $html) = do {
            Aozora2Epub::Gensym->reset_counter;
            my $book = Aozora2Epub->new();
            $book->append('01/files/01_000.html');
            $book->append('02/files/02_000.html');
            ($book->title, $book->author, $book->as_html);
        };
        is $title, "テスト1", "title";
        is $author, "酔狂亭不出来", "author";
        is $html, book1(), "book";
        done_testing;
    };

    subtest "with title" => sub {
        my ($title, $author, $html) = do {
            Aozora2Epub::Gensym->reset_counter;
            my $book = Aozora2Epub->new();
            $book->title('gappon');
            $book->append('01/files/01_000.html', title=>"part1");
            $book->append('02/files/02_000.html', title=>"part2");
            ($book->title, $book->author, $book->as_html);
        };
        is $title, "gappon", "title";
        is $author, "酔狂亭不出来", "author";
        is $html, book2(), "book";
        done_testing;
    };

    subtest "with title level" => sub {
        my ($title, $author, $html) = do {
            Aozora2Epub::Gensym->reset_counter;
            my $book = Aozora2Epub->new();
            $book->title('gappon');
            $book->append('01/files/01_000.html', title=>"part1", title_level=>1);
            $book->append('02/files/02_000.html', title=>"part2");
            ($book->title, $book->author, $book->as_html);
        };
        is $title, "gappon", "title";
        is $author, "酔狂亭不出来", "author";
        is $html, book3(), "book";
        done_testing;
    };

    subtest "with subtitle" => sub {
        my ($title, $author, $html) = do {
            Aozora2Epub::Gensym->reset_counter;
            my $book = Aozora2Epub->new();



( run in 0.531 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )