win32-api 1.5.3-universal-mingw32 → 1.6.0-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +174 -169
- data/Gemfile +4 -0
- data/Gemfile.lock +24 -0
- data/README +129 -131
- data/Rakefile +185 -182
- data/appveyor.yml +42 -0
- data/ext/win32/api.c +1092 -1092
- data/lib/win32/api.rb +14 -8
- data/lib/win32/ruby21_32/win32/api.so +0 -0
- data/lib/win32/ruby21_64/win32/api.so +0 -0
- data/lib/win32/ruby22_32/win32/api.so +0 -0
- data/lib/win32/ruby22_64/win32/api.so +0 -0
- data/lib/win32/ruby23_32/win32/api.so +0 -0
- data/lib/win32/ruby23_64/win32/api.so +0 -0
- data/lib/win32/ruby2_32/win32/api.so +0 -0
- data/lib/win32/ruby2_64/win32/api.so +0 -0
- data/test/test_win32_api.rb +145 -145
- data/vendor/bundle/ruby/2.2.0/bin/devkit +23 -0
- data/vendor/bundle/ruby/2.2.0/bin/devkit.bat +6 -0
- data/vendor/bundle/ruby/2.2.0/bin/rake +23 -0
- data/vendor/bundle/ruby/2.2.0/bin/rake.bat +6 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/CHANGELOG +55 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/LICENSE +339 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/README.md +73 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/Rakefile +8 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/colorize.gemspec +35 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize.rb +12 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize/class_methods.rb +116 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize/instance_methods.rb +135 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/test/test_colorize.rb +161 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Gemfile +4 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/README.md +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Rakefile +1 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Rspec-example-matchers.txt +184 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/bin/devkit +87 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/devkit.gemspec +27 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit.rb +18 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/core.rb +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/identity.rb +78 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/ssh_identity.rb +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/version.rb +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/core_spec.rb +46 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/identity_spec.rb +1 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/ssh_identity_spec.rb +1 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit_spec.rb +5 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/spec_helper.rb +8 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/AUTHORS +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/COPYING +339 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Changelog.md +415 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Gemfile +9 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/INSTALL +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/LICENSE +7 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/README.rdoc +74 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Rakefile +30 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/TODO +6 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/ansi_colors.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/asking_for_arrays.rb +18 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/basic_usage.rb +75 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/color_scheme.rb +32 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/get_character.rb +12 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/limit.rb +12 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/menus.rb +65 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/overwrite.rb +19 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/page_and_wrap.rb +322 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/password.rb +7 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/repeat_entry.rb +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/trapping_eof.rb +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/using_readline.rb +17 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/highline.gemspec +37 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline.rb +1048 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/color_scheme.rb +134 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/compatibility.rb +16 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/import.rb +41 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/menu.rb +381 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/question.rb +480 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/simulate.rb +48 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/style.rb +192 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/version.rb +4 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/setup.rb +1360 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/highline.css +65 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/images/logo.png +0 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/index.html +58 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/string_methods.rb +32 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_color_scheme.rb +96 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_highline.rb +1402 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_import.rb +52 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_menu.rb +439 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_simulator.rb +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_string_highline.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_style.rb +578 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/BSDL +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/COPYING +57 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/Gemfile +9 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/LEGAL +4 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/README.rdoc +19 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/Rakefile +16 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/benchmarks/bm_yhpg.rb +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/benchmarks/helper.rb +8 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert.rb +338 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert/enable_tracepoint_events.rb +82 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert/version.rb +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/power_assert.gemspec +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/test/helper.rb +10 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/test/test_power_assert.rb +512 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/CONTRIBUTING.rdoc +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/History.rdoc +719 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/Manifest.txt +154 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/README.rdoc +157 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/Rakefile +82 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/bin/rake +33 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/command_line_usage.rdoc +158 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/a.c +6 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/b.c +6 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/main.c +11 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/glossary.rdoc +42 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/jamis.rb +591 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rake.1 +141 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rakefile.rdoc +624 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rational.rdoc +151 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.6.rdoc +37 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.7.rdoc +55 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.0.rdoc +112 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.1.rdoc +52 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.2.rdoc +49 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.3.rdoc +102 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.4.rdoc +60 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.5.rdoc +55 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.6.rdoc +64 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.0.rdoc +178 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.1.rdoc +58 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.2.rdoc +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.3.rdoc +191 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.1.0.rdoc +61 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake.rb +73 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb +787 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/backtrace.rb +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/clean.rb +76 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/cloneable.rb +16 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/compositepublisher.rb +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/ftptools.rb +137 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/sshpublisher.rb +60 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/cpu_counter.rb +120 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/default_loader.rb +14 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/dsl_definition.rb +194 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/early_time.rb +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_creation_task.rb +24 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_list.rb +436 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_task.rb +46 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_utils.rb +123 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/invocation_chain.rb +56 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/invocation_exception_mixin.rb +16 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/late_time.rb +17 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/linked_list.rb +111 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/loaders/makefile.rb +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/multi_task.rb +13 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/name_space.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/packagetask.rb +199 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/phony.rb +15 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/private_reader.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/promise.rb +99 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/pseudo_status.rb +29 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_test_loader.rb +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/scope.rb +42 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task.rb +391 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_argument_error.rb +7 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_arguments.rb +102 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_manager.rb +316 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/tasklib.rb +11 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/testtask.rb +204 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/thread_history_display.rb +48 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/thread_pool.rb +163 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/trace_output.rb +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/version.rb +7 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/win32.rb +50 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/rakelib/test_times.rake +25 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/file_creation.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/helper.rb +134 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/support/rakefile_definitions.rb +476 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/support/ruby_runner.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_private_reader.rb +42 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake.rb +40 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_application.rb +659 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_application_options.rb +468 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_backtrace.rb +119 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_clean.rb +61 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_cpu_counter.rb +68 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_definitions.rb +84 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_directory_task.rb +76 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_dsl.rb +40 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_early_time.rb +31 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_creation_task.rb +56 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_list.rb +687 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_list_path_map.rb +15 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_task.rb +197 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_utils.rb +318 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_ftp_file.rb +74 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_functional.rb +484 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_invocation_chain.rb +64 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_late_time.rb +18 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_linked_list.rb +84 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_makefile_loader.rb +46 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_multi_task.rb +64 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_name_space.rb +57 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_package_task.rb +79 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map.rb +168 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map_explode.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map_partial.rb +18 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_pseudo_status.rb +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_rake_test_loader.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_reduce_compat.rb +26 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_require.rb +40 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_rules.rb +388 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_scope.rb +44 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task.rb +430 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_argument_parsing.rb +119 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_arguments.rb +134 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_manager.rb +178 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_manager_argument_resolution.rb +19 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_with_arguments.rb +172 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_test_task.rb +130 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_thread_pool.rb +145 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_top_level_functions.rb +71 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_win32.rb +72 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_thread_history_display.rb +101 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_trace_output.rb +52 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/COPYING +64 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/GPL +339 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/LGPL +502 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/PSFL +271 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/README.md +101 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/Rakefile +71 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test-unit.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit.rb +505 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/assertion-failed-error.rb +25 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/assertions.rb +2218 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/attribute-matcher.rb +26 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/attribute.rb +158 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/auto-runner-loader.rb +17 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/autorunner.rb +536 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/code-snippet-fetcher.rb +58 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector.rb +73 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/descendant.rb +19 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/dir.rb +108 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/load.rb +202 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/objectspace.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/xml.rb +249 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/color-scheme.rb +198 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/color.rb +134 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/data.rb +262 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/diff.rb +746 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/error.rb +158 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/exception-handler.rb +82 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/failure.rb +169 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/fault-location-detector.rb +100 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/fixture.rb +295 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/notification.rb +136 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/omission.rb +195 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/pending.rb +154 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/priority.rb +192 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/console.rb +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/emacs.rb +8 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/xml.rb +15 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/test-suite-creator.rb +89 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testcase.rb +811 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testresult.rb +132 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testsuite.rb +175 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/console/outputlevel.rb +15 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/console/testrunner.rb +693 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunner.rb +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunnermediator.rb +114 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/xml/testrunner.rb +224 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/backtracefilter.rb +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/observable.rb +90 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/output.rb +31 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/procwrapper.rb +48 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/version.rb +5 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/adder.rb +13 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/subtracter.rb +12 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_adder.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_subtracter.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_user.rb +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test-descendant.rb +178 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test-load.rb +442 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test_dir.rb +406 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test_objectspace.rb +100 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header-label.csv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header-label.tsv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header.csv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header.tsv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/no-header.csv +2 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/no-header.tsv +2 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/plus.csv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/run-test.rb +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-assertions.rb +2160 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute-matcher.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute.rb +123 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-code-snippet.rb +37 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-color-scheme.rb +82 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-color.rb +47 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-data.rb +303 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-diff.rb +518 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-emacs-runner.rb +60 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-error.rb +26 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-failure.rb +33 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-fault-location-detector.rb +163 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-fixture.rb +713 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-notification.rb +33 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-omission.rb +81 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-pending.rb +70 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-priority.rb +173 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-case.rb +1171 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-result.rb +113 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-suite-creator.rb +97 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-suite.rb +150 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/testunit-test-util.rb +31 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/ui/test_testrunmediator.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test-method-owner-finder.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test-output.rb +11 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_backtracefilter.rb +52 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_observable.rb +102 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_procwrapper.rb +36 -0
- data/vendor/bundle/ruby/2.2.0/specifications/colorize-0.7.7.gemspec +38 -0
- data/vendor/bundle/ruby/2.2.0/specifications/devkit-0.1.0.gemspec +46 -0
- data/vendor/bundle/ruby/2.2.0/specifications/highline-1.7.8.gemspec +37 -0
- data/vendor/bundle/ruby/2.2.0/specifications/power_assert-0.3.0.gemspec +41 -0
- data/vendor/bundle/ruby/2.2.0/specifications/rake-11.1.2.gemspec +43 -0
- data/vendor/bundle/ruby/2.2.0/specifications/test-unit-3.1.9.gemspec +47 -0
- data/win32-api.gemspec +27 -27
- metadata +345 -5
- data/lib/win32/ruby18/win32/api.so +0 -0
- data/lib/win32/ruby19/win32/api.so +0 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'testunit-test-util'
|
3
|
+
|
4
|
+
class TestUnitNotification < Test::Unit::TestCase
|
5
|
+
include TestUnitTestUtil
|
6
|
+
|
7
|
+
class TestCase < Test::Unit::TestCase
|
8
|
+
class << self
|
9
|
+
def suite
|
10
|
+
Test::Unit::TestSuite.new(name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_notify
|
15
|
+
notify("1st notify")
|
16
|
+
notify("2nd notify. Reach here.")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_notify
|
21
|
+
result = _run_test("test_notify")
|
22
|
+
assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
|
23
|
+
"0 omissions, 2 notifications",
|
24
|
+
result.to_s)
|
25
|
+
assert_fault_messages(["1st notify", "2nd notify. Reach here."],
|
26
|
+
result.notifications)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def _run_test(name)
|
31
|
+
super(TestCase, name)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'testunit-test-util'
|
3
|
+
|
4
|
+
class TestUnitOmission < Test::Unit::TestCase
|
5
|
+
include TestUnitTestUtil
|
6
|
+
|
7
|
+
class TestCase < Test::Unit::TestCase
|
8
|
+
class << self
|
9
|
+
def suite
|
10
|
+
Test::Unit::TestSuite.new(name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_omit
|
15
|
+
omit("1st omit")
|
16
|
+
omit("2nd omit. Should not be reached here.")
|
17
|
+
assert(true, "Should not be reached here too.")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_omit_with_condition
|
21
|
+
omit_if(false, "Never omit.")
|
22
|
+
omit_unless(true, "Never omit too.")
|
23
|
+
omit_if(true, "Should omit.")
|
24
|
+
omit("The last omit. Should not be reached here.")
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_omit_with_block
|
28
|
+
omit("Omit block") do
|
29
|
+
flunk("Should not be reached here.")
|
30
|
+
end
|
31
|
+
assert(true, "Should be reached here.")
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_omit_with_block_and_condition
|
35
|
+
omit_if(false, "Never omit.") do
|
36
|
+
assert(true, "Should be reached here.")
|
37
|
+
end
|
38
|
+
omit_if(true, "Should omit.") do
|
39
|
+
flunk("Never reached here.")
|
40
|
+
end
|
41
|
+
assert(true, "Should be reached here too.")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_omit
|
46
|
+
result = _run_test("test_omit")
|
47
|
+
assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
|
48
|
+
"1 omissions, 0 notifications",
|
49
|
+
result.to_s)
|
50
|
+
assert_fault_messages(["1st omit"], result.omissions)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_omit_with_condition
|
54
|
+
result = _run_test("test_omit_with_condition")
|
55
|
+
assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
|
56
|
+
"1 omissions, 0 notifications",
|
57
|
+
result.to_s)
|
58
|
+
assert_fault_messages(["Should omit."], result.omissions)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_omit_with_block
|
62
|
+
result = _run_test("test_omit_with_block")
|
63
|
+
assert_equal("1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, " \
|
64
|
+
"1 omissions, 0 notifications",
|
65
|
+
result.to_s)
|
66
|
+
assert_fault_messages(["Omit block"], result.omissions)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_omit_with_condition_and_block
|
70
|
+
result = _run_test("test_omit_with_block_and_condition")
|
71
|
+
assert_equal("1 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, " \
|
72
|
+
"1 omissions, 0 notifications",
|
73
|
+
result.to_s)
|
74
|
+
assert_fault_messages(["Should omit."], result.omissions)
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
def _run_test(name)
|
79
|
+
super(TestCase, name)
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'testunit-test-util'
|
3
|
+
|
4
|
+
class TestUnitPending < Test::Unit::TestCase
|
5
|
+
include TestUnitTestUtil
|
6
|
+
|
7
|
+
class TestCase < Test::Unit::TestCase
|
8
|
+
class << self
|
9
|
+
def suite
|
10
|
+
Test::Unit::TestSuite.new(name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_pend
|
15
|
+
pend("1st pend")
|
16
|
+
pend("2nd pend. Should not be reached here.")
|
17
|
+
assert(true, "Should not be reached here too.")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_pend_with_failure_in_block
|
21
|
+
pend("Wait a minute") do
|
22
|
+
raise "Not implemented yet"
|
23
|
+
end
|
24
|
+
assert(true, "Reached here.")
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_pend_with_no_failure_in_block
|
28
|
+
pend("Wait a minute") do
|
29
|
+
"Nothing raised"
|
30
|
+
end
|
31
|
+
assert(true, "Not reached here.")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_pend
|
36
|
+
test = nil
|
37
|
+
result = _run_test("test_pend") {|t| test = t}
|
38
|
+
assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 1 pendings, " \
|
39
|
+
"0 omissions, 0 notifications",
|
40
|
+
result.to_s)
|
41
|
+
assert_fault_messages(["1st pend"], result.pendings)
|
42
|
+
assert_true(test.interrupted?)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_pend_with_failure_in_block
|
46
|
+
test = nil
|
47
|
+
result = _run_test("test_pend_with_failure_in_block") {|t| test = t}
|
48
|
+
assert_equal("1 tests, 1 assertions, 0 failures, 0 errors, 1 pendings, " \
|
49
|
+
"0 omissions, 0 notifications",
|
50
|
+
result.to_s)
|
51
|
+
assert_fault_messages(["Wait a minute"], result.pendings)
|
52
|
+
assert_false(test.interrupted?)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_pend_with_no_failure_in_block
|
56
|
+
test = nil
|
57
|
+
result = _run_test("test_pend_with_no_failure_in_block") {|t| test = t}
|
58
|
+
assert_equal("1 tests, 1 assertions, 1 failures, 0 errors, 0 pendings, " \
|
59
|
+
"0 omissions, 0 notifications",
|
60
|
+
result.to_s)
|
61
|
+
assert_fault_messages(["Pending block should not be passed: Wait a minute."],
|
62
|
+
result.failures)
|
63
|
+
assert_true(test.interrupted?)
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
def _run_test(name, &block)
|
68
|
+
super(TestCase, name, &block)
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
class TestUnitPriority < Test::Unit::TestCase
|
4
|
+
class TestCase < Test::Unit::TestCase
|
5
|
+
class << self
|
6
|
+
def suite
|
7
|
+
Test::Unit::TestSuite.new(name)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
priority :must
|
12
|
+
def test_must
|
13
|
+
assert(true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_must_inherited
|
17
|
+
assert(true)
|
18
|
+
end
|
19
|
+
|
20
|
+
priority :important
|
21
|
+
def test_important
|
22
|
+
assert(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_important_inherited
|
26
|
+
assert(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
priority :high
|
30
|
+
def test_high
|
31
|
+
assert(true)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_high_inherited
|
35
|
+
assert(true)
|
36
|
+
end
|
37
|
+
|
38
|
+
priority :normal
|
39
|
+
def test_normal
|
40
|
+
assert(true)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_normal_inherited
|
44
|
+
assert(true)
|
45
|
+
end
|
46
|
+
|
47
|
+
priority :low
|
48
|
+
def test_low
|
49
|
+
assert(true)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_low_inherited
|
53
|
+
assert(true)
|
54
|
+
end
|
55
|
+
|
56
|
+
priority :never
|
57
|
+
def test_never
|
58
|
+
assert(true)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_never_inherited
|
62
|
+
assert(true)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_priority_must
|
67
|
+
assert_priority("must", 1.0, 0.0001)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_priority_important
|
71
|
+
assert_priority("important", 0.9, 0.09)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_priority_high
|
75
|
+
assert_priority("high", 0.70, 0.1)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_priority_normal
|
79
|
+
assert_priority("normal", 0.5, 0.1)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_priority_low
|
83
|
+
assert_priority("low", 0.25, 0.1)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_priority_never
|
87
|
+
assert_priority("never", 0.0, 0.0001)
|
88
|
+
end
|
89
|
+
|
90
|
+
def assert_priority(priority, expected, delta)
|
91
|
+
assert_need_to_run("test_#{priority}", expected, delta)
|
92
|
+
assert_need_to_run("test_#{priority}_inherited", expected, delta)
|
93
|
+
end
|
94
|
+
|
95
|
+
def assert_need_to_run(test_name, expected, delta)
|
96
|
+
test = TestCase.new(test_name)
|
97
|
+
n = 1000
|
98
|
+
n_need_to_run = 0
|
99
|
+
n.times do |i|
|
100
|
+
n_need_to_run += 1 if Test::Unit::Priority::Checker.need_to_run?(test)
|
101
|
+
end
|
102
|
+
assert_in_delta(expected, n_need_to_run.to_f / n, delta)
|
103
|
+
end
|
104
|
+
|
105
|
+
class TestClassName < self
|
106
|
+
def test_colon
|
107
|
+
assert_escaped_name("Test__Priority", "Test::Priority")
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_space
|
111
|
+
assert_escaped_name("test_priority", "test priority")
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_slash
|
115
|
+
assert_escaped_name("test_priority", "test/priority")
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_back_slash
|
119
|
+
assert_escaped_name("test_priority", "test\/priority")
|
120
|
+
end
|
121
|
+
|
122
|
+
def assert_escaped_name(expected, class_name)
|
123
|
+
checker = Checker.new(nil)
|
124
|
+
escaped_class_name = checker.send(:escape_class_name, class_name)
|
125
|
+
assert_equal(expected, escaped_class_name)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
class TestFileName < self
|
130
|
+
class SpecialNameTestCase < Test::Unit::TestCase
|
131
|
+
class << self
|
132
|
+
def suite
|
133
|
+
Test::Unit::TestSuite.new(name)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_question?
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_exclamation!
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_equal=
|
144
|
+
end
|
145
|
+
|
146
|
+
test "have space" do
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_question
|
151
|
+
assert_escaped_name("test_question.predicate", "test_question?")
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_exclamation
|
155
|
+
assert_escaped_name("test_exclamation.destructive", "test_exclamation!")
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_equal
|
159
|
+
assert_escaped_name("test_equal.equal", "test_equal=")
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_colon_and_space
|
163
|
+
assert_escaped_name("test_colon__have_space", "test: have space")
|
164
|
+
end
|
165
|
+
|
166
|
+
def assert_escaped_name(expected, test_method_name)
|
167
|
+
checker = Checker.new(SpecialNameTestCase.new(test_method_name))
|
168
|
+
passed_file = checker.send(:passed_file)
|
169
|
+
method_name_component = File.basename(File.dirname(passed_file))
|
170
|
+
assert_equal(expected, method_name_component)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -0,0 +1,1171 @@
|
|
1
|
+
# Author:: Nathaniel Talbott.
|
2
|
+
# Copyright:: Copyright (c) 2008-2014 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
# Copyright:: Copyright (c) 2011 Haruka Yoshihara <yoshihara@clear-code.com>
|
4
|
+
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott
|
5
|
+
# License:: Ruby license.
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
module Test
|
10
|
+
module Unit
|
11
|
+
class TestTestCase < TestCase
|
12
|
+
self.test_order = :random
|
13
|
+
def test_creation
|
14
|
+
test_case = Class.new(TestCase) do
|
15
|
+
def test_with_arguments(arg1, arg2)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
test = test_case.new(:test_with_arguments)
|
20
|
+
check("Should have caught an invalid test when there are arguments",
|
21
|
+
!test.valid?)
|
22
|
+
|
23
|
+
test = test_case.new(:non_existent_test)
|
24
|
+
check("Should have caught an invalid test when the method does not exist",
|
25
|
+
!test.valid?)
|
26
|
+
end
|
27
|
+
|
28
|
+
def setup
|
29
|
+
@tc_failure_error = Class.new(TestCase) do
|
30
|
+
def test_failure
|
31
|
+
assert_block("failure") do
|
32
|
+
false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
def test_error
|
36
|
+
1 / 0
|
37
|
+
end
|
38
|
+
def test_nested_failure
|
39
|
+
nested
|
40
|
+
end
|
41
|
+
def nested
|
42
|
+
assert_block("nested") do
|
43
|
+
false
|
44
|
+
end
|
45
|
+
end
|
46
|
+
def return_passed?
|
47
|
+
return passed?
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def @tc_failure_error.name
|
52
|
+
"TC_FailureError"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def jruby_backtrace_entry?(entry)
|
57
|
+
entry.start_with?("org/jruby/")
|
58
|
+
end
|
59
|
+
|
60
|
+
def rubinius_backtrace_entry?(entry)
|
61
|
+
entry.start_with?("kernel/")
|
62
|
+
end
|
63
|
+
|
64
|
+
def normalize_location(location)
|
65
|
+
filtered_location = location.reject do |entry|
|
66
|
+
jruby_backtrace_entry?(entry) or
|
67
|
+
rubinius_backtrace_entry?(entry)
|
68
|
+
end
|
69
|
+
filtered_location.collect do |entry|
|
70
|
+
entry.sub(/:\d+:/, ":0:")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_add_failed_assertion
|
75
|
+
test_case = @tc_failure_error.new(:test_failure)
|
76
|
+
assert do
|
77
|
+
test_case.passed?
|
78
|
+
end
|
79
|
+
|
80
|
+
result = TestResult.new
|
81
|
+
faults = []
|
82
|
+
result.add_listener(TestResult::FAULT) do |fault|
|
83
|
+
faults << fault
|
84
|
+
end
|
85
|
+
progress = []
|
86
|
+
test_case.run(result) do |*arguments|
|
87
|
+
progress << arguments
|
88
|
+
end
|
89
|
+
fault_details = faults.collect do |fault|
|
90
|
+
{
|
91
|
+
:class => fault.class,
|
92
|
+
:message => fault.message,
|
93
|
+
:test_name => fault.test_name,
|
94
|
+
:location => normalize_location(fault.location),
|
95
|
+
}
|
96
|
+
end
|
97
|
+
assert_equal([
|
98
|
+
{
|
99
|
+
:class => Failure,
|
100
|
+
:message => "failure",
|
101
|
+
:test_name => "test_failure(TC_FailureError)",
|
102
|
+
:location => [
|
103
|
+
"#{__FILE__}:0:in `test_failure'",
|
104
|
+
"#{__FILE__}:0:in `#{__method__}'",
|
105
|
+
],
|
106
|
+
},
|
107
|
+
],
|
108
|
+
fault_details)
|
109
|
+
|
110
|
+
assert do
|
111
|
+
not test_case.passed?
|
112
|
+
end
|
113
|
+
assert_equal([
|
114
|
+
[TestCase::STARTED, test_case.name],
|
115
|
+
[TestCase::STARTED_OBJECT, test_case],
|
116
|
+
[TestCase::FINISHED, test_case.name],
|
117
|
+
[TestCase::FINISHED_OBJECT, test_case],
|
118
|
+
],
|
119
|
+
progress)
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_add_failure_nested
|
123
|
+
test_case = @tc_failure_error.new(:test_nested_failure)
|
124
|
+
assert do
|
125
|
+
test_case.passed?
|
126
|
+
end
|
127
|
+
|
128
|
+
result = TestResult.new
|
129
|
+
faults = []
|
130
|
+
result.add_listener(TestResult::FAULT) do |fault|
|
131
|
+
faults << fault
|
132
|
+
end
|
133
|
+
test_case.run(result) do
|
134
|
+
end
|
135
|
+
fault_details = faults.collect do |fault|
|
136
|
+
{
|
137
|
+
:class => fault.class,
|
138
|
+
:message => fault.message,
|
139
|
+
:test_name => fault.test_name,
|
140
|
+
:location => normalize_location(fault.location),
|
141
|
+
}
|
142
|
+
end
|
143
|
+
assert_equal([
|
144
|
+
{
|
145
|
+
:class => Failure,
|
146
|
+
:message => "nested",
|
147
|
+
:test_name => "test_nested_failure(TC_FailureError)",
|
148
|
+
:location => [
|
149
|
+
"#{__FILE__}:0:in `nested'",
|
150
|
+
"#{__FILE__}:0:in `test_nested_failure'",
|
151
|
+
"#{__FILE__}:0:in `#{__method__}'",
|
152
|
+
],
|
153
|
+
},
|
154
|
+
],
|
155
|
+
fault_details)
|
156
|
+
|
157
|
+
assert do
|
158
|
+
not test_case.passed?
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def jruby?
|
163
|
+
defined?(JRUBY_VERSION)
|
164
|
+
end
|
165
|
+
|
166
|
+
def rubinius?
|
167
|
+
false # TODO
|
168
|
+
end
|
169
|
+
|
170
|
+
def cruby?
|
171
|
+
(not jruby?) and (not rubinius?)
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_add_error
|
175
|
+
test_case = @tc_failure_error.new(:test_error)
|
176
|
+
assert do
|
177
|
+
test_case.passed?
|
178
|
+
end
|
179
|
+
|
180
|
+
result = TestResult.new
|
181
|
+
faults = []
|
182
|
+
result.add_listener(TestResult::FAULT) do |fault|
|
183
|
+
faults << fault
|
184
|
+
end
|
185
|
+
test_case.run(result) do
|
186
|
+
end
|
187
|
+
fault_details = faults.collect do |fault|
|
188
|
+
{
|
189
|
+
:class => fault.class,
|
190
|
+
:message => fault.message,
|
191
|
+
:test_name => fault.test_name,
|
192
|
+
:location => normalize_location(fault.location),
|
193
|
+
}
|
194
|
+
end
|
195
|
+
location = []
|
196
|
+
location << "#{__FILE__}:0:in `/'" if cruby?
|
197
|
+
location << "#{__FILE__}:0:in `test_error'"
|
198
|
+
location << "#{__FILE__}:0:in `#{__method__}'"
|
199
|
+
assert_equal([
|
200
|
+
{
|
201
|
+
:class => Error,
|
202
|
+
:message => "ZeroDivisionError: divided by 0",
|
203
|
+
:test_name => "test_error(TC_FailureError)",
|
204
|
+
:location => location,
|
205
|
+
},
|
206
|
+
],
|
207
|
+
fault_details)
|
208
|
+
|
209
|
+
assert do
|
210
|
+
not test_case.passed?
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def test_no_tests
|
215
|
+
suite = TestCase.suite
|
216
|
+
check("Should have a test suite", suite.instance_of?(TestSuite))
|
217
|
+
check("Should have one test", suite.size == 1)
|
218
|
+
check("Should have the default test", suite.tests.first.name == "default_test(Test::Unit::TestCase)")
|
219
|
+
|
220
|
+
result = TestResult.new
|
221
|
+
suite.run(result) {}
|
222
|
+
check("Should have had one test run", result.run_count == 1)
|
223
|
+
check("Should have had one test failure", result.failure_count == 1)
|
224
|
+
check("Should have had no errors", result.error_count == 0)
|
225
|
+
end
|
226
|
+
|
227
|
+
def test_suite
|
228
|
+
tc = Class.new(TestCase) do
|
229
|
+
def test_succeed
|
230
|
+
assert_block {true}
|
231
|
+
end
|
232
|
+
def test_fail
|
233
|
+
assert_block {false}
|
234
|
+
end
|
235
|
+
def test_error
|
236
|
+
1/0
|
237
|
+
end
|
238
|
+
def dont_run
|
239
|
+
assert_block {true}
|
240
|
+
end
|
241
|
+
def test_dont_run(argument)
|
242
|
+
assert_block {true}
|
243
|
+
end
|
244
|
+
def test
|
245
|
+
assert_block {true}
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
suite = tc.suite
|
250
|
+
check("Should have a test suite", suite.instance_of?(TestSuite))
|
251
|
+
check("Should have three tests", suite.size == 3)
|
252
|
+
|
253
|
+
result = TestResult.new
|
254
|
+
suite.run(result) {}
|
255
|
+
check("Should have had three test runs", result.run_count == 3)
|
256
|
+
check("Should have had one test failure", result.failure_count == 1)
|
257
|
+
check("Should have had one test error", result.error_count == 1)
|
258
|
+
end
|
259
|
+
|
260
|
+
def test_setup_teardown
|
261
|
+
tc = Class.new(TestCase) do
|
262
|
+
attr_reader(:setup_called, :teardown_called)
|
263
|
+
def initialize(test)
|
264
|
+
super(test)
|
265
|
+
@setup_called = false
|
266
|
+
@teardown_called = false
|
267
|
+
end
|
268
|
+
def setup
|
269
|
+
@setup_called = true
|
270
|
+
end
|
271
|
+
def teardown
|
272
|
+
@teardown_called = true
|
273
|
+
end
|
274
|
+
def test_succeed
|
275
|
+
assert_block {true}
|
276
|
+
end
|
277
|
+
def test_fail
|
278
|
+
assert_block {false}
|
279
|
+
end
|
280
|
+
def test_error
|
281
|
+
raise "Error!"
|
282
|
+
end
|
283
|
+
end
|
284
|
+
result = TestResult.new
|
285
|
+
|
286
|
+
test = tc.new(:test_succeed)
|
287
|
+
test.run(result) {}
|
288
|
+
check("Should have called setup the correct number of times", test.setup_called)
|
289
|
+
check("Should have called teardown the correct number of times", test.teardown_called)
|
290
|
+
|
291
|
+
test = tc.new(:test_fail)
|
292
|
+
test.run(result) {}
|
293
|
+
check("Should have called setup the correct number of times", test.setup_called)
|
294
|
+
check("Should have called teardown the correct number of times", test.teardown_called)
|
295
|
+
|
296
|
+
test = tc.new(:test_error)
|
297
|
+
test.run(result) {}
|
298
|
+
check("Should have called setup the correct number of times", test.setup_called)
|
299
|
+
check("Should have called teardown the correct number of times", test.teardown_called)
|
300
|
+
|
301
|
+
check("Should have had two test runs", result.run_count == 3)
|
302
|
+
check("Should have had a test failure", result.failure_count == 1)
|
303
|
+
check("Should have had a test error", result.error_count == 1)
|
304
|
+
end
|
305
|
+
|
306
|
+
def test_assertion_failed_not_called
|
307
|
+
tc = Class.new(TestCase) do
|
308
|
+
def test_thing
|
309
|
+
raise AssertionFailedError.new
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
suite = tc.suite
|
314
|
+
check("Should have one test", suite.size == 1)
|
315
|
+
result = TestResult.new
|
316
|
+
suite.run(result) {}
|
317
|
+
check("Should have had one test run", result.run_count == 1)
|
318
|
+
check("Should have had one assertion failure", result.failure_count == 1)
|
319
|
+
check("Should not have any assertion errors but had #{result.error_count}", result.error_count == 0)
|
320
|
+
end
|
321
|
+
|
322
|
+
def test_equality
|
323
|
+
tc1 = Class.new(TestCase) do
|
324
|
+
def test_1
|
325
|
+
end
|
326
|
+
def test_2
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
tc2 = Class.new(TestCase) do
|
331
|
+
def test_1
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
test1 = tc1.new('test_1')
|
336
|
+
test2 = tc1.new('test_1')
|
337
|
+
check("Should be equal", test1 == test2)
|
338
|
+
check("Should be equal", test2 == test1)
|
339
|
+
|
340
|
+
test1 = tc1.new('test_2')
|
341
|
+
check("Should not be equal", test1 != test2)
|
342
|
+
check("Should not be equal", test2 != test1)
|
343
|
+
|
344
|
+
test2 = tc1.new('test_2')
|
345
|
+
check("Should be equal", test1 == test2)
|
346
|
+
check("Should be equal", test2 == test1)
|
347
|
+
|
348
|
+
test1 = tc1.new('test_1')
|
349
|
+
test2 = tc2.new('test_1')
|
350
|
+
check("Should not be equal", test1 != test2)
|
351
|
+
check("Should not be equal", test2 != test1)
|
352
|
+
|
353
|
+
check("Should not be equal", test1 != Object.new)
|
354
|
+
check("Should not be equal", Object.new != test1)
|
355
|
+
end
|
356
|
+
|
357
|
+
def test_re_raise_exception
|
358
|
+
test_case = Class.new(TestCase) do
|
359
|
+
def test_raise_interrupt
|
360
|
+
raise Interrupt, "from test"
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
test = test_case.new("test_raise_interrupt")
|
365
|
+
begin
|
366
|
+
test.run(TestResult.new) {}
|
367
|
+
check("Should not be reached", false)
|
368
|
+
rescue Exception
|
369
|
+
check("Interrupt exception should be re-raised", $!.class == Interrupt)
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
def test_timeout_error
|
374
|
+
test_case = Class.new(TestCase) do
|
375
|
+
def test_raise_timeout_error
|
376
|
+
require "timeout"
|
377
|
+
raise Timeout::Error
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
test_suite = test_case.suite
|
382
|
+
result = TestResult.new
|
383
|
+
begin
|
384
|
+
test_suite.run(result) {}
|
385
|
+
check("Timeout::Error should be handled as error",
|
386
|
+
result.error_count == 1)
|
387
|
+
rescue Exception
|
388
|
+
check("Timeout::Error should not be passed through: #{$!}", false)
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
def test_interrupted
|
393
|
+
test_case = Class.new(TestCase) do
|
394
|
+
def test_fail
|
395
|
+
flunk
|
396
|
+
end
|
397
|
+
|
398
|
+
def test_nothing
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
402
|
+
failed_test = test_case.new(:test_fail)
|
403
|
+
failed_test.run(TestResult.new) {}
|
404
|
+
check("Should be interrupted", failed_test.interrupted?)
|
405
|
+
|
406
|
+
success_test = test_case.new(:test_nothing)
|
407
|
+
success_test.run(TestResult.new) {}
|
408
|
+
check("Should not be interrupted", !success_test.interrupted?)
|
409
|
+
end
|
410
|
+
|
411
|
+
def test_inherited_test_should_be_ignored
|
412
|
+
test_case = Class.new(TestCase) do
|
413
|
+
def test_nothing
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
sub_test_case = Class.new(test_case) do
|
418
|
+
def test_fail
|
419
|
+
flunk
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
test = test_case.new("test_nothing")
|
424
|
+
assert_predicate(test, :valid?)
|
425
|
+
|
426
|
+
test = sub_test_case.new("test_fail")
|
427
|
+
assert_predicate(test, :valid?)
|
428
|
+
|
429
|
+
test = sub_test_case.new("test_nothing")
|
430
|
+
assert_not_predicate(test, :valid?)
|
431
|
+
end
|
432
|
+
|
433
|
+
def test_mixin_test_should_not_be_ignored
|
434
|
+
test_module = Module.new do
|
435
|
+
def test_nothing
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
440
|
+
include test_module
|
441
|
+
|
442
|
+
def test_fail
|
443
|
+
flunk
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
assert_nothing_thrown do
|
448
|
+
test_case.new("test_nothing")
|
449
|
+
end
|
450
|
+
|
451
|
+
assert_nothing_thrown do
|
452
|
+
test_case.new("test_fail")
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
456
|
+
def test_defined_order
|
457
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
458
|
+
def test_z
|
459
|
+
end
|
460
|
+
|
461
|
+
def test_1
|
462
|
+
end
|
463
|
+
|
464
|
+
def test_a
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
assert_equal(["test_1", "test_a", "test_z"],
|
469
|
+
test_case.suite.tests.collect {|test| test.method_name})
|
470
|
+
|
471
|
+
test_case.test_order = :defined
|
472
|
+
assert_equal(["test_z", "test_1", "test_a"],
|
473
|
+
test_case.suite.tests.collect {|test| test.method_name})
|
474
|
+
end
|
475
|
+
|
476
|
+
def test_declarative_style
|
477
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
478
|
+
test "declarative style test definition" do
|
479
|
+
end
|
480
|
+
|
481
|
+
test "include parenthesis" do
|
482
|
+
end
|
483
|
+
|
484
|
+
test "1 + 2 = 3" do
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
488
|
+
test_case.test_order = :defined
|
489
|
+
|
490
|
+
assert_equal(["test: declarative style test definition",
|
491
|
+
"test: include parenthesis",
|
492
|
+
"test: 1 + 2 = 3"],
|
493
|
+
test_case.suite.tests.collect {|test| test.method_name})
|
494
|
+
|
495
|
+
assert_equal(["declarative style test definition",
|
496
|
+
"include parenthesis",
|
497
|
+
"1 + 2 = 3"],
|
498
|
+
test_case.suite.tests.collect {|test| test.description})
|
499
|
+
end
|
500
|
+
|
501
|
+
def test_test_mark
|
502
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
503
|
+
test
|
504
|
+
def my_test_method
|
505
|
+
end
|
506
|
+
end
|
507
|
+
|
508
|
+
test_case.test_order = :defined
|
509
|
+
|
510
|
+
assert_equal(["my_test_method"],
|
511
|
+
test_case.suite.tests.collect {|test| test.method_name})
|
512
|
+
end
|
513
|
+
|
514
|
+
def test_redefine_method
|
515
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
516
|
+
def test_name
|
517
|
+
end
|
518
|
+
alias_method :test_name2, :test_name
|
519
|
+
|
520
|
+
def test_name
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
524
|
+
suite = test_case.suite
|
525
|
+
assert_equal(["test_name", "test_name2"],
|
526
|
+
suite.tests.collect {|test| test.method_name})
|
527
|
+
result = TestResult.new
|
528
|
+
suite.run(result) {}
|
529
|
+
assert_equal("2 tests, 0 assertions, 0 failures, " +
|
530
|
+
"0 errors, 0 pendings, 0 omissions, 1 notifications",
|
531
|
+
result.summary)
|
532
|
+
end
|
533
|
+
|
534
|
+
def test_data_driven_test
|
535
|
+
test_case = Class.new(TestCase) do
|
536
|
+
def test_with_data(data)
|
537
|
+
end
|
538
|
+
end
|
539
|
+
|
540
|
+
test = test_case.new("test_with_data")
|
541
|
+
assert_not_predicate(test, :valid?)
|
542
|
+
test.assign_test_data("label1", :test_data1)
|
543
|
+
assert_predicate(test, :valid?)
|
544
|
+
end
|
545
|
+
|
546
|
+
private
|
547
|
+
def check(message, passed)
|
548
|
+
add_assertion
|
549
|
+
raise AssertionFailedError.new(message) unless passed
|
550
|
+
end
|
551
|
+
|
552
|
+
class TestTestDefined < self
|
553
|
+
class TestNoQuery < self
|
554
|
+
def test_no_test
|
555
|
+
test_case = Class.new(TestCase) do
|
556
|
+
end
|
557
|
+
assert_false(test_case.test_defined?({}))
|
558
|
+
end
|
559
|
+
|
560
|
+
def test_have_def_style_test
|
561
|
+
test_case = Class.new(TestCase) do
|
562
|
+
def test_nothing
|
563
|
+
end
|
564
|
+
end
|
565
|
+
assert_true(test_case.test_defined?({}))
|
566
|
+
end
|
567
|
+
|
568
|
+
def test_have_method_style_test
|
569
|
+
test_case = Class.new(TestCase) do
|
570
|
+
test "nothing" do
|
571
|
+
end
|
572
|
+
end
|
573
|
+
assert_true(test_case.test_defined?({}))
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
class TestPath < self
|
578
|
+
class TestDefStyle < self
|
579
|
+
def test_base_name
|
580
|
+
test_case = Class.new(TestCase) do
|
581
|
+
def test_nothing
|
582
|
+
end
|
583
|
+
end
|
584
|
+
base_name = File.basename(__FILE__)
|
585
|
+
assert_true(test_case.test_defined?(:path => base_name))
|
586
|
+
end
|
587
|
+
|
588
|
+
def test_absolute_path
|
589
|
+
test_case = Class.new(TestCase) do
|
590
|
+
def test_nothing
|
591
|
+
end
|
592
|
+
end
|
593
|
+
assert_true(test_case.test_defined?(:path => __FILE__))
|
594
|
+
end
|
595
|
+
|
596
|
+
def test_not_match
|
597
|
+
test_case = Class.new(TestCase) do
|
598
|
+
def test_nothing
|
599
|
+
end
|
600
|
+
end
|
601
|
+
assert_false(test_case.test_defined?(:path => "nonexistent.rb"))
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
class TestMethodStyle < self
|
606
|
+
def test_base_name
|
607
|
+
test_case = Class.new(TestCase) do
|
608
|
+
test "nothing" do
|
609
|
+
end
|
610
|
+
end
|
611
|
+
base_name = File.basename(__FILE__)
|
612
|
+
assert_true(test_case.test_defined?(:path => base_name))
|
613
|
+
end
|
614
|
+
|
615
|
+
def test_absolute_path
|
616
|
+
test_case = Class.new(TestCase) do
|
617
|
+
test "nothing" do
|
618
|
+
end
|
619
|
+
end
|
620
|
+
assert_true(test_case.test_defined?(:path => __FILE__))
|
621
|
+
end
|
622
|
+
|
623
|
+
def test_not_match
|
624
|
+
test_case = Class.new(TestCase) do
|
625
|
+
test "nothing" do
|
626
|
+
end
|
627
|
+
end
|
628
|
+
assert_false(test_case.test_defined?(:path => "nonexistent.rb"))
|
629
|
+
end
|
630
|
+
end
|
631
|
+
end
|
632
|
+
|
633
|
+
class TestLine < self
|
634
|
+
class TestDefStyle < self
|
635
|
+
def test_before
|
636
|
+
line_before = nil
|
637
|
+
test_case = Class.new(TestCase) do
|
638
|
+
line_before = __LINE__
|
639
|
+
def test_nothing
|
640
|
+
end
|
641
|
+
end
|
642
|
+
assert_false(test_case.test_defined?(:line => line_before))
|
643
|
+
end
|
644
|
+
|
645
|
+
def test_def
|
646
|
+
line_def = nil
|
647
|
+
test_case = Class.new(TestCase) do
|
648
|
+
line_def = __LINE__; def test_nothing
|
649
|
+
end
|
650
|
+
end
|
651
|
+
assert_true(test_case.test_defined?(:line => line_def))
|
652
|
+
end
|
653
|
+
|
654
|
+
def test_after
|
655
|
+
line_after = nil
|
656
|
+
test_case = Class.new(TestCase) do
|
657
|
+
def test_nothing
|
658
|
+
end
|
659
|
+
line_after = __LINE__
|
660
|
+
end
|
661
|
+
assert_true(test_case.test_defined?(:line => line_after))
|
662
|
+
end
|
663
|
+
|
664
|
+
def test_child
|
665
|
+
child_test_case = nil
|
666
|
+
line_child = nil
|
667
|
+
parent_test_case = Class.new(TestCase) do
|
668
|
+
test "parent" do
|
669
|
+
end
|
670
|
+
|
671
|
+
child_test_case = Class.new(self) do
|
672
|
+
line_child = __LINE__; test "child" do
|
673
|
+
end
|
674
|
+
end
|
675
|
+
end
|
676
|
+
assert_equal([
|
677
|
+
false,
|
678
|
+
true,
|
679
|
+
],
|
680
|
+
[
|
681
|
+
parent_test_case.test_defined?(:line => line_child),
|
682
|
+
child_test_case.test_defined?(:line => line_child),
|
683
|
+
])
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
class TestMethodStyle < self
|
688
|
+
def test_before
|
689
|
+
line_before = nil
|
690
|
+
test_case = Class.new(TestCase) do
|
691
|
+
line_before = __LINE__
|
692
|
+
test "nothing" do
|
693
|
+
end
|
694
|
+
end
|
695
|
+
assert_false(test_case.test_defined?(:line => line_before))
|
696
|
+
end
|
697
|
+
|
698
|
+
def test_method
|
699
|
+
line_method = nil
|
700
|
+
test_case = Class.new(TestCase) do
|
701
|
+
line_method = __LINE__; test "nothing" do
|
702
|
+
end
|
703
|
+
end
|
704
|
+
assert_true(test_case.test_defined?(:line => line_method))
|
705
|
+
end
|
706
|
+
|
707
|
+
def test_after
|
708
|
+
line_after = nil
|
709
|
+
test_case = Class.new(TestCase) do
|
710
|
+
test "nothing" do
|
711
|
+
end
|
712
|
+
line_after = __LINE__
|
713
|
+
end
|
714
|
+
assert_true(test_case.test_defined?(:line => line_after))
|
715
|
+
end
|
716
|
+
|
717
|
+
def test_child
|
718
|
+
child_test_case = nil
|
719
|
+
line_child = nil
|
720
|
+
parent_test_case = Class.new(TestCase) do
|
721
|
+
test "parent" do
|
722
|
+
end
|
723
|
+
|
724
|
+
child_test_case = Class.new(self) do
|
725
|
+
line_child = __LINE__; test "child" do
|
726
|
+
end
|
727
|
+
end
|
728
|
+
end
|
729
|
+
assert_equal([
|
730
|
+
false,
|
731
|
+
true,
|
732
|
+
],
|
733
|
+
[
|
734
|
+
parent_test_case.test_defined?(:line => line_child),
|
735
|
+
child_test_case.test_defined?(:line => line_child),
|
736
|
+
])
|
737
|
+
end
|
738
|
+
end
|
739
|
+
end
|
740
|
+
|
741
|
+
class TestMethodName < self
|
742
|
+
class TestDefStyle < self
|
743
|
+
def test_match
|
744
|
+
test_case = Class.new(TestCase) do
|
745
|
+
def test_nothing
|
746
|
+
end
|
747
|
+
end
|
748
|
+
query = {:method_name => "test_nothing"}
|
749
|
+
assert_true(test_case.test_defined?(query))
|
750
|
+
end
|
751
|
+
|
752
|
+
def test_not_match
|
753
|
+
test_case = Class.new(TestCase) do
|
754
|
+
def test_nothing
|
755
|
+
end
|
756
|
+
end
|
757
|
+
query = {:method_name => "test_nonexistent"}
|
758
|
+
assert_false(test_case.test_defined?(query))
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
762
|
+
class TestMethodStyle < self
|
763
|
+
def test_match
|
764
|
+
test_case = Class.new(TestCase) do
|
765
|
+
test "nothing" do
|
766
|
+
end
|
767
|
+
end
|
768
|
+
query = {:method_name => "test: nothing"}
|
769
|
+
assert_true(test_case.test_defined?(query))
|
770
|
+
end
|
771
|
+
|
772
|
+
def test_not_match
|
773
|
+
test_case = Class.new(TestCase) do
|
774
|
+
test "nothing" do
|
775
|
+
end
|
776
|
+
end
|
777
|
+
query = {:method_name => "test: nonexistent"}
|
778
|
+
assert_false(test_case.test_defined?(query))
|
779
|
+
end
|
780
|
+
end
|
781
|
+
end
|
782
|
+
|
783
|
+
class TestCombine < self
|
784
|
+
class TestDefStyle < self
|
785
|
+
def test_line_middle
|
786
|
+
line_middle = nil
|
787
|
+
test_case = Class.new(TestCase) do
|
788
|
+
def test_before
|
789
|
+
end
|
790
|
+
line_middle = __LINE__
|
791
|
+
def test_after
|
792
|
+
end
|
793
|
+
end
|
794
|
+
query = {
|
795
|
+
:path => __FILE__,
|
796
|
+
:line => line_middle,
|
797
|
+
:method_name => "test_before",
|
798
|
+
}
|
799
|
+
assert_true(test_case.test_defined?(query))
|
800
|
+
end
|
801
|
+
|
802
|
+
def test_line_after_def
|
803
|
+
line_after_def = nil
|
804
|
+
test_case = Class.new(TestCase) do
|
805
|
+
def test_before
|
806
|
+
end
|
807
|
+
|
808
|
+
line_after_def = __LINE__; def test_after
|
809
|
+
end
|
810
|
+
end
|
811
|
+
query = {
|
812
|
+
:path => __FILE__,
|
813
|
+
:line => line_after_def,
|
814
|
+
:method_name => "test_before",
|
815
|
+
}
|
816
|
+
assert_false(test_case.test_defined?(query))
|
817
|
+
end
|
818
|
+
end
|
819
|
+
|
820
|
+
class TestMethodStyle < self
|
821
|
+
def test_line_middle
|
822
|
+
line_middle = nil
|
823
|
+
test_case = Class.new(TestCase) do
|
824
|
+
test "before" do
|
825
|
+
end
|
826
|
+
line_middle = __LINE__
|
827
|
+
test "after" do
|
828
|
+
end
|
829
|
+
end
|
830
|
+
query = {
|
831
|
+
:path => __FILE__,
|
832
|
+
:line => line_middle,
|
833
|
+
:method_name => "test: before",
|
834
|
+
}
|
835
|
+
assert_true(test_case.test_defined?(query))
|
836
|
+
end
|
837
|
+
|
838
|
+
def test_line_after_method
|
839
|
+
line_after_method = nil
|
840
|
+
test_case = Class.new(TestCase) do
|
841
|
+
test "before" do
|
842
|
+
end
|
843
|
+
|
844
|
+
line_after_method = __LINE__; test "after" do
|
845
|
+
end
|
846
|
+
end
|
847
|
+
query = {
|
848
|
+
:path => __FILE__,
|
849
|
+
:line => line_after_method,
|
850
|
+
:method_name => "test: before",
|
851
|
+
}
|
852
|
+
assert_false(test_case.test_defined?(query))
|
853
|
+
end
|
854
|
+
end
|
855
|
+
end
|
856
|
+
end
|
857
|
+
|
858
|
+
class TestSubTestCase < self
|
859
|
+
class TestName < self
|
860
|
+
def test_anonymous
|
861
|
+
test_case = Class.new(TestCase)
|
862
|
+
sub_test_case = test_case.sub_test_case("sub test case") do
|
863
|
+
end
|
864
|
+
assert_equal("sub test case", sub_test_case.name)
|
865
|
+
end
|
866
|
+
|
867
|
+
def test_named
|
868
|
+
test_case = Class.new(TestCase)
|
869
|
+
def test_case.name
|
870
|
+
"ParentTestCase"
|
871
|
+
end
|
872
|
+
sub_test_case = test_case.sub_test_case("sub test case") do
|
873
|
+
end
|
874
|
+
assert_equal("ParentTestCase::sub test case", sub_test_case.name)
|
875
|
+
end
|
876
|
+
end
|
877
|
+
|
878
|
+
def test_suite
|
879
|
+
test_case = Class.new(TestCase)
|
880
|
+
sub_test_case = test_case.sub_test_case("sub test case") do
|
881
|
+
def test_nothing
|
882
|
+
end
|
883
|
+
end
|
884
|
+
test_method_names = sub_test_case.suite.tests.collect do |test|
|
885
|
+
test.method_name
|
886
|
+
end
|
887
|
+
assert_equal(["test_nothing"], test_method_names)
|
888
|
+
end
|
889
|
+
|
890
|
+
def test_duplicated_name
|
891
|
+
test_case = Class.new(TestCase) do
|
892
|
+
def test_nothing
|
893
|
+
end
|
894
|
+
end
|
895
|
+
sub_test_case = test_case.sub_test_case("sub test case") do
|
896
|
+
def test_nothing
|
897
|
+
end
|
898
|
+
end
|
899
|
+
|
900
|
+
test_method_names = test_case.suite.tests.collect do |test|
|
901
|
+
test.method_name
|
902
|
+
end
|
903
|
+
sub_test_method_names = sub_test_case.suite.tests.collect do |test|
|
904
|
+
test.method_name
|
905
|
+
end
|
906
|
+
|
907
|
+
assert_equal([
|
908
|
+
["test_nothing"],
|
909
|
+
["test_nothing"],
|
910
|
+
],
|
911
|
+
[
|
912
|
+
test_method_names,
|
913
|
+
sub_test_method_names,
|
914
|
+
])
|
915
|
+
end
|
916
|
+
end
|
917
|
+
|
918
|
+
class TestStartupShutdown < self
|
919
|
+
class TestOrder < self
|
920
|
+
module CallLogger
|
921
|
+
def called
|
922
|
+
@@called ||= []
|
923
|
+
end
|
924
|
+
end
|
925
|
+
|
926
|
+
def call_order(test_case)
|
927
|
+
test_case.called.clear
|
928
|
+
test_suite = test_case.suite
|
929
|
+
test_suite.run(TestResult.new) {}
|
930
|
+
test_case.called
|
931
|
+
end
|
932
|
+
|
933
|
+
class TestNoInheritance < self
|
934
|
+
def setup
|
935
|
+
@test_case = Class.new(TestCase) do
|
936
|
+
extend CallLogger
|
937
|
+
|
938
|
+
class << self
|
939
|
+
def startup
|
940
|
+
called << :startup
|
941
|
+
end
|
942
|
+
|
943
|
+
def shutdown
|
944
|
+
called << :shutdown
|
945
|
+
end
|
946
|
+
end
|
947
|
+
|
948
|
+
def setup
|
949
|
+
self.class.called << :setup
|
950
|
+
end
|
951
|
+
|
952
|
+
def teardown
|
953
|
+
self.class.called << :teardown
|
954
|
+
end
|
955
|
+
|
956
|
+
def test1
|
957
|
+
end
|
958
|
+
|
959
|
+
def test2
|
960
|
+
end
|
961
|
+
end
|
962
|
+
end
|
963
|
+
|
964
|
+
def test_call_order
|
965
|
+
assert_equal([
|
966
|
+
:startup,
|
967
|
+
:setup, :teardown,
|
968
|
+
:setup, :teardown,
|
969
|
+
:shutdown,
|
970
|
+
],
|
971
|
+
call_order(@test_case))
|
972
|
+
end
|
973
|
+
end
|
974
|
+
|
975
|
+
class TestInheritance < self
|
976
|
+
def setup
|
977
|
+
@original_descendants = TestCase::DESCENDANTS.dup
|
978
|
+
TestCase::DESCENDANTS.clear
|
979
|
+
|
980
|
+
@parent_test_case = Class.new(TestCase) do
|
981
|
+
extend CallLogger
|
982
|
+
|
983
|
+
class << self
|
984
|
+
def startup
|
985
|
+
called << :startup_parent
|
986
|
+
end
|
987
|
+
|
988
|
+
def shutdown
|
989
|
+
called << :shutdown_parent
|
990
|
+
end
|
991
|
+
end
|
992
|
+
|
993
|
+
def setup
|
994
|
+
self.class.called << :setup_parent
|
995
|
+
end
|
996
|
+
|
997
|
+
def teardown
|
998
|
+
self.class.called << :teardown_parent
|
999
|
+
end
|
1000
|
+
|
1001
|
+
def test1_parent
|
1002
|
+
self.class.called << :test1_parent
|
1003
|
+
end
|
1004
|
+
|
1005
|
+
def test2_parent
|
1006
|
+
self.class.called << :test2_parent
|
1007
|
+
end
|
1008
|
+
end
|
1009
|
+
|
1010
|
+
@child_test_case = Class.new(@parent_test_case) do
|
1011
|
+
class << self
|
1012
|
+
def startup
|
1013
|
+
called << :startup_child
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
def shutdown
|
1017
|
+
called << :shutdown_child
|
1018
|
+
end
|
1019
|
+
end
|
1020
|
+
|
1021
|
+
def setup
|
1022
|
+
self.class.called << :setup_child
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
def teardown
|
1026
|
+
self.class.called << :teardown_child
|
1027
|
+
end
|
1028
|
+
|
1029
|
+
def test1_child
|
1030
|
+
self.class.called << :test1_child
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
def test2_child
|
1034
|
+
self.class.called << :test2_child
|
1035
|
+
end
|
1036
|
+
end
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
def teardown
|
1040
|
+
TestCase::DESCENDANTS.replace(@original_descendants)
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
def test_call_order
|
1044
|
+
collector = Collector::Descendant.new
|
1045
|
+
test_suite = collector.collect
|
1046
|
+
test_suite.run(TestResult.new) {}
|
1047
|
+
called = @parent_test_case.called
|
1048
|
+
assert_equal([
|
1049
|
+
:startup_parent,
|
1050
|
+
:setup_parent, :test1_parent, :teardown_parent,
|
1051
|
+
:setup_parent, :test2_parent, :teardown_parent,
|
1052
|
+
:startup_child,
|
1053
|
+
:setup_child, :test1_child, :teardown_child,
|
1054
|
+
:setup_child, :test2_child, :teardown_child,
|
1055
|
+
:shutdown_child,
|
1056
|
+
:shutdown_parent,
|
1057
|
+
],
|
1058
|
+
called)
|
1059
|
+
end
|
1060
|
+
end
|
1061
|
+
end
|
1062
|
+
|
1063
|
+
class TestError < self
|
1064
|
+
def run_test_case(test_case)
|
1065
|
+
test_suite = test_case.suite
|
1066
|
+
result = TestResult.new
|
1067
|
+
test_suite.run(result) {}
|
1068
|
+
result
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
def error_count(test_case)
|
1072
|
+
run_test_case(test_case).error_count
|
1073
|
+
end
|
1074
|
+
|
1075
|
+
def test_on_startup
|
1076
|
+
test_case = Class.new(TestCase) do
|
1077
|
+
class << self
|
1078
|
+
def startup
|
1079
|
+
raise "from startup"
|
1080
|
+
end
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
def test_nothing
|
1084
|
+
end
|
1085
|
+
end
|
1086
|
+
|
1087
|
+
assert_equal(1, error_count(test_case))
|
1088
|
+
end
|
1089
|
+
|
1090
|
+
def test_pass_through_on_startup
|
1091
|
+
test_case = Class.new(TestCase) do
|
1092
|
+
class << self
|
1093
|
+
def startup
|
1094
|
+
raise Interrupt, "from startup"
|
1095
|
+
end
|
1096
|
+
end
|
1097
|
+
|
1098
|
+
def test_nothing
|
1099
|
+
end
|
1100
|
+
end
|
1101
|
+
|
1102
|
+
assert_raise(Interrupt) do
|
1103
|
+
run_test_case(test_case)
|
1104
|
+
end
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
def test_on_shutdown
|
1108
|
+
test_case = Class.new(TestCase) do
|
1109
|
+
class << self
|
1110
|
+
def shutdown
|
1111
|
+
raise "from shutdown"
|
1112
|
+
end
|
1113
|
+
end
|
1114
|
+
|
1115
|
+
def test_nothing
|
1116
|
+
end
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
assert_equal(1, error_count(test_case))
|
1120
|
+
end
|
1121
|
+
|
1122
|
+
def test_pass_through_on_shutdown
|
1123
|
+
test_case = Class.new(TestCase) do
|
1124
|
+
class << self
|
1125
|
+
def shutdown
|
1126
|
+
raise Interrupt, "from shutdown"
|
1127
|
+
end
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
def test_nothing
|
1131
|
+
end
|
1132
|
+
end
|
1133
|
+
|
1134
|
+
assert_raise(Interrupt) do
|
1135
|
+
run_test_case(test_case)
|
1136
|
+
end
|
1137
|
+
end
|
1138
|
+
|
1139
|
+
def test_pass_through_in_test
|
1140
|
+
test_case = Class.new(TestCase) do
|
1141
|
+
@called = []
|
1142
|
+
class << self
|
1143
|
+
def called
|
1144
|
+
@called
|
1145
|
+
end
|
1146
|
+
|
1147
|
+
def startup
|
1148
|
+
@called << :startup
|
1149
|
+
end
|
1150
|
+
|
1151
|
+
def shutdown
|
1152
|
+
@called << :shutdown
|
1153
|
+
end
|
1154
|
+
end
|
1155
|
+
|
1156
|
+
def test_error
|
1157
|
+
raise Interrupt, "from test"
|
1158
|
+
end
|
1159
|
+
end
|
1160
|
+
|
1161
|
+
assert_raise(Interrupt) do
|
1162
|
+
run_test_case(test_case)
|
1163
|
+
end
|
1164
|
+
assert_equal([:startup, :shutdown],
|
1165
|
+
test_case.called)
|
1166
|
+
end
|
1167
|
+
end
|
1168
|
+
end
|
1169
|
+
end
|
1170
|
+
end
|
1171
|
+
end
|