diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-26 16:27:57 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-26 16:27:57 +0000 |
commit | 10b598499b61d2c95a417f145e4cc70d96aeee71 (patch) | |
tree | eb66dd1d24ccc631f41653510976e7a1b5db18a6 /lib | |
parent | f63ff3acd5f2113c325e56796aee7ecac07f2140 (diff) | |
download | ruby-10b598499b61d2c95a417f145e4cc70d96aeee71.tar.gz |
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pathname.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/pathname.rb b/lib/pathname.rb index 118666b194..423b8a0689 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -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 |