diff options
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/envutil.rb | 7 | ||||
| -rw-r--r-- | test/ruby/test_fnmatch.rb | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index 3e04f55c0c..780196a438 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -229,7 +229,7 @@ module Test AssertFile end - class << (AssertFile = Object.new) + class << (AssertFile = Struct.new(:message).new) include Assertions def assert_file_predicate(predicate, *args) if /\Anot_/ =~ predicate @@ -241,9 +241,14 @@ module Test mesg = "Expected file " << args.shift.inspect mesg << mu_pp(args) unless args.empty? mesg << "#{neg} to be #{predicate}" + mesg << " #{message}" if message assert(result, mesg) end alias method_missing assert_file_predicate + + def for(message) + clone.tap {|a| a.message = message} + end end end end diff --git a/test/ruby/test_fnmatch.rb b/test/ruby/test_fnmatch.rb index e5f5ba6a4f..d186638a7b 100644 --- a/test/ruby/test_fnmatch.rb +++ b/test/ruby/test_fnmatch.rb @@ -1,4 +1,5 @@ require 'test/unit' +require_relative 'envutil' class TestFnmatch < Test::Unit::TestCase @@ -103,4 +104,9 @@ class TestFnmatch < Test::Unit::TestCase assert(File.fnmatch('**/foo', 'c:/root/foo', File::FNM_PATHNAME)) end + def test_extglob + feature5422 = '[ruby-core:40037]' + assert_file.for(feature5422).not_fnmatch?( "{.g,t}*", ".gem") + assert_file.for(feature5422).fnmatch?("{.g,t}*", ".gem", File::FNM_EXTGLOB) + end end |
