summaryrefslogtreecommitdiff
path: root/test/test_set.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-06 11:28:21 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-06 11:28:21 +0000
commit305be780df86d3bd5f1b93848101b477083452ed (patch)
tree55d8ff069c370778bc67b2fd80c48a327d50ef30 /test/test_set.rb
parentf2ff35c83dde349b5b143ca04afb09955760bcaa (diff)
* lib/set.rb (Set#replace): Check if an object given is enumerable
before clearing self. Reported by yui-knk. [GH-675] https://github.com/ruby/ruby/pull/675 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_set.rb')
-rw-r--r--test/test_set.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test_set.rb b/test/test_set.rb
index 169136f..961578b 100644
--- a/test/test_set.rb
+++ b/test/test_set.rb
@@ -98,6 +98,12 @@ class TC_Set < Test::Unit::TestCase
assert_same(set, ret)
assert_equal(Set['a','b','c'], set)
+
+ set = Set[1,2]
+ assert_raise(ArgumentError) {
+ set.replace(3)
+ }
+ assert_equal(Set[1,2], set)
end
def test_to_a