summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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 559bc128973..169136f0d9c 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]