aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-28 06:19:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-28 06:19:11 +0000
commit01c24a2f78cb65c813331a9d590304c4352a4b34 (patch)
tree07f670adc3c8db609fb33978ad1c31c2a01e7a4e /test
parent53635dea12e9459168b45647cf52e26e0f1d451b (diff)
downloadruby-01c24a2f78cb65c813331a9d590304c4352a4b34.tar.gz
* test/ruby/test_string.rb (test_splice!): tests for [ruby-dev:31665].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_string.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 6ed3100f3e..ff9b6f8e70 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1338,4 +1338,12 @@ class TestString < Test::Unit::TestCase
assert_equal(676, count)
end
+ def test_splice!
+ l = S("1234\n234\n34\n4\n")
+ assert_equal(S("1234\n"), l.slice!(/\A.*\n/), "[ruby-dev:31665]")
+ assert_equal(S("234\n"), l.slice!(/\A.*\n/), "[ruby-dev:31665]")
+ assert_equal(S("34\n"), l.slice!(/\A.*\n/), "[ruby-dev:31665]")
+ assert_equal(S("4\n"), l.slice!(/\A.*\n/), "[ruby-dev:31665]")
+ assert_nil(l.slice!(/\A.*\n/), "[ruby-dev:31665]")
+ end
end