2017-11-27 10:45:24 +00:00
|
|
|
# frozen_string_literal: true
|
2019-08-08 23:09:24 +09:00
|
|
|
require_relative 'helper'
|
2010-04-01 07:45:16 +00:00
|
|
|
|
2012-11-27 04:28:14 +00:00
|
|
|
class TestRDocMarkupParagraph < RDoc::TestCase
|
2010-04-01 07:45:16 +00:00
|
|
|
|
2011-06-16 04:59:24 +00:00
|
|
|
def test_accept
|
|
|
|
visitor = Object.new
|
|
|
|
def visitor.accept_paragraph(obj) @obj = obj end
|
|
|
|
def visitor.obj() @obj end
|
|
|
|
|
|
|
|
paragraph = RDoc::Markup::Paragraph.new
|
|
|
|
|
|
|
|
paragraph.accept visitor
|
|
|
|
|
2012-11-27 04:28:14 +00:00
|
|
|
assert_same paragraph, visitor.obj
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_text
|
|
|
|
paragraph = para('hello', ' world')
|
|
|
|
|
|
|
|
assert_equal 'hello world', paragraph.text
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_text_break
|
|
|
|
paragraph = para('hello', hard_break, 'world')
|
|
|
|
|
|
|
|
assert_equal 'helloworld', paragraph.text
|
|
|
|
|
|
|
|
assert_equal "hello\nworld", paragraph.text("\n")
|
2011-06-16 04:59:24 +00:00
|
|
|
end
|
|
|
|
|
2010-04-01 07:45:16 +00:00
|
|
|
end
|
|
|
|
|