Skip to content

Commit

Permalink
Showing 19 changed files with 174 additions and 72 deletions.
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/filetest/blockdev_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/filetest/chardev_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/core/filetest/directory_tags.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
fails:FileTest.directory? returns true if the argument is a directory
fails:FileTest.directory? returns false if the argument is not a directory
fails:FileTest.directory? accepts an object that has a #to_path method
fails:FileTest.directory? raises a TypeError when passed an Integer
fails:FileTest.directory? raises a TypeError when passed nil
fails:FileTest.directory? returns false if the argument is an IO that's not a directory
fails:FileTest.directory? returns true if the argument is an IO that is a directory
fails:FileTest.directory? calls #to_io to convert a non-IO object
6 changes: 0 additions & 6 deletions spec/truffle/tags/core/filetest/executable_real_tags.txt

This file was deleted.

6 changes: 0 additions & 6 deletions spec/truffle/tags/core/filetest/executable_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/core/filetest/exist_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/core/filetest/exists_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/filetest/grpowned_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
fails:FileTest.grpowned? returns true if the file exist
fails:FileTest.grpowned? accepts an object that has a #to_path method
fails:FileTest.grpowned? takes non primary groups into account
fails:FileTest.grpowned? returns false if the file doesn't exist
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/filetest/readable_real_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/filetest/readable_tags.txt

This file was deleted.

10 changes: 0 additions & 10 deletions spec/truffle/tags/core/filetest/size_tags.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
fails:FileTest.size? returns the size of the file if it exists and is not empty
fails:FileTest.size? accepts a String-like (to_str) parameter
fails:FileTest.size? accepts an object that has a #to_path method
fails:FileTest.size? returns nil if file_name doesn't exist or has 0 size
fails:FileTest.size? returns nil if file_name is empty
fails:FileTest.size? accepts a File argument
fails:FileTest.size returns the size of the file if it exists and is not empty
fails:FileTest.size accepts a String-like (to_str) parameter
fails:FileTest.size accepts an object that has a #to_path method
fails:FileTest.size raises an error if file_name doesn't exist
fails:FileTest.size returns 0 if the file is empty
fails:FileTest.size accepts a File argument
1 change: 0 additions & 1 deletion spec/truffle/tags/core/filetest/sticky_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
fails:FileTest.sticky? returns false if the file dies not exist
fails:FileTest.sticky? returns true if the named file has the sticky bit, otherwise false
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/filetest/symlink_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/core/filetest/writable_real_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/filetest/writable_tags.txt

This file was deleted.

9 changes: 0 additions & 9 deletions spec/truffle/tags/core/filetest/zero_tags.txt

This file was deleted.

4 changes: 2 additions & 2 deletions truffle/src/main/ruby/core.rb
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@
require_relative 'core/rubinius/common/file'
require_relative 'core/rubinius/common/dir'
require_relative 'core/rubinius/common/dir_glob'
#require_relative 'core/rubinius/common/file_test'
require_relative 'core/rubinius/common/file_test'
require_relative 'core/rubinius/common/stat'
require_relative 'core/rubinius/common/float'
require_relative 'core/rubinius/common/immediate'
@@ -199,7 +199,7 @@
#require_relative 'core/rubinius/delta/runtime'
require_relative 'core/rubinius/delta/module'
require_relative 'core/rubinius/delta/class'
#require_relative 'core/rubinius/delta/file_test'
require_relative 'core/rubinius/delta/file_test'
require_relative 'core/rubinius/delta/kernel'
#require_relative 'core/rubinius/delta/math'
#require_relative 'core/rubinius/delta/options'
120 changes: 120 additions & 0 deletions truffle/src/main/ruby/core/rubinius/common/file_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Copyright (c) 2007-2014, Evan Phoenix and contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Rubinius nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

module FileTest
def blockdev?(path)
File.blockdev? path
end

def chardev?(path)
File.chardev? path
end

def directory?(path)
File.directory? path
end

def executable?(path)
File.executable? path
end

def executable_real?(path)
File.executable_real? path
end

def exist?(path)
File.exist? path
end
alias_method :exists?, :exist?

def file?(path)
File.file? path
end

def grpowned?(path)
File.grpowned? path
end

def identical?(a, b)
File.identical? a, b
end

def owned?(path)
File.owned? path
end

def pipe?(path)
File.pipe? path
end

def readable?(path)
File.readable? path
end

def readable_real?(path)
File.readable_real? path
end

def setgid?(path)
File.setgid? path
end

def setuid?(path)
File.setuid? path
end

def size(path)
File.size path
end

def size?(path)
File.size? path
end

def socket?(path)
File.socket? path
end

def sticky?(path)
File.sticky? path
end

def symlink?(path)
File.symlink? path
end

def writable?(path)
File.writable? path
end

def writable_real?(path)
File.writable_real? path
end

def zero?(path)
File.zero? path
end
end
52 changes: 52 additions & 0 deletions truffle/src/main/ruby/core/rubinius/delta/file_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (c) 2007-2014, Evan Phoenix and contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Rubinius nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

module FileTest
module_function :blockdev?,
:chardev?,
:directory?,
:executable?,
:executable_real?,
:exist?,
:exists?,
:file?,
:grpowned?,
:identical?,
:owned?,
:pipe?,
:readable?,
:readable_real?,
:setgid?,
:setuid?,
:size,
:size?,
:socket?,
:sticky?,
:symlink?,
:writable?,
:writable_real?,
:zero?
end

0 comments on commit 2162163

Please sign in to comment.