summaryrefslogtreecommitdiff
path: root/test/pathname
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-28 13:24:42 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-28 13:24:42 +0000
commit4b8f2ed7cc0fb9623ba7582c4576fa37e3620737 (patch)
treebc3be17f175a31459f0be74a305b2f58e01e6411 /test/pathname
parenta5e6532c4b0adacf481f4449e7bd56254d652136 (diff)
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/pathname')
-rw-r--r--test/pathname/test_pathname.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index 5dfd9c6..6add037 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -548,6 +548,20 @@ class TestPathname < Test::Unit::TestCase
assert_equal(false, Pathname.new("a".freeze).freeze.to_s.frozen?)
end
+ def test_freeze_and_taint
+ obj = Pathname.new("a")
+ obj.freeze
+ assert_equal(false, obj.tainted?)
+ assert_raise(RuntimeError) { obj.taint }
+
+ obj = Pathname.new("a")
+ obj.taint
+ assert_equal(true, obj.tainted?)
+ obj.freeze
+ assert_equal(true, obj.tainted?)
+ assert_nothing_raised { obj.taint }
+ end
+
def test_to_s
str = "a"
obj = Pathname.new(str)