class MD2INAOBuilderTest

Public Instance Methods

setup() click to toggle source
# File ../../../../../test/test_md2inaobuilder.rb, line 11
def setup
  @builder = MD2INAOBuilder.new()
  @config = {
    "secnolevel" => 2, # for IDGXMLBuilder, HTMLBuilder
    "stylesheet" => nil, # for HTMLBuilder
  }
  @book = Book::Base.new(".")
  @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
test_cmd() click to toggle source
# File ../../../../../test/test_md2inaobuilder.rb, line 31
def test_cmd
  actual = compile_block("//cmd{\nlineA\nlineB\n//}\n")
  assert_equal "!!! cmd\nlineA\nlineB\n\n", actual
end
test_comment() click to toggle source
# File ../../../../../test/test_md2inaobuilder.rb, line 59
def test_comment
  actual = compile_block("//comment{\nHello, world!\n//}\n")
  assert_equal "<span class=\"red\">\nHello, world!\n</span>\n", actual
end
test_dlist() click to toggle source
# File ../../../../../test/test_md2inaobuilder.rb, line 36
def test_dlist
  actual = compile_block(": foo\n  foo.\n  bar.\n")
  assert_equal "<dl>\n<dt>foo</dt>\n<dd>foo.bar.</dd>\n</dl>\n", actual
end
test_list() click to toggle source
# File ../../../../../test/test_md2inaobuilder.rb, line 41
  def test_list
    actual = compile_block("//list[name][caption]{
AAA
BBB
//}
")

    assert_equal "```
●リスト1::caption

AAA
BBB
```
", actual
  end
test_paragraph() click to toggle source
# File ../../../../../test/test_md2inaobuilder.rb, line 26
def test_paragraph
  actual = compile_block("Hello, world!")
  assert_equal " Hello, world!\n\n", actual
end
test_ruby_group() click to toggle source
# File ../../../../../test/test_md2inaobuilder.rb, line 69
def test_ruby_group
  actual = compile_block("@<ruby>{欠伸,あくび}が出る")
  assert_equal " <span class='groupruby'>欠伸(あくび)</span>が出る\n\n", actual
end
test_ruby_mono() click to toggle source
# File ../../../../../test/test_md2inaobuilder.rb, line 64
def test_ruby_mono
  actual = compile_block("@<ruby>{謳,うた}い文句")
  assert_equal " <span class='monoruby'>謳(うた)</span>い文句\n\n", actual
end