1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Import RDoc 3.5.1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-02-02 00:32:30 +00:00
parent 918f625a5e
commit cc2a16d94d
49 changed files with 2119 additions and 273 deletions

View file

@ -134,6 +134,31 @@ The comments associated with
assert_equal expected, strip_hashes(text)
end
def test_strip_hashes_encoding
skip "Encoding not implemented" unless Object.const_defined? :Encoding
text = <<-TEXT
##
# we don't worry too much.
#
# The comments associated with
TEXT
text.force_encoding Encoding::CP852
expected = <<-EXPECTED
we don't worry too much.
The comments associated with
EXPECTED
stripped = strip_hashes text
assert_equal expected, stripped
assert_equal Encoding::CP852, stripped.encoding
end
def test_strip_newlines
assert_equal ' ', strip_newlines("\n \n")
@ -144,6 +169,21 @@ The comments associated with
assert_equal 'hi', strip_newlines("\n\nhi\n\n")
end
def test_strip_newlines_encoding
skip "Encoding not implemented" unless Object.const_defined? :Encoding
assert_equal Encoding::UTF_8, ''.encoding, 'Encoding sanity check'
text = " \n"
text.force_encoding Encoding::US_ASCII
stripped = strip_newlines text
assert_equal ' ', stripped
assert_equal Encoding::US_ASCII, stripped.encoding
end
def test_strip_stars
text = <<-TEXT
/*
@ -163,6 +203,30 @@ The comments associated with
assert_equal expected, strip_stars(text)
end
def test_strip_stars_encoding
skip "Encoding not implemented" unless Object.const_defined? :Encoding
text = <<-TEXT
/*
* * we don't worry too much.
*
* The comments associated with
*/
TEXT
text.force_encoding Encoding::CP852
expected = <<-EXPECTED
* we don't worry too much.
The comments associated with
EXPECTED
assert_equal expected, strip_stars(text)
assert_equal Encoding::CP852, text.encoding
end
def test_to_html_apostrophe
assert_equal 'a', to_html("'a")
assert_equal 'a', to_html("a'")