summaryrefslogtreecommitdiff
path: root/test/test_set.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-01 09:01:16 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-01 09:01:16 +0000
commit6bdfe415df2ef15487ba932762c028640b8ff71a (patch)
tree7b97e0a7804c57c23191d7bf3d708e2aee1df6ab /test/test_set.rb
parent4a223fb67f31a1a85a0b4fb019a1106532a541ce (diff)
* lib/set.rb (Set#freeze, taint, untaint): Save a "self" by
utilizing super returning self, and add tests while at it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_set.rb')
-rw-r--r--test/test_set.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_set.rb b/test/test_set.rb
index 9041182..26950c3 100644
--- a/test/test_set.rb
+++ b/test/test_set.rb
@@ -528,6 +528,27 @@ class TC_Set < Test::Unit::TestCase
}
end
+ def test_taintness
+ orig = set = Set[1,2,3]
+ assert_equal false, set.tainted?
+ assert_same orig, set.taint
+ assert_equal true, set.tainted?
+ assert_same orig, set.untaint
+ assert_equal false, set.tainted?
+ end
+
+ def test_freeze
+ orig = set = Set[1,2,3]
+ assert_equal false, set.frozen?
+ set << 4
+ assert_same orig, set.freeze
+ assert_equal true, set.frozen?
+ assert_raises(RuntimeError) {
+ set << 5
+ }
+ assert_equal 4, set.size
+ end
+
def test_inspect
set1 = Set[1]