summaryrefslogtreecommitdiff
path: root/test/test_set.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-19 02:22:11 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-19 02:22:11 +0000
commitad78cf4ea8613c7e1790c5e3a2718a35fe32115f (patch)
tree3d1c8d8aad3a4600c911afb6b05484ba1d556aa8 /test/test_set.rb
parent74201103a9bda8488672c8e7e5f413d4611e356b (diff)
Define Set#to_set so that aSet.to_set returns self.
* lib/set.rb (Set#to_set): Define Set#to_set so that aSet.to_set returns self. [Fixes GH-359] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_set.rb')
-rw-r--r--test/test_set.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/test_set.rb b/test/test_set.rb
index 26950c3..cbf4eb0 100644
--- a/test/test_set.rb
+++ b/test/test_set.rb
@@ -625,6 +625,9 @@ class TC_Enumerable < Test::Unit::TestCase
assert_instance_of(Set, set)
assert_equal([-10,-8,-6,-4,-2], set.sort)
+ assert_same set, set.to_set
+ assert_not_same set, set.to_set { |o| o }
+
set = ary.to_set(SortedSet)
assert_instance_of(SortedSet, set)
assert_equal([1,2,3,4,5], set.to_a)