test/test_builder.rb in review-1.3.0 vs test/test_builder.rb in review-1.4.0

- old
+ new

@@ -14,32 +14,35 @@ class BuidlerTest < Test::Unit::TestCase include ReVIEW def setup @b = Builder.new - @b.bind(MockCompiler.new, nil, nil) + chap = ReVIEW::Book::Chapter.new(nil, nil, '-', nil) + @b.bind(MockCompiler.new, chap, nil) end def test_initialize assert Builder.new end def test_bind b = Builder.new + chap = ReVIEW::Book::Chapter.new(ReVIEW::Book::Base.load_default, nil, '-', nil) assert_nothing_raised do - b.bind(nil, nil, nil) + b.bind(nil, chap, nil) end end def test_result b = Builder.new assert_raises(NoMethodError) do # XXX: OK? b.result end b = Builder.new - b.bind(nil, nil, nil) + chapter = ReVIEW::Book::Chapter.new(ReVIEW::Book::Base.load_default, nil, '-', nil) + b.bind(nil, chapter, nil) assert_equal '', b.result end def test_print_and_puts b = Builder.new @@ -77,12 +80,13 @@ [:puts, utf8_str, "#{expect}\n"], [:print, "#{utf8_str}\n", "#{expect}\n"], [:puts, "#{utf8_str}\n", "#{expect}\n"], ].each do |m, instr, expstr| b = Builder.new - b.bind(nil, nil, nil) - ReVIEW.book.config = params + chapter = ReVIEW::Book::Chapter.new(ReVIEW::Book::Base.load_default, nil, '-', nil) + b.bind(nil, chapter, nil) + chapter.book.config = params b.__send__(m, instr) if "".respond_to?(:encode) assert_equal expstr.encode("UTF-8"), b.result else assert_equal expstr, b.result @@ -126,12 +130,13 @@ text = "abc\\d\\#a" assert_equal [:text, text], @b.compile_inline(text) end def test_convert_outencoding - ReVIEW.book.config = {'outencoding' => "EUC"} + book = ReVIEW::Book::Base.new(nil) + book.config = {'outencoding' => "EUC"} b = Builder.new - ret = b.convert_outencoding("a", ReVIEW.book.config["outencoding"]) + ret = b.convert_outencoding("a", book.config["outencoding"]) assert_equal "a", ret end class XBuilder < Builder def list_header(id, caption)