# 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() @config = ReVIEW::Configure.values @config.merge!({ "secnolevel" => 2, "inencoding" => "UTF-8", "outencoding" => "UTF-8", "nolf" => true, "tableopt" => "10" }) @book = Book::Base.new(nil) @book.config = @config @compiler = ReVIEW::Compiler.new(@builder) @chapter = Book::Chapter.new(@book, 1, '-', nil, StringIO.new) location = Location.new(nil, nil) @builder.bind(@compiler, @chapter, location) I18n.setup("ja") end def test_headline_level1 actual = compile_block("={test} this is test.\n") assert_equal %Q|第1章 this is test.|, actual end def test_headline_level1_without_secno @config["secnolevel"] = 0 actual = compile_block("={test} this is test.\n") assert_equal %Q|this is test.|, actual end def test_headline_level2 actual = compile_block("=={test} this is test.\n") assert_equal %Q|1.1 this is test.|, actual end def test_headline_level3 actual = compile_block("==={test} this is test.\n") assert_equal %Q|this is test.|, actual end def test_headline_level3_with_secno @config["secnolevel"] = 3 actual = compile_block("==={test} this is test.\n") assert_equal %Q|1.0.1 this is test.|, actual end def test_label actual = compile_block("//label[label_test]\n") assert_equal %Q|