test/test_plaintextbuilder.rb in review-5.4.0 vs test/test_plaintextbuilder.rb in review-5.5.0
- old
+ new
@@ -65,9 +65,34 @@
def test_href_without_label
actual = compile_inline('@<href>{http://github.com}')
assert_equal 'http://github.com', actual
end
+ def test_inline_sec
+ def @chapter.headline_index
+ item = Book::Index::Item.new('chap1|test', [1, 1], 'te_st<>')
+ idx = Book::HeadlineIndex.new(self)
+ idx.add_item(item)
+ idx
+ end
+
+ @config['secnolevel'] = 3
+ actual = compile_inline('test @<secref>{test}')
+ assert_equal 'test γ1.1.1 te_st<>γ', actual
+ actual = compile_inline('test @<sectitle>{test}')
+ assert_equal 'test te_st<>', actual
+ actual = compile_inline('test @<sec>{test}')
+ assert_equal 'test 1.1.1', actual
+
+ @config['secnolevel'] = 2
+ actual = compile_inline('test @<secref>{test}')
+ assert_equal 'test γte_st<>γ', actual
+ actual = compile_inline('test @<sectitle>{test}')
+ assert_equal 'test te_st<>', actual
+ assert_raises(ReVIEW::ApplicationError) { compile_block('test @<sec>{test}') }
+ assert_match(/the target headline doesn't have a number/, @log_io.string)
+ end
+
def test_inline_raw
actual = compile_inline('@<raw>{@<tt>{inline\}}')
assert_equal '@<tt>{inline}', actual
end