You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.7 KiB
80 lines
2.7 KiB
13 years ago
|
diff -Naur jruby-1.2.0.orig/test/externals/ruby_test/test/core/File/class/tc_ftype.rb jruby-1.2.0/test/externals/ruby_test/test/core/File/class/tc_ftype.rb
|
||
|
--- jruby-1.2.0.orig/test/externals/ruby_test/test/core/File/class/tc_ftype.rb 2009-04-26 12:01:41.912584566 +0100
|
||
|
+++ jruby-1.2.0/test/externals/ruby_test/test/core/File/class/tc_ftype.rb 2009-04-26 12:03:56.000210377 +0100
|
||
|
@@ -26,28 +26,13 @@
|
||
|
else
|
||
|
@char = Pathname.new('/dev/null').realpath
|
||
|
@fifo = "test_fifo"
|
||
|
+ @link = "test_link"
|
||
|
|
||
|
system("mkfifo #{@fifo}")
|
||
|
+ system("ln -snf . #{@link}")
|
||
|
|
||
|
- if File.exists?("/dev/fd0")
|
||
|
- @block = Pathname.new("/dev/fd0").realpath
|
||
|
- @link = "/dev/fd0" if File.symlink?("/dev/fd0")
|
||
|
- elsif File.exists?("/dev/diskette")
|
||
|
- @block = Pathname.new("/dev/diskette").realpath
|
||
|
- @link = "/dev/diskette" if File.symlink?("/dev/diskette")
|
||
|
- elsif File.exists?("/dev/cdrom")
|
||
|
- @block = Pathname.new("/dev/cdrom").realpath
|
||
|
- @link = "/dev/cdrom" if File.symlink?("/dev/cdrom")
|
||
|
- elsif File.exists?("/dev/sr0") # CDROM
|
||
|
- @block = Pathname.new("/dev/sr0").realpath
|
||
|
- @link = "/dev/sr0" if File.symlink?("/dev/sr0")
|
||
|
- elsif File.exists?("/dev/disk0")
|
||
|
- @block = "/dev/disk0"
|
||
|
- @link = "/tmp"
|
||
|
- else
|
||
|
- @block = nil
|
||
|
- @link = nil
|
||
|
- end
|
||
|
+ @block = %w( /dev/fd0 /dev/diskette /dev/cdrom /dev/sr0 /dev/disk0 ).find { |dev| File.exists?(dev) }
|
||
|
+ @block = Pathname.new(@block).realpath if @block
|
||
|
end
|
||
|
end
|
||
|
|
||
|
@@ -66,22 +51,21 @@
|
||
|
end
|
||
|
|
||
|
# TODO: Find appropriate tests for MS Windows
|
||
|
- unless WINDOWS
|
||
|
- def test_ftype_char
|
||
|
- assert_equal('characterSpecial', File.ftype(@char))
|
||
|
- end
|
||
|
+
|
||
|
+ def test_ftype_char
|
||
|
+ assert_equal('characterSpecial', File.ftype(@char)) if @char
|
||
|
+ end
|
||
|
|
||
|
- def test_ftype_block
|
||
|
- assert_equal('blockSpecial', File.ftype(@block), "BLOCK WAS: #{@block}")
|
||
|
- end
|
||
|
+ def test_ftype_block
|
||
|
+ assert_equal('blockSpecial', File.ftype(@block), "BLOCK WAS: #{@block}") if @block
|
||
|
+ end
|
||
|
|
||
|
- def test_ftype_link
|
||
|
- assert_equal('link', File.ftype(@link))
|
||
|
- end
|
||
|
+ def test_ftype_link
|
||
|
+ assert_equal('link', File.ftype(@link)) if @link
|
||
|
+ end
|
||
|
|
||
|
- def test_ftype_fifo
|
||
|
- assert_equal('fifo', File.ftype(@fifo))
|
||
|
- end
|
||
|
+ def test_ftype_fifo
|
||
|
+ assert_equal('fifo', File.ftype(@fifo)) if @fifo
|
||
|
end
|
||
|
|
||
|
def test_ftype_expected_errors
|
||
|
@@ -91,6 +75,7 @@
|
||
|
|
||
|
def teardown
|
||
|
remove_file(@fifo)
|
||
|
+ remove_file(@link)
|
||
|
|
||
|
@file = nil
|
||
|
@dir = nil
|