test/test_file_find.rb in file-find-0.4.2 vs test/test_file_find.rb in file-find-0.4.3
- old
+ new
@@ -6,10 +6,11 @@
######################################################################
require 'test-unit'
require 'fileutils'
require 'file/find'
require 'sys/admin'
+require 'tmpdir'
if File::ALT_SEPARATOR
require 'win32/file'
require 'win32/security'
end
@@ -66,11 +67,11 @@
@rule1 = File::Find.new(:name => '*.txt')
@rule2 = File::Find.new
end
test "version constant is set to expected value" do
- assert_equal('0.4.2', File::Find::VERSION)
+ assert_equal('0.4.3', File::Find::VERSION)
assert_true(File::Find::VERSION.frozen?)
end
test "path accessor basic functionality" do
assert_respond_to(@rule1, :path)
@@ -534,9 +535,29 @@
end
test "an error is raised if an invalid option is passed" do
assert_raise(ArgumentError){ File::Find.new(:bogus => 1) }
assert_raise(ArgumentError){ File::Find.new(:bogus? => true) }
+ end
+
+ # TODO: Update test for Windows
+ test 'eloop handling works as expected' do
+ omit_if(@@windows, 'eloop handling test skipped on MS Windows')
+
+ begin
+ dir_eloop = ::Dir.mktmpdir
+
+ Dir.chdir(dir_eloop) do
+ File.symlink('eloop0', 'eloop1')
+ File.symlink('eloop1', 'eloop0')
+ expecting = ['./eloop0', './eloop1']
+
+ results = File::Find.new(:path => '.', :follow => true).find
+ assert_equal(expecting, results.sort)
+ end
+ ensure
+ rm_rf(dir_eloop)
+ end
end
def teardown
rm_rf(@file_rb)
rm_rf(@file_txt1)