test/test_latexbuilder.rb in review-5.4.0 vs test/test_latexbuilder.rb in review-5.5.0
- old
+ new
@@ -286,9 +286,43 @@
@config['chapterlink'] = nil
actual = compile_inline('test @<hd>{chap1|test} test2')
assert_equal 'test 「1.1.1 te\\textunderscore{}st」 test2', 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 \reviewsecref{「1.1.1 te\textunderscore{}st\textless{}\textgreater{}」}{sec:1-1-1}', actual
+ actual = compile_inline('test @<sectitle>{test}')
+ assert_equal 'test \reviewsecref{te\textunderscore{}st\textless{}\textgreater{}}{sec:1-1-1}', actual
+ actual = compile_inline('test @<sec>{test}')
+ assert_equal 'test \reviewsecref{1.1.1}{sec:1-1-1}', actual
+
+ @config['secnolevel'] = 2
+ actual = compile_inline('test @<secref>{test}')
+ assert_equal 'test \reviewsecref{「te\textunderscore{}st\textless{}\textgreater{}」}{sec:1-1-1}', actual
+ actual = compile_inline('test @<sectitle>{test}')
+ assert_equal 'test \reviewsecref{te\textunderscore{}st\textless{}\textgreater{}}{sec:1-1-1}', actual
+ assert_raises(ReVIEW::ApplicationError) { compile_block('test @<sec>{test}') }
+ assert_match(/the target headline doesn't have a number/, @log_io.string)
+
+ @config['chapterlink'] = nil
+ @config['secnolevel'] = 3
+ actual = compile_inline('test @<secref>{test}')
+ assert_equal 'test 「1.1.1 te\textunderscore{}st\textless{}\textgreater{}」', actual
+ actual = compile_inline('test @<sectitle>{test}')
+ assert_equal 'test te\textunderscore{}st\textless{}\textgreater{}', actual
+ actual = compile_inline('test @<sec>{test}')
+ assert_equal 'test 1.1.1', actual
+ end
+
def test_inline_pageref
actual = compile_inline('test p.@<pageref>{p1}')
assert_equal 'test p.\pageref{p1}', actual
end