From a79d58b0e90d0a9f55d9c6dffe59ce38f453566e Mon Sep 17 00:00:00 2001 From: takahashim Date: Wed, 19 Aug 2020 19:56:34 +0900 Subject: [PATCH] fix tests * add setup of I18N * fix invalid test cases --- test/test_book_chapter.rb | 115 +++++++++++++++++++++-------------- test/test_converter.rb | 1 + test/test_epubmaker.rb | 1 + test/test_htmlbuilder.rb | 8 +-- test/test_markdownbuilder.rb | 1 + 5 files changed, 77 insertions(+), 49 deletions(-) diff --git a/test/test_book_chapter.rb b/test/test_book_chapter.rb index b3a251ca4..f694d3569 100644 --- a/test/test_book_chapter.rb +++ b/test/test_book_chapter.rb @@ -2,6 +2,10 @@ class ChapterTest < Test::Unit::TestCase include BookTestHelper + def setup + I18n.setup + end + def test_initialize ch = Book::Chapter.new(:book, :number, :name, '/foo/bar', :io) assert_equal :book, ch.book @@ -144,48 +148,56 @@ def test_invalid_encoding def test_list_index do_test_index(< %w[ch1.re ch2.re]) - io1 = StringIO.new("//list[sampletest]{\nfoo\n//}\n") + io1 = StringIO.new("//list[sampletest][a]{\nfoo\n//}\n") io2 = StringIO.new("= BAR\n") chap1 = ReVIEW::Book::Chapter.new(book, 1, 'ch1', 'ch1.re', io1) chap2 = ReVIEW::Book::Chapter.new(book, 2, 'ch2', 'ch2.re', io2) - book.parts = [ReVIEW::Book::Part.new(self, nil, [chap1, chap2])] + book.parts = [ReVIEW::Book::Part.new(book, nil, [chap1, chap2])] builder = ReVIEW::HTMLBuilder.new comp = ReVIEW::Compiler.new(builder) builder.bind(comp, chap2, nil) @@ -2224,7 +2224,7 @@ def test_inline_hd io2 = StringIO.new("= test2\n\nfoo\n\n== test2-1\n\nbar\n\n== test2-2\n\nbar\n\n") chap1 = ReVIEW::Book::Chapter.new(book, 1, 'ch1', 'ch1.re', io1) chap2 = ReVIEW::Book::Chapter.new(book, 2, 'ch2', 'ch2.re', io2) - book.parts = [ReVIEW::Book::Part.new(self, nil, [chap1, chap2])] + book.parts = [ReVIEW::Book::Part.new(book, nil, [chap1, chap2])] builder = ReVIEW::HTMLBuilder.new comp = ReVIEW::Compiler.new(builder) builder.bind(comp, chap2, nil) @@ -2247,7 +2247,7 @@ def test_inline_hd_for_part io_p1 = StringIO.new("= part1\n\nfoo\n\n== part1-1\n\nbar\n\n== part1-2\n\nbar\n\n") chap1 = ReVIEW::Book::Chapter.new(book, 1, 'ch1', 'ch1.re', io1) chap2 = ReVIEW::Book::Chapter.new(book, 2, 'ch2', 'ch2.re', io2) - book.parts = [ReVIEW::Book::Part.new(self, 1, [chap1, chap2], 'part1.re', io_p1)] + book.parts = [ReVIEW::Book::Part.new(book, 1, [chap1, chap2], 'part1.re', io_p1)] builder = ReVIEW::HTMLBuilder.new comp = ReVIEW::Compiler.new(builder) builder.bind(comp, chap2, nil) diff --git a/test/test_markdownbuilder.rb b/test/test_markdownbuilder.rb index 61b0747a1..eb3c76ac5 100644 --- a/test/test_markdownbuilder.rb +++ b/test/test_markdownbuilder.rb @@ -16,6 +16,7 @@ def setup @chapter = Book::Chapter.new(@book, 1, '-', nil, StringIO.new) location = Location.new(nil, nil) @builder.bind(@compiler, @chapter, location) + I18n.setup(@config['language']) end def test_quote