Skip to content

Commit

Permalink
tests for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuto committed Dec 31, 2016
1 parent 770896e commit 1246da3
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 7 deletions.
21 changes: 21 additions & 0 deletions test/test_htmlbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1464,4 +1464,25 @@ def test_major_blocks
assert_equal expected, actual
end

def test_comment
actual = compile_block("//comment[コメント]")
assert_equal %Q||, actual
end

def test_comment_for_draft
@config["draft"] = true
actual = compile_block("//comment[コメント]")
assert_equal %Q|<div class="draft-comment">コメント</div>\n|, actual
end

def test_inline_comment
actual = compile_inline("test @<comment>{コメント} test2")
assert_equal %Q|test test2|, actual
end

def test_inline_comment_for_draft
@config["draft"] = true
actual = compile_inline("test @<comment>{コメント} test2")
assert_equal %Q|test <span class="draft-comment">コメント</span> test2|, actual
end
end
21 changes: 21 additions & 0 deletions test/test_idgxmlbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -676,4 +676,25 @@ def test_block_raw4
assert_equal expected.chomp, actual
end

def test_comment
actual = compile_block("//comment[コメント]")
assert_equal %Q||, actual
end

def test_comment_for_draft
@config["draft"] = true
actual = compile_block("//comment[コメント]")
assert_equal %Q|<msg>コメント</msg>|, actual
end

def test_inline_comment
actual = compile_inline("test @<comment>{コメント} test2")
assert_equal %Q|test test2|, actual
end

def test_inline_comment_for_draft
@config["draft"] = true
actual = compile_inline("test @<comment>{コメント} test2")
assert_equal %Q|test <msg>コメント</msg> test2|, actual
end
end
21 changes: 21 additions & 0 deletions test/test_latexbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -873,4 +873,25 @@ def test_block_raw4
assert_equal expected, actual
end

def test_comment
actual = compile_block("//comment[コメント]")
assert_equal %Q||, actual
end

def test_comment_for_draft
@config["draft"] = true
actual = compile_block("//comment[コメント]")
assert_equal %Q|\\pdfcomment{コメント}\n|, actual
end

def test_inline_comment
actual = compile_inline("test @<comment>{コメント} test2")
assert_equal %Q|test test2|, actual
end

def test_inline_comment_for_draft
@config["draft"] = true
actual = compile_inline("test @<comment>{コメント} test2")
assert_equal %Q|test \\pdfcomment{コメント} test2|, actual
end
end
23 changes: 22 additions & 1 deletion test/test_markdownbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ def test_ul
assert_equal expected, actual
end

def test_inline_comment
actual = compile_inline("test @<comment>{コメント} test2")
assert_equal %Q|test test2|, actual
end

def test_inline_comment_for_draft
@config["draft"] = true
actual = compile_inline("test @<comment>{コメント} test2")
assert_equal %Q|test <span class="red">コメント</span> test2|, actual
end

def test_ul_nest1
src =<<-EOS
* AAA
Expand All @@ -62,7 +73,6 @@ def test_cmd
assert_equal "```shell-session\nlineA\nlineB\n```\n", actual
end


def test_dlist
actual = compile_block(": foo\n foo.\n bar.\n")
assert_equal %Q|<dl>\n<dt>foo</dt>\n<dd>foo.bar.</dd>\n</dl>\n|, actual
Expand All @@ -79,6 +89,17 @@ def test_dlist_with_comment
assert_equal %Q|<dl>\n<dt>title</dt>\n<dd>body</dd>\n<dt>title2</dt>\n<dd>body2</dd>\n</dl>\n|, actual
end

def test_comment
actual = compile_block("//comment[コメント]")
assert_equal %Q||, actual
end

def test_comment_for_draft
@config["draft"] = true
actual = compile_block("//comment[コメント]")
assert_equal %Q|<div class="red">コメント</div>\n|, actual
end

def test_list
actual = compile_block(<<-EOS)
//list[name][caption]{
Expand Down
5 changes: 0 additions & 5 deletions test/test_md2inaobuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ def test_list
EOS
end

def test_comment
actual = compile_block("//comment{\nHello, world!\n//}\n")
assert_equal "<span class=\"red\">\nHello, world!\n</span>\n", actual
end

def test_ruby_mono
actual = compile_block("@<ruby>{謳,うた}い文句")
assert_equal " <span class='monoruby'>謳(うた)</span>い文句\n\n", actual
Expand Down
13 changes: 12 additions & 1 deletion test/test_topbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def test_inline_comment
def test_inline_comment_for_draft
@config["draft"] = true
actual = compile_inline("test @<comment>{コメント} test2")
assert_equal %Q|test ◆→DTP連絡:コメント←◆ test2|, actual
assert_equal %Q|test ◆→コメント←◆ test2|, actual
end

def test_inline_in_table
Expand Down Expand Up @@ -170,6 +170,17 @@ def test_noindent
assert_equal %Q|◆→DTP連絡:次の1行インデントなし←◆\nfoobar\nfoo2bar2\n|, actual
end

def test_comment
actual = compile_block("//comment[コメント]")
assert_equal %Q||, actual
end

def test_comment_for_draft
@config["draft"] = true
actual = compile_block("//comment[コメント]")
assert_equal %Q|◆→コメント←◆\n|, actual
end

def test_list
def @chapter.list(id)
Book::ListIndex::Item.new("test",1)
Expand Down

0 comments on commit 1246da3

Please sign in to comment.