mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_file_exhaustive.rb: Test named pipe.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1a688f001c
commit
dec7415126
2 changed files with 28 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Apr 10 19:31:56 2015 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/ruby/test_file_exhaustive.rb: Test named pipe.
|
||||
|
||||
Fri Apr 10 19:10:34 2015 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* ext/objspace/objspace.c (setup_hash): unify common routine.
|
||||
|
|
|
@ -45,6 +45,13 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||
open(file, "w") {|fh| fh << content }
|
||||
end
|
||||
|
||||
if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM
|
||||
def make_fifo(file)
|
||||
system("mkfifo", file)
|
||||
assert $?.success?, "mkfifo fails"
|
||||
end
|
||||
end
|
||||
|
||||
def make_tmp_filename(prefix)
|
||||
"#{@dir}/#{prefix}#{File.basename(__FILE__)}.#{$$}.test"
|
||||
end
|
||||
|
@ -141,10 +148,15 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||
assert_file.not_directory?(@nofile)
|
||||
end
|
||||
|
||||
def test_pipe_p ## xxx
|
||||
def test_pipe_p
|
||||
assert_file.not_pipe?(@dir)
|
||||
assert_file.not_pipe?(@file)
|
||||
assert_file.not_pipe?(@nofile)
|
||||
if self.respond_to? :make_fifo
|
||||
fifo = make_tmp_filename("fifo")
|
||||
make_fifo fifo
|
||||
assert_file.pipe?(fifo)
|
||||
end
|
||||
end
|
||||
|
||||
def test_symlink_p
|
||||
|
@ -979,7 +991,11 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||
def test_test
|
||||
sleep(@time - Time.now + 1.1)
|
||||
make_file("foo", @file + "2")
|
||||
[@dir, @file, @zerofile, @symlinkfile, @hardlinkfile].compact.each do |f|
|
||||
if self.respond_to? :make_fifo
|
||||
fifo = make_tmp_filename("fifo")
|
||||
make_fifo fifo
|
||||
end
|
||||
[@dir, @file, @zerofile, @symlinkfile, @hardlinkfile, fifo].compact.each do |f|
|
||||
assert_equal(File.atime(f), test(?A, f))
|
||||
assert_equal(File.ctime(f), test(?C, f))
|
||||
assert_equal(File.mtime(f), test(?M, f))
|
||||
|
@ -1076,9 +1092,14 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||
assert(!(File::Stat.new(@file).directory?))
|
||||
end
|
||||
|
||||
def test_stat_pipe_p ## xxx
|
||||
def test_stat_pipe_p
|
||||
assert(!(File::Stat.new(@dir).pipe?))
|
||||
assert(!(File::Stat.new(@file).pipe?))
|
||||
if self.respond_to? :make_fifo
|
||||
fifo = make_tmp_filename("fifo")
|
||||
make_fifo fifo
|
||||
assert((File::Stat.new(fifo).pipe?))
|
||||
end
|
||||
end
|
||||
|
||||
def test_stat_symlink_p
|
||||
|
|
Loading…
Reference in a new issue