Sha256: e03f836455e6ceb01ae86353952db2caf79942bd0e2b9d644850e7dd9efdc405
Contents?: true
Size: 1.95 KB
Versions: 3
Compression:
Stored size: 1.95 KB
Contents
require "rubygems" require "dlog" begin require "minitest-rg" rescue LoadError STDERR.puts "'gem install minitest-rg' gives you redgreen minitests." require "minitest/unit" end require File.dirname(__FILE__) + "/string_ext" require File.dirname(__FILE__) + "/module_ext" # # Embedded test cases: # # The Etest module contains methods to run etests. # module Etest end require File.dirname(__FILE__) + "/etest/assertions" require File.dirname(__FILE__) + "/etest/comparison_assertions" class MiniTest::Unit::TestCase def self.run_etests(*test_cases) outside_etests = @@test_suites if test_cases.empty? dlog.warn "Found no etest test_cases" return end reset MiniTest::Unit::TestCase.reset test_cases.each do |test_case| MiniTest::Unit::TestCase.inherited test_case end # reset the default test runner :) MiniTest::Unit.runner.send(:initialize) MiniTest::Unit.new.run(ARGV.dup) ensure @@test_suites = outside_etests end end module Etest class TestCase < MiniTest::Unit::TestCase end def self.autorun auto_run end def self.auto_run # # find all modules that are not named /::Etest$/, and try to load # the respective Etest module. etests = Module.instances.map { |mod| #next if mod.name =~ /\bEtest$/ next if mod.name == "Object" Module.by_name "#{mod.name}::Etest" }.compact.uniq.sort_by(&:name) run(*etests) end def self.run(*etests) # # convert all Etest modules into a test case test_cases = etests.map { |etest| dlog "Running", etest to_test_case etest } MiniTest::Unit::TestCase.run_etests(*test_cases) end # # convert an Etest moodule into a MiniTest testcase def self.to_test_case(mod) klass = Class.new TestCase klass.send :include, mod klass.send :include, Assertions Kernel.silent do mod.const_set("TestCase", klass) end klass end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
etest-0.6.3 | lib/etest.rb |
etest-0.6.2 | lib/etest.rb |
etest-0.6.1 | lib/etest.rb |