test/test_plaintextbuilder.rb in review-3.2.0 vs test/test_plaintextbuilder.rb in review-4.0.0
- old
+ new
@@ -174,34 +174,59 @@
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
foobar
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_noindent
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
expected = <<-EOS
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
+foo bar
+foo2 bar2
+EOS
+ assert_equal expected, actual
end
def test_comment
actual = compile_block('//comment[コメント]')
assert_equal '', actual
@@ -213,11 +238,11 @@
assert_equal '', 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<&>_
@@ -228,11 +253,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<&>_
@@ -338,11 +363,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
@@ -374,11 +399,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
@@ -487,21 +512,21 @@
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")
assert_equal %Q(図1.1 sample photo\n\n), 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")