Skip to content

Revert to glob support #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rake/testtask.rb
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ def file_list # :nodoc:
else
result = []
result += @test_files.to_a if @test_files
result << @pattern if @pattern
result += FileList[@pattern].to_a if @pattern
result
end
end
18 changes: 16 additions & 2 deletions test/test_rake_test_task.rb
Original file line number Diff line number Diff line change
@@ -82,26 +82,40 @@ def test_libs_equals_empty
end

def test_pattern_equals
['gl.rb', 'ob.rb'].each do |f|
create_file(f)
end
tt = Rake::TestTask.new do |t|
t.pattern = "*.rb"
end
assert_equal ["*.rb"], tt.file_list.to_a
assert_equal ["gl.rb", "ob.rb"], tt.file_list.to_a
end

def test_pattern_equals_test_files_equals
['gl.rb', 'ob.rb'].each do |f|
create_file(f)
end
tt = Rake::TestTask.new do |t|
t.test_files = FileList["a.rb", "b.rb"]
t.pattern = "*.rb"
end
assert_equal ["a.rb", "b.rb", "*.rb"], tt.file_list.to_a
assert_equal ["a.rb", "b.rb", "gl.rb", "ob.rb"], tt.file_list.to_a
end

def test_run_code_direct
globbed = ['test_gl.rb', 'test_ob.rb'].map { |f| File.join('test', f) }
others = ['a.rb', 'b.rb'].map { |f| File.join('test', f) }
(globbed + others).each do |f|
create_file(f)
end
test_task = Rake::TestTask.new do |t|
t.loader = :direct
# if t.pettern and t.test_files are nil,
# t.pettern is "test/test*.rb"
end

assert_equal '-e "ARGV.each{|f| require f}"', test_task.run_code
assert_equal globbed, test_task.file_list.to_a
end

def test_run_code_rake