Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e2095d3af0e4
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5bba15de5e8f
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 4, 2014

  1. Copy the full SHA
    8fc8999 View commit details
  2. Copy the full SHA
    fced317 View commit details
  3. Adding FNM_EXTGLOB flag

    jc00ke committed Nov 4, 2014
    Copy the full SHA
    5bba15d View commit details
Showing with 10 additions and 2 deletions.
  1. +1 −0 kernel/common/file.rb
  2. +1 −1 spec/ruby/core/file/constants/constants_spec.rb
  3. +5 −1 spec/ruby/core/file/shared/fnmatch.rb
  4. +2 −0 spec/tags/ruby/core/file/fnmatch_tags.txt
  5. +1 −0 vm/builtin/io.cpp
1 change: 1 addition & 0 deletions kernel/common/file.rb
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ module Constants
FNM_PATHNAME = 0x02
FNM_DOTMATCH = 0x04
FNM_CASEFOLD = 0x08
FNM_EXTGLOB = 0x10

if Rubinius.windows?
NULL = 'NUL'
2 changes: 1 addition & 1 deletion spec/ruby/core/file/constants/constants_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require File.expand_path('../../../../spec_helper', __FILE__)

["APPEND", "CREAT", "EXCL", "FNM_CASEFOLD",
"FNM_DOTMATCH", "FNM_NOESCAPE", "FNM_PATHNAME",
"FNM_DOTMATCH", "FNM_EXTGLOB", "FNM_NOESCAPE", "FNM_PATHNAME",
"FNM_SYSCASE", "LOCK_EX", "LOCK_NB", "LOCK_SH",
"LOCK_UN", "NONBLOCK", "RDONLY",
"RDWR", "TRUNC", "WRONLY"].each do |const|
6 changes: 5 additions & 1 deletion spec/ruby/core/file/shared/fnmatch.rb
Original file line number Diff line number Diff line change
@@ -7,11 +7,15 @@
File.send(@method, 'cat', 'category').should == false
end

it "does not support { } patterns" do
it "does not support { } patterns by default" do
File.send(@method, 'c{at,ub}s', 'cats').should == false
File.send(@method, 'c{at,ub}s', 'c{at,ub}s').should == true
end

it "supports { } patterns when File::FNM_EXTGLOB is passed" do
File.send(@method, 'c{at,ub}s', 'cats', File::FNM_EXTGLOB).should == true
end

it "matches a single character for each ? character" do
File.send(@method, 'c?t', 'cat').should == true
File.send(@method, 'c??t', 'cat').should == false
2 changes: 2 additions & 0 deletions spec/tags/ruby/core/file/fnmatch_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:File.fnmatch supports { } patterns when File::FNM_EXTGLOB is passed
fails:File.fnmatch? supports { } patterns when File::FNM_EXTGLOB is passed
1 change: 1 addition & 0 deletions vm/builtin/io.cpp
Original file line number Diff line number Diff line change
@@ -1040,6 +1040,7 @@ namespace rubinius {
#define FNM_PATHNAME 0x02
#define FNM_DOTMATCH 0x04
#define FNM_CASEFOLD 0x08
#define FNM_EXTGLOB 0x10
#if CASEFOLD_FILESYSTEM
#define FNM_SYSCASE FNM_CASEFOLD
#else