summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorshirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-09 11:34:48 +0000
committershirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-09 11:34:48 +0000
commitdcd7f09be26dd85247f58354709e50e97b9c2291 (patch)
treefefdff489cb0a44a37bba46faae249fc802dfed0 /test/ruby
parent0e92dc4b729970112e8205fa1dd55b17af38d27a (diff)
Optimize winnt_stat
* test/ruby/test_file_exhaustive.rb (TestFileExhaustive#test_stat_special_file): add a test. GetFileAttributesExW fails to get attributes of special files such as pagefile.sys. * win32/win32.c (check_valid_dir): for performance, check the path by FindFirstFileW only if the path containts "..." * win32/win32.c (winnt_stat): use GetFileAttributesExW instead of FindFirstFileW since GetFileAttributesExW is faster. Based on the patch by Dusan D. Majkic. [ruby-core:47083] [Feature #6845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_file_exhaustive.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index de17d7ee39..434c93c7e2 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -819,6 +819,13 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_equal(0, File::Stat.new(@zerofile).size)
end
+ def test_stat_special_file
+ # test for special files such as pagefile.sys on Windows
+ assert_nothing_raised do
+ Dir::glob("C:/*.sys") {|f| File::Stat.new(f) }
+ end
+ end if DRIVE
+
def test_path_check
assert_nothing_raised { ENV["PATH"] }
end