From 3eb3af99bfdb03db6e549c0c974502fb36ca56e2 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 24 Feb 2004 09:03:19 +0000 Subject: * test/ruby/test_file.rb (test_fnmatch): test for dir.c:1.108. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_file.rb | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index c4095428e..c8bc747a5 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -14,15 +14,9 @@ class TestFile < Test::Unit::TestCase r = File.open(filename, "r") begin if /(mswin|bccwin|mingw|emx)/ =~ RUBY_PLATFORM - begin - File.unlink(filename) - assert(false) - rescue Errno::EACCES - assert(true) - end + assert_raise(Errno::EACCES) {File.unlink(filename)} else - File.unlink(filename) - assert(true) + assert_nothing_raised {File.unlink(filename)} end ensure r.close @@ -43,7 +37,11 @@ class TestFile < Test::Unit::TestCase def test_fnmatch # from [ruby-dev:22815] and [ruby-dev:22819] - assert(true, File.fnmatch('\[1\]' , '[1]')) - assert(true, File.fnmatch('*?', 'a')) + assert(File.fnmatch('\[1\]' , '[1]')) + assert(File.fnmatch('*?', 'a')) + assert(File.fnmatch('*/', 'a/')) + assert(File.fnmatch('\[1\]' , '[1]', File::FNM_PATHNAME)) + assert(File.fnmatch('*?', 'a', File::FNM_PATHNAME)) + assert(File.fnmatch('*/', 'a/', File::FNM_PATHNAME)) end end -- cgit