summaryrefslogtreecommitdiff
path: root/test/test_set.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-06 10:13:34 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-06 10:13:34 +0000
commit3766aa4cc574d9d5d49af7a126c8a2f2876b5ad2 (patch)
treeee9603666869cd3606420090dc24b9dee301b5e0 /test/test_set.rb
parent4d5fceb08681e77570dd66f7fbc483ec853a2d47 (diff)
Implement Set#clone. [Fixes GH-661]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_set.rb')
-rw-r--r--test/test_set.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_set.rb b/test/test_set.rb
index 559bc12..169136f 100644
--- a/test/test_set.rb
+++ b/test/test_set.rb
@@ -585,6 +585,28 @@ class TC_Set < Test::Unit::TestCase
assert_equal 4, set.size
end
+ def test_freeze_dup
+ set1 = Set[1,2,3]
+ set1.freeze
+ set2 = set1.dup
+
+ assert_not_predicate set2, :frozen?
+ assert_nothing_raised {
+ set2.add 4
+ }
+ end
+
+ def test_freeze_clone
+ set1 = Set[1,2,3]
+ set1.freeze
+ set2 = set1.clone
+
+ assert_predicate set2, :frozen?
+ assert_raise(RuntimeError) {
+ set2.add 5
+ }
+ end
+
def test_inspect
set1 = Set[1]