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

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
This commit is contained in:
nobu 2015-12-27 02:50:56 +00:00
parent 5a75eabed5
commit 509cfc4c37
2 changed files with 15 additions and 2 deletions

View file

@ -1,7 +1,14 @@
Sun Dec 27 11:50:53 2015 Kuniaki IGARASHI <igaiga@gmail.com>
* 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]
Sun Dec 27 11:47:46 2015 Kuniaki IGARASHI <igaiga@gmail.com> Sun Dec 27 11:47:46 2015 Kuniaki IGARASHI <igaiga@gmail.com>
* test/ruby/test_string.rb (test_insert): The test cases are * test/ruby/test_string.rb (test_insert): Add test for
written in string.c comments as a reference. [Fix GH-1173] String#test_insert. The test cases are written in string.c
comments as a reference. [Fix GH-1173]
Sun Dec 27 11:03:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> Sun Dec 27 11:03:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>

View file

@ -2137,10 +2137,16 @@ class TestString < Test::Unit::TestCase
end end
def test_rstrip def test_rstrip
assert_equal(" hello", " hello ".rstrip)
assert_equal("\u3042", "\u3042 ".rstrip) assert_equal("\u3042", "\u3042 ".rstrip)
assert_raise(Encoding::CompatibilityError) { "\u3042".encode("ISO-2022-JP").rstrip } assert_raise(Encoding::CompatibilityError) { "\u3042".encode("ISO-2022-JP").rstrip }
end end
def test_lstrip
assert_equal("hello ", " hello ".lstrip)
assert_equal("\u3042", " \u3042".lstrip)
end
=begin =begin
def test_symbol_table_overflow def test_symbol_table_overflow
assert_in_out_err([], <<-INPUT, [], /symbol table overflow \(symbol [a-z]{8}\) \(RuntimeError\)/) assert_in_out_err([], <<-INPUT, [], /symbol table overflow \(symbol [a-z]{8}\) \(RuntimeError\)/)