Skip to content

Commit

Permalink
Merge pull request #159 from aycabta/revert-glob-support
Browse files Browse the repository at this point in the history
Revert to glob support
  • Loading branch information
hsbt authored Oct 4, 2016
2 parents 277a653 + c090e33 commit e00b753
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/rake/testtask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,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
Expand Down
18 changes: 16 additions & 2 deletions test/test_rake_test_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e00b753

Please sign in to comment.