test/test_plaintextbuilder.rb in review-4.1.0 vs test/test_plaintextbuilder.rb in review-4.2.0
- old
+ new
@@ -249,10 +249,21 @@
foo
bar
EOS
assert_equal expected, actual
+
+ @config['caption_position']['list'] = 'bottom'
+ actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
+ expected = <<-EOS
+foo
+bar
+
+リスト1.1 this is test<&>_
+
+EOS
+ assert_equal expected, actual
end
def test_listnum
def @chapter.list(_id)
Book::Index::Item.new('test', 1)
@@ -264,10 +275,21 @@
1: foo
2: bar
EOS
assert_equal expected, actual
+
+ @config['caption_position']['list'] = 'bottom'
+ actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
+ expected = <<-EOS
+ 1: foo
+ 2: bar
+
+リスト1.1 this is test<&>_
+
+EOS
+ assert_equal expected, actual
end
def test_source
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
expected = <<-EOS
@@ -277,10 +299,22 @@
buz
EOS
assert_equal expected, actual
+
+ @config['caption_position']['list'] = 'bottom'
+ actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
+ expected = <<-EOS
+foo
+bar
+
+buz
+foo/bar/test.rb
+
+EOS
+ assert_equal expected, actual
end
def test_source_empty_caption
actual = compile_block("//source[]{\nfoo\nbar\n\nbuz\n//}\n")
expected = <<-EOS
@@ -308,10 +342,20 @@
foo
bar
EOS
assert_equal expected, actual
+
+ @config['caption_position']['list'] = 'bottom'
+ actual = compile_block("//box[FOO]{\nfoo\nbar\n//}\n")
+ expected = <<-EOS
+foo
+bar
+FOO
+
+EOS
+ assert_equal expected, actual
end
def test_cmd
actual = compile_block("//cmd{\nlineA\nlineB\n//}\n")
expected = <<-EOS
@@ -327,10 +371,20 @@
lineA
lineB
EOS
assert_equal expected, actual
+
+ @config['caption_position']['list'] = 'bottom'
+ actual = compile_block("//cmd[cap1]{\nlineA\nlineB\n//}\n")
+ expected = <<-EOS
+lineA
+lineB
+cap1
+
+EOS
+ assert_equal expected, actual
end
def test_emlist
actual = compile_block("//emlist{\nlineA\nlineB\n//}\n")
expected = <<-EOS
@@ -348,10 +402,20 @@
lineA
lineB
EOS
assert_equal expected, actual
+
+ @config['caption_position']['list'] = 'bottom'
+ actual = compile_block("//emlist[cap1]{\nlineA\nlineB\n//}\n")
+ expected = <<-EOS
+lineA
+lineB
+cap1
+
+EOS
+ assert_equal expected, actual
end
def test_emlistnum
actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
expected = <<-EOS
@@ -359,10 +423,20 @@
1: foo
2: bar
EOS
assert_equal expected, actual
+
+ @config['caption_position']['list'] = 'bottom'
+ actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
+ expected = <<-EOS
+ 1: foo
+ 2: bar
+this is test<&>_
+
+EOS
+ assert_equal expected, actual
end
def test_bib
def @chapter.bibpaper(_id)
Book::Index::Item.new('samplebib', 1, 'sample bib')
@@ -387,10 +461,20 @@
aaa\tbbb
ccc\tddd<>&
EOS
assert_equal expected, actual
+
+ @config['caption_position']['table'] = 'bottom'
+ actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
+ expected = <<-EOS
+aaa\tbbb
+ccc\tddd<>&
+
+表1.1 FOO
+EOS
+ assert_equal expected, actual
end
def test_empty_table
e = assert_raises(ReVIEW::ApplicationError) { compile_block "//table{\n//}\n" }
assert_equal ':2: error: no rows in the table', e.message
@@ -519,10 +603,14 @@
item
end
actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
assert_equal %Q(図1.1 sample photo\n\n), actual
+
+ @config['caption_position']['image'] = 'top'
+ 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::Index::Item.new('sampleimg', 1)
@@ -646,9 +734,20 @@
expected = <<-EOS
式1.1
式1.1 The Equivalence of Mass and Energy
e=mc^2
+
+EOS
+ actual = compile_block(src)
+ assert_equal expected, actual
+
+ @config['caption_position']['equation'] = 'bottom'
+ expected = <<-EOS
+式1.1
+
+e=mc^2
+式1.1 The Equivalence of Mass and Energy
EOS
actual = compile_block(src)
assert_equal expected, actual
end