Changeset 276

Show
Ignore:
Timestamp:
10/25/06 19:31:15 (2 years ago)
Author:
blackhedd
Message:

added test cases for user-defined events

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • version_0/Rakefile

    r227 r276  
    108108 
    109109 
    110 # This is used by three rake tasks, that parameterize the 
    111 # behavior with a global variable. This way we can test 
    112 # the extension and non-extension versions with the same tests. 
     110=begin 
     111# This is used by several rake tasks, that parameterize the 
     112# behavior so we can test the extension and non-extension 
     113# versions with the same tests. 
    113114test_runner = proc {|t, libr| 
    114115  require 'test/unit/testsuite' 
     
    133134  runner.run(suite) 
    134135} 
     136=end 
     137 
     138 
     139# This is used by several rake tasks, that parameterize the 
     140# behavior so we can test the extension and non-extension 
     141# versions with the same tests. 
     142def run_tests t, libr, test_filename_filter="test_*.rb" 
     143  require 'test/unit/testsuite' 
     144  require 'test/unit/ui/console/testrunner' 
     145 
     146  runner = Test::Unit::UI::Console::TestRunner 
     147 
     148  $eventmachine_library = libr 
     149  $LOAD_PATH.unshift('tests') 
     150  $stderr.puts "Checking for test cases:" if t.verbose 
     151  Dir["tests/#{test_filename_filter}"].each do |testcase| 
     152    $stderr.puts "\t#{testcase}" if t.verbose 
     153    load testcase 
     154  end 
     155 
     156  suite = Test::Unit::TestSuite.new($name) 
     157 
     158  ObjectSpace.each_object(Class) do |testcase| 
     159    suite << testcase.suite if testcase < Test::Unit::TestCase 
     160  end 
     161 
     162  runner.run(suite) 
     163end 
    135164 
    136165desc "Run tests for #$name." 
    137166task :test do |t| 
    138   test_runner.call t, nil 
     167  #test_runner.call t, nil 
     168  run_tests t, nil 
    139169end 
    140170 
    141171desc "Run pure-ruby tests for #$name." 
    142172task :testpr do |t| 
    143   test_runner.call t, :pure_ruby 
     173  run_tests t, :pure_ruby 
    144174end 
    145175 
    146176desc "Run extension tests for #$name." 
    147177task :testext do |t| 
    148   test_runner.call t, :extension 
     178  run_tests t, :extension 
     179end 
     180 
     181desc "PROVISIONAL: run tests for user-defined events" 
     182task :test_ud do |t| 
     183  run_tests t, :extension, "test_ud.rb" 
    149184end 
    150185 
  • version_0/tests/test_ud.rb

    r275 r276  
    4646  end 
    4747 
     48  def test_a 
     49  end 
     50 
    4851end 
    4952