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: 6dfb925c13c3
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 25405ee88e81
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 4, 2014

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    75cb864 View commit details
  2. Don't just test FNM_EXTGLOB

    Closes #3228
    jc00ke committed Dec 4, 2014

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    25405ee View commit details
Showing with 7 additions and 4 deletions.
  1. +3 −3 kernel/common/file.rb
  2. +4 −1 spec/ruby/core/file/shared/fnmatch.rb
6 changes: 3 additions & 3 deletions kernel/common/file.rb
Original file line number Diff line number Diff line change
@@ -672,12 +672,12 @@ def self.fnmatch(pattern, path, flags=0)
pattern = StringValue(pattern)
path = Rubinius::Type.coerce_to_path(path)
flags = Rubinius::Type.coerce_to(flags, Fixnum, :to_int)
brace_match = false

if (flags & FNM_EXTGLOB) != 0
braces(pattern, flags).any? { |p| super(p, path, flags) }
else
super pattern, path, flags
brace_match = braces(pattern, flags).any? { |p| super(p, path, flags) }
end
brace_match || super(pattern, path, flags)
end

##
5 changes: 4 additions & 1 deletion spec/ruby/core/file/shared/fnmatch.rb
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@
File.send(@method, "{1,5{a,b{c,d}}}", "5bd", File::FNM_EXTGLOB).should == true
File.send(@method, "\\\\{a\\,b,b\\}c}", "\\a,b", File::FNM_EXTGLOB).should == true
File.send(@method, "\\\\{a\\,b,b\\}c}", "\\b}c", File::FNM_EXTGLOB).should == true

end

it "doesn't support some { } patterns even when File::FNM_EXTGLOB is passed" do
@@ -62,6 +61,10 @@
File.send(@method, 'c{at,ub}}s', 'cats', File::FNM_EXTGLOB).should == false
end

it "matches when both FNM_EXTGLOB and FNM_PATHNAME are passed" do
File.send(@method, "?.md", "a.md", File::FNM_EXTGLOB | File::FNM_PATHNAME).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