summaryrefslogtreecommitdiff
path: root/lib/pathname.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-26 16:27:57 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-26 16:27:57 +0000
commitd53e34bbfaaefe3ee4da8eded605c0fab22d7736 (patch)
treea3eca5116f987f41db3d31fcd98bbbe80d229a76 /lib/pathname.rb
parent551599984b256b0d265d94f81543da61fbfdb465 (diff)
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/pathname.rb')
-rw-r--r--lib/pathname.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/pathname.rb b/lib/pathname.rb
index 15cc54baaa..889bbf0fc1 100644
--- a/lib/pathname.rb
+++ b/lib/pathname.rb
@@ -1129,6 +1129,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
@@ -1143,5 +1162,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