[前][次][番号順一覧][スレッド一覧]

ruby-changes:24800

From: luislavena <ko1@a...>
Date: Thu, 30 Aug 2012 07:45:40 +0900 (JST)
Subject: [ruby-changes:24800] luislavena:r36850 (trunk): test/ruby/test_file_exhaustive.rb: fix test for HOME-less envs

luislavena	2012-08-30 07:45:24 +0900 (Thu, 30 Aug 2012)

  New Revision: 36850

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36850

  Log:
    test/ruby/test_file_exhaustive.rb: fix test for HOME-less envs
    
    * test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for
      posix environments where HOME is not defined.  [ruby-core:47322]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_file_exhaustive.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36849)
+++ ChangeLog	(revision 36850)
@@ -1,3 +1,8 @@
+Thu Aug 30 07:45:12 2012  Luis Lavena  <luislavena@g...>
+
+	* test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for
+	  posix environments where HOME is not defined.  [ruby-core:47322]
+
 Wed Aug 29 23:42:59 2012  Tanaka Akira  <akr@f...>
 
 	* internal.h (rb_last_status_clear): declared.
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 36849)
+++ test/ruby/test_file_exhaustive.rb	(revision 36850)
@@ -461,12 +461,17 @@
   end
 
   def test_expand_path_encoding_filesystem
+    home = ENV["HOME"]
+    ENV["HOME"] = "#{DRIVE}/UserHome"
+
     path = "~".encode("US-ASCII")
     dir = "C:/".encode("IBM437")
     fs = Encoding.find("filesystem")
 
     assert_equal fs, File.expand_path(path).encoding
     assert_equal fs, File.expand_path(path, dir).encoding
+  ensure
+    ENV["HOME"] = home
   end
 
   def test_expand_path_home
@@ -595,7 +600,7 @@
     assert_equal(true, File.expand_path('foo', 'bar').tainted?)
     assert_equal(true, File.expand_path('foo', '/bar'.taint).tainted?)
     assert_equal(true, File.expand_path('foo'.taint, '/bar').tainted?)
-    assert_equal(true, File.expand_path('~').tainted?)
+    assert_equal(true, File.expand_path('~').tainted?) if ENV["HOME"]
 
     if DRIVE
       assert_equal(true, File.expand_path('/foo').tainted?)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]