test/test_topbuilder.rb in review-3.2.0 vs test/test_topbuilder.rb in review-4.0.0
- old
+ new
@@ -175,15 +175,23 @@
end
def test_paragraph
actual = compile_block("foo\nbar\n")
assert_equal %Q(foobar\n), actual
+
+ @book.config['join_lines_by_lang'] = true
+ actual = compile_block("foo\nbar\n")
+ assert_equal %Q(foo bar\n), actual
end
def test_tabbed_paragraph
actual = compile_block("\tfoo\nbar\n")
assert_equal %Q(\tfoobar\n), actual
+
+ @book.config['join_lines_by_lang'] = true
+ actual = compile_block("\tfoo\nbar\n")
+ assert_equal %Q(\tfoo bar\n), actual
end
def test_flushright
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
expected = <<-EOS
@@ -192,10 +200,21 @@
buz
◆→終了:右寄せ←◆
EOS
assert_equal expected, actual
+
+ @book.config['join_lines_by_lang'] = true
+ actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
+ expected = <<-EOS
+◆→開始:右寄せ←◆
+foo bar
+buz
+◆→終了:右寄せ←◆
+
+EOS
+ assert_equal expected, actual
end
def test_blankline
actual = compile_block("//blankline\nfoo\n")
assert_equal %Q(\nfoo\n), actual
@@ -207,10 +226,19 @@
◆→DTP連絡:次の1行インデントなし←◆
foobar
foo2bar2
EOS
assert_equal expected, actual
+
+ @book.config['join_lines_by_lang'] = true
+ actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
+ expected = <<-EOS
+◆→DTP連絡:次の1行インデントなし←◆
+foo bar
+foo2 bar2
+EOS
+ assert_equal expected, actual
end
def test_comment
actual = compile_block('//comment[コメント]')
assert_equal '', actual
@@ -224,11 +252,11 @@
assert_equal %Q(◆→A<>\nB&←◆\n), actual
end
def test_list
def @chapter.list(_id)
- Book::ListIndex::Item.new('test', 1)
+ Book::Index::Item.new('test', 1)
end
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
expected = <<-EOS
◆→開始:リスト←◆
リスト1.1 this is ★test☆<&>_
@@ -241,11 +269,11 @@
assert_equal expected, actual
end
def test_listnum
def @chapter.list(_id)
- Book::ListIndex::Item.new('test', 1)
+ Book::Index::Item.new('test', 1)
end
actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
expected = <<-EOS
◆→開始:リスト←◆
リスト1.1 this is ★test☆<&>_
@@ -371,11 +399,11 @@
assert_equal expected, actual
end
def test_bib
def @chapter.bibpaper(_id)
- Book::BibpaperIndex::Item.new('samplebib', 1, 'sample bib')
+ Book::Index::Item.new('samplebib', 1, 'sample bib')
end
assert_equal '[1]', compile_inline('@<bib>{samplebib}')
end
@@ -411,11 +439,11 @@
assert_equal ':3: error: no rows in the table', e.message
end
def test_inline_table
def @chapter.table(_id)
- Book::TableIndex::Item.new('sampletable', 1)
+ Book::Index::Item.new('sampletable', 1)
end
actual = compile_block("@<table>{sampletest}\n")
assert_equal "表1.1\n", actual
end
@@ -560,11 +588,11 @@
assert_equal expected, actual
end
def test_image
def @chapter.image(_id)
- item = Book::ImageIndex::Item.new('sampleimg', 1)
+ item = Book::Index::Item.new('sampleimg', 1)
item.instance_eval { @path = './images/chap1-sampleimg.png' }
item
end
actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
@@ -579,11 +607,11 @@
assert_equal expected, actual
end
def test_image_with_metric
def @chapter.image(_id)
- item = Book::ImageIndex::Item.new('sampleimg', 1)
+ item = Book::Index::Item.new('sampleimg', 1)
item.instance_eval { @path = './images/chap1-sampleimg.png' }
item
end
actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\nfoo\n//}\n")
@@ -622,10 +650,10 @@
io = StringIO.new
@builder.instance_eval{ @logger = ReVIEW::Logger.new(io) }
actual = compile_block('@<w>{F} @<w>{B} @<wb>{B} @<w>{N}')
assert_equal %Q(foo bar"\\<>_@<b>{BAZ} ★bar"\\<>_@<b>{BAZ}☆ [missing word: N]\n), actual
- assert_match(/WARN -- : :1: word not bound: N/, io.string)
+ assert_match(/WARN --: :1: word not bound: N/, io.string)
end
end
def test_inline_unknown
e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<img>{n}\n" }