module Hoe::Test
def define_test_tasks
def define_test_tasks default_tasks = [] task :test if File.directory? "test" then case testlib when :minitest then require "minitest/test_task" # in minitest 5.16+ test_prelude = self.test_prelude self.test_task = Minitest::TestTask.create :test do |t| t.test_prelude = test_prelude t.libs.prepend Hoe.include_dirs.uniq end when :none then # do nothing else warn "Unsupported? Moving to Minitest::TestTask. Let me know if you use this!" end desc "Run the test suite using multiruby." task :multi do skip = with_config do |config, _| config["multiruby_skip"] + self.multiruby_skip end ENV["EXCLUDED_VERSIONS"] = skip.join(":") system "multiruby -S rake" end default_tasks << :test end desc "Run the default task(s)." task :default => default_tasks desc "Run ZenTest against the package." task :audit do libs = %w[lib test ext].join(File::PATH_SEPARATOR) sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(" ")}" end end
def initialize_test
def initialize_test self.multiruby_skip ||= [] self.testlib ||= :minitest self.test_prelude ||= nil self.test_task = nil end