test/test_builder.rb in review-2.0.0.beta1 vs test/test_builder.rb in review-2.0.0

- old
+ new

@@ -42,10 +42,20 @@ chapter = ReVIEW::Book::Chapter.new(ReVIEW::Book::Base.load, nil, '-', nil) b.bind(nil, chapter, nil) assert_equal '', b.result end + def test_print_and_puts + b = Builder.new + assert_raises(NoMethodError) do # XXX: OK? + b.print "" + end + assert_raises(NoMethodError) do # XXX: OK? + b.puts "" + end + end + def test_not_implemented_methods ex = NoMethodError # XXX: OK? [ :list_header, :list_body, :listnum_body, :source_header, :source_body, @@ -58,15 +68,27 @@ b = Builder.new assert_raises(ex) { b.__send__(m) } end end - def test_convert_outencoding - book = ReVIEW::Book::Base.new(nil) - book.config = {'outencoding' => "EUC"} - b = Builder.new - ret = b.convert_outencoding("a", book.config["outencoding"]) - assert_equal "a", ret + def test_compile_inline + text = "abc" + assert_equal [:text, text], @b.compile_inline(text) + end + + def test_inline_ruby + def @b.compile_ruby(base,ruby) + [base,ruby] + end + str = @b.inline_ruby("foo,bar") + assert_equal str, ["foo","bar"] + str = @b.inline_ruby("foo\\,\\,,\\,bar,buz") + assert_equal str, ["foo,,",",bar,buz"] + end + + def test_compile_inline_backslash + text = "abc\\d\\#a" + assert_equal [:text, text], @b.compile_inline(text) end class XBuilder < Builder def list_header(id, caption) end