# encoding: utf-8 require 'test_helper' require 'review/compiler' require 'review/book' require 'review/idgxmlbuilder' require 'review/i18n' class IDGXMLBuidlerTest < Test::Unit::TestCase include ReVIEW def setup @builder = IDGXMLBuilder.new() @param = { "secnolevel" => 2, "inencoding" => "UTF-8", "outencoding" => "UTF-8", "nolf" => true, "tableopt" => "10" } ReVIEW.book.param = @param @compiler = ReVIEW::Compiler.new(@builder) @chapter = Book::Chapter.new(Book::Base.new(nil), 1, '-', nil, StringIO.new) location = Location.new(nil, nil) @builder.bind(@compiler, @chapter, location) end def test_headline_level1 @builder.headline(1,"test","this is test.") assert_equal %Q|\n第1章 this is test.|, @builder.raw_result end def test_headline_level1_without_secno @param["secnolevel"] = 0 @builder.headline(1,"test","this is test.") assert_equal %Q|\nthis is test.|, @builder.raw_result end def test_headline_level2 @builder.headline(2,"test","this is test.") assert_equal %Q|\n1.1 this is test.|, @builder.raw_result end def test_headline_level3 @builder.headline(3,"test","this is test.") assert_equal %Q|\nthis is test.|, @builder.raw_result end def test_headline_level3_with_secno @param["secnolevel"] = 3 @builder.headline(3,"test","this is test.") assert_equal %Q|\n1.0.1 this is test.|, @builder.raw_result end def test_label @builder.label("label_test") assert_equal %Q|\n