-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The rake test loaded needs to remove items from ARGV that it has hand…
…led. Issue ruby#51
- Loading branch information
Showing
2 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
require 'rake' | ||
|
||
# Load the test files from the command line. | ||
argv = ARGV.select do |argument| | ||
case argument | ||
when /^-/ then | ||
argument | ||
when /\*/ then | ||
FileList[argument].to_a.each do |file| | ||
require File.expand_path file | ||
end | ||
|
||
ARGV.each do |f| | ||
next if f =~ /^-/ | ||
|
||
if f =~ /\*/ | ||
FileList[f].to_a.each { |fn| require File.expand_path(fn) } | ||
false | ||
else | ||
require File.expand_path(f) | ||
require File.expand_path argument | ||
|
||
false | ||
end | ||
end | ||
|
||
ARGV.replace argv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require File.expand_path('../helper', __FILE__) | ||
|
||
class TestRakeRakeTestLoader < Rake::TestCase | ||
|
||
def test_pattern | ||
orig_LOADED_FEATURES = $:.dup | ||
FileUtils.touch 'foo.rb' | ||
FileUtils.touch 'test_a.rb' | ||
FileUtils.touch 'test_b.rb' | ||
|
||
ARGV.replace %w[foo.rb test_*.rb -v] | ||
|
||
load 'rake/rake_test_loader.rb' | ||
|
||
assert_equal %w[-v], ARGV | ||
ensure | ||
$:.replace orig_LOADED_FEATURES | ||
end | ||
|
||
end | ||
|