Search code examples
rubyrake

Rake::TestTask test_files vs. pattern


Is there any advantage of using pattern over test_files?

It seems like they do the same thing:

Rake::TestTask.new do |t|
  t.libs << "test"
  # t.pattern = FileList['test/test_*.rb', 'test/*_test.rb']
  t.test_files = FileList['test/test_*.rb', 'test/*_test.rb']
end

Also, looking over the source for Rake::TestTask#initialize I couldn't tell the difference either.


Solution

  • test_files expects an array of filenames, FileList can be used, it is kind of an explicit listing of files

    pattern expects a glob pattern, a string

    If both is set, the actual list will be the union of the two. There is not really a difference between them.