summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_text.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-02 00:32:30 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-02 00:32:30 +0000
commitcc2a16d94d744d14d4a5eb06eca22137f8a9b79e (patch)
tree2907a20e2d9ae3a2831707056bb3fe2d384b066d /test/rdoc/test_rdoc_text.rb
parent918f625a5eeba35b9b191cb39c1d634b4cc7efee (diff)
Import RDoc 3.5.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_text.rb')
-rw-r--r--test/rdoc/test_rdoc_text.rb64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_text.rb b/test/rdoc/test_rdoc_text.rb
index 600de30b0b..ebc92dc1a5 100644
--- a/test/rdoc/test_rdoc_text.rb
+++ b/test/rdoc/test_rdoc_text.rb
@@ -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'")