1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2004-04-26 16:27:57 +00:00
parent f63ff3acd5
commit 10b598499b

View file

@ -1141,6 +1141,25 @@ if $0 == __FILE__
assert_equal(true, Pathname.new("a".taint) .to_s.tainted?)
assert_equal(true, Pathname.new("a".taint).taint .tainted?)
assert_equal(true, Pathname.new("a".taint).taint.to_s.tainted?)
str = "a"
path = Pathname.new(str)
str.taint
assert_equal(false, path .tainted?)
assert_equal(false, path.to_s.tainted?)
end
def test_untaint
obj = Pathname.new("a"); assert_same(obj, obj.untaint)
assert_equal(false, Pathname.new("a").taint.untaint .tainted?)
assert_equal(false, Pathname.new("a").taint.untaint.to_s.tainted?)
str = "a".taint
path = Pathname.new(str)
str.untaint
assert_equal(true, path .tainted?)
assert_equal(true, path.to_s.tainted?)
end
def test_freeze
@ -1155,5 +1174,13 @@ if $0 == __FILE__
assert_equal(false, Pathname.new("a" ).freeze.to_s.frozen?)
assert_equal(false, Pathname.new("a".freeze).freeze.to_s.frozen?)
end
def test_to_s
str = "a"
obj = Pathname.new(str)
assert_equal(str, obj.to_s)
assert_not_same(str, obj.to_s)
assert_not_same(obj.to_s, obj.to_s)
end
end
end