class BuidlerTest

Public Instance Methods

setup() click to toggle source
# File ../../../../../test/test_builder.rb, line 16
def setup
  @b = Builder.new
  chap = ReVIEW::Book::Chapter.new(nil, nil, '-', nil)
  @b.bind(MockCompiler.new, chap, nil)
end
test_bind() click to toggle source
# File ../../../../../test/test_builder.rb, line 26
def test_bind
  b = Builder.new
  chap = ReVIEW::Book::Chapter.new(ReVIEW::Book::Base.load, nil, '-', nil)
  assert_nothing_raised do
    b.bind(nil, chap, nil)
  end
end
test_compile_inline() click to toggle source
# File ../../../../../test/test_builder.rb, line 72
def test_compile_inline
  text = "abc"
  assert_equal [:text, text], @b.compile_inline(text)
end
test_compile_inline_backslash() click to toggle source
# File ../../../../../test/test_builder.rb, line 87
def test_compile_inline_backslash
  text = "abc\\d\\#a"
  assert_equal [:text, text], @b.compile_inline(text)
end
test_initialize() click to toggle source
# File ../../../../../test/test_builder.rb, line 22
def test_initialize
  assert Builder.new
end
test_inline_ruby() click to toggle source
# File ../../../../../test/test_builder.rb, line 77
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
test_not_implemented_methods() click to toggle source
# File ../../../../../test/test_builder.rb, line 56
def test_not_implemented_methods
  ex = NoMethodError # XXX: OK?
  [
    :list_header, :list_body, :listnum_body,
    :source_header, :source_body,
    :image_image, :image_dummy,
    :table_header, :table_begin, :tr, :th, :table_end,
    :compile_ruby, :compile_kw, :compile_href,
    :bibpaper_header, :bibpaper_bibpaper,
    :inline_hd_chap,
  ].each do |m|
    b = Builder.new
    assert_raises(ex) { b.__send__(m) }
  end
end
test_print_and_puts() click to toggle source
# File ../../../../../test/test_builder.rb, line 46
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
test_result() click to toggle source
# File ../../../../../test/test_builder.rb, line 34
def test_result
  b = Builder.new
  assert_raises(NoMethodError) do # XXX: OK?
    b.result
  end

  b = Builder.new
  chapter = ReVIEW::Book::Chapter.new(ReVIEW::Book::Base.load, nil, '-', nil)
  b.bind(nil, chapter, nil)
  assert_equal '', b.result
end