def test(params)
require 'test/unit'
require 'test/unit/testresult'
params_desc = {
:root => { :mandatory => false, :type => :string },
:includes => { :mandatory => true, :type => :string },
:excludes => { :mandatory => false, :type => :string },
:dotmatch => { :mandatory => false, :type => :boolean, :default => false },
:dir => { :mandatory => false, :type => :string, :default => '.' }
}
check_parameters(params, params_desc)
root = params[:root]
includes = params[:includes]
excludes = params[:excludes]
dotmatch = params[:dotmatch]
dir = params[:dir]
files = filter_files(includes, excludes, root, dotmatch)
for file in files
load file
end
size = (files.kind_of?(Array) ? files.size : 1)
puts "Running #{size} unit test(s)"
ok = Test::Unit::AutoRunner.run(false, dir)
error "Tests failed" if not ok
end