aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-27 02:50:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-27 02:50:56 +0000
commit509cfc4c37f40e195b6c5c1f9a549cec14e00a8b (patch)
treec4c16eefafb026dc7589f423984822d98408d17c /test/ruby/test_string.rb
parent5a75eabed5d82d6430755bdc993fe5b3c467fd31 (diff)
downloadruby-509cfc4c37f40e195b6c5c1f9a549cec14e00a8b.tar.gz
Add tests for String#lstrip and rstrip
* test/ruby/test_string.rb (test_rstrip, test_lstrip): Add tests for String#lstrip and rstrip. The test cases are used from string.c ruby-doc comments. [Fix GH-1174] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index f907a28f99..96137e3de9 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -2137,10 +2137,16 @@ class TestString < Test::Unit::TestCase
end
def test_rstrip
+ assert_equal(" hello", " hello ".rstrip)
assert_equal("\u3042", "\u3042 ".rstrip)
assert_raise(Encoding::CompatibilityError) { "\u3042".encode("ISO-2022-JP").rstrip }
end
+ def test_lstrip
+ assert_equal("hello ", " hello ".lstrip)
+ assert_equal("\u3042", " \u3042".lstrip)
+ end
+
=begin
def test_symbol_table_overflow
assert_in_out_err([], <<-INPUT, [], /symbol table overflow \(symbol [a-z]{8}\) \(RuntimeError\)/)