test/test_topbuilder.rb in review-1.0.0 vs test/test_topbuilder.rb in review-1.1.0
- old
+ new
@@ -2,10 +2,11 @@
require 'test_helper'
require 'review/compiler'
require 'review/book'
require 'review/topbuilder'
+require 'review/i18n'
class TOPBuidlerTest < Test::Unit::TestCase
include ReVIEW
def setup
@@ -16,11 +17,11 @@
"outencoding" => "UTF-8",
"subdirmode" => nil,
}
ReVIEW.book.param = @param
@compiler = ReVIEW::Compiler.new(@builder)
- @chapter = Chapter.new(nil, 1, '-', nil, StringIO.new)
+ @chapter = Book::Chapter.new(nil, 1, '-', nil, StringIO.new)
location = Location.new(nil, nil)
@builder.bind(@compiler, @chapter, location)
@builder.instance_eval do
# to ignore lineno in original method
@@ -126,19 +127,19 @@
assert_equal %Q|◆→DTP連絡:次の1行インデントなし←◆\nfoobar\nfoo2bar2\n|, @builder.raw_result
end
def test_list
def @chapter.list(id)
- ListIndex::Item.new("test",1)
+ Book::ListIndex::Item.new("test",1)
end
@builder.list(["foo", "bar"], "test", "this is @<b>{test}<&>_")
assert_equal %Q|◆→開始:リスト←◆\nリスト1.1 this is ★test☆<&>_\n\nfoo\nbar\n◆→終了:リスト←◆\n\n|, @builder.raw_result
end
def test_listnum
def @chapter.list(id)
- ListIndex::Item.new("test",1)
+ Book::ListIndex::Item.new("test",1)
end
@builder.listnum(["foo", "bar"], "test", "this is @<b>{test}<&>_")
assert_equal %Q|◆→開始:リスト←◆\nリスト1.1 this is ★test☆<&>_\n\n 1: foo\n 2: bar\n◆→終了:リスト←◆\n\n|, @builder.raw_result
end
@@ -147,22 +148,22 @@
assert_equal %Q|◆→開始:インラインリスト←◆\n■this is ★test☆<&>_\n 1: foo\n 2: bar\n◆→終了:インラインリスト←◆\n\n|, @builder.raw_result
end
def test_image
def @chapter.image(id)
- item = ImageIndex::Item.new("sampleimg",1)
+ item = Book::ImageIndex::Item.new("sampleimg",1)
item.instance_eval{@pathes=["./images/chap1-sampleimg.png"]}
item
end
@builder.image(["foo"], "sampleimg","sample photo",nil)
assert_equal %Q|◆→開始:図←◆\n図1.1 sample photo\n\n◆→./images/chap1-sampleimg.png←◆\n◆→終了:図←◆\n\n|, @builder.raw_result
end
def test_image_with_metric
def @chapter.image(id)
- item = ImageIndex::Item.new("sampleimg",1)
+ item = Book::ImageIndex::Item.new("sampleimg",1)
item.instance_eval{@pathes=["./images/chap1-sampleimg.png"]}
item
end
@builder.image(["foo"], "sampleimg","sample photo","scale=1.2")
@@ -199,11 +200,10 @@
end
def test_block_raw0
@builder.raw("<>!\"\\n& ")
expect =<<-EOS
-It is recommended to set builder(s).
<>!"
&
EOS
assert_equal expect.chomp, @builder.raw_result
end
@@ -234,10 +234,9 @@
end
def test_block_raw4
@builder.raw("|top <>!\"\\n& ")
expect =<<-EOS
-It is recommended to set builder(s).
|top <>!\"
&
EOS
assert_equal expect.chomp, @builder.raw_result
end