summaryrefslogtreecommitdiff
path: root/test/test_set.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-14 08:46:13 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-14 08:46:13 +0000
commitd893c123f6b021254b21c920e182d3c64967f5d5 (patch)
treecbe2114647b561febd6ceaa59adc39ec0923c45f /test/test_set.rb
parentcb1d634d6acd6a7171c146115e9d44bc9e55e3b6 (diff)
Alias Set#to_s to #inspect [ruby-core:81753] [Feature #13676]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_set.rb')
-rw-r--r--test/test_set.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_set.rb b/test/test_set.rb
index 5774af741e1..aaf3bfe3b85 100644
--- a/test/test_set.rb
+++ b/test/test_set.rb
@@ -715,6 +715,17 @@ class TC_Set < Test::Unit::TestCase
assert_equal('#<Set: {#<Set: {0}>, 1, 2, #<Set: {1, 2, #<Set: {...}>}>}>', set2.inspect)
end
+ def test_to_s
+ set1 = Set[1, 2]
+ assert_equal('#<Set: {1, 2}>', set1.to_s)
+
+ set2 = Set[Set[0], 1, 2, set1]
+ assert_equal('#<Set: {#<Set: {0}>, 1, 2, #<Set: {1, 2}>}>', set2.to_s)
+
+ set1.add(set2)
+ assert_equal('#<Set: {#<Set: {0}>, 1, 2, #<Set: {1, 2, #<Set: {...}>}>}>', set2.to_s)
+ end
+
def test_compare_by_identity
a1, a2 = "a", "a"
b1, b2 = "b", "b"