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,60 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'test/unit/ui/emacs/testrunner'
|
3
|
+
|
4
|
+
class TestUnitEmacsRunner < Test::Unit::TestCase
|
5
|
+
def test_format_failure_with_a_location
|
6
|
+
runner = create_runner
|
7
|
+
test_name = "test_failure"
|
8
|
+
file = "/home/user/test_xxx.rb"
|
9
|
+
line = "3"
|
10
|
+
info = "in `xxx'"
|
11
|
+
location = "#{file}:#{line}: #{info}"
|
12
|
+
message = "FAIL!!!"
|
13
|
+
failure = Test::Unit::Failure.new(test_name, [location], message)
|
14
|
+
assert_equal(<<-EOM.chomp, runner.send(:format_fault, failure))
|
15
|
+
Failure:
|
16
|
+
#{test_name} [#{file}:#{line}]:
|
17
|
+
#{message}
|
18
|
+
EOM
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_format_failure_with_locations
|
22
|
+
runner = create_runner
|
23
|
+
test_name = "test_failure"
|
24
|
+
locations = ["/home/user/test_xxx.rb:3: in `xxx'",
|
25
|
+
"/home/user/yyy/test_yyy.rb:999: in `yyy'",
|
26
|
+
"/home/user/xyz/zzz.rb:29: in `zzz'"]
|
27
|
+
message = "Many backtrace!!!"
|
28
|
+
failure = Test::Unit::Failure.new(test_name, locations, message)
|
29
|
+
assert_equal(<<-EOM.chomp, runner.send(:format_fault, failure))
|
30
|
+
Failure:
|
31
|
+
#{test_name}
|
32
|
+
#{locations.join("\n")}:
|
33
|
+
#{message}
|
34
|
+
EOM
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_format_error
|
38
|
+
runner = create_runner
|
39
|
+
test_name = "test_error"
|
40
|
+
message = "Error Message!!!"
|
41
|
+
backtrace = ["/home/user/test_xxx.rb:3: in `xxx'",
|
42
|
+
"/home/user/yyy/test_yyy.rb:999: in `yyy'",
|
43
|
+
"/home/user/xyz/zzz.rb:29: in `zzz'"]
|
44
|
+
exception = RuntimeError.new(message)
|
45
|
+
exception.set_backtrace(backtrace)
|
46
|
+
error = Test::Unit::Error.new(test_name, exception)
|
47
|
+
assert_equal(<<-EOM.chomp, runner.send(:format_fault, error))
|
48
|
+
Error:
|
49
|
+
#{test_name}:
|
50
|
+
#{exception.class.name}: #{message}
|
51
|
+
#{backtrace.join("\n")}
|
52
|
+
EOM
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
def create_runner(suite=nil)
|
57
|
+
suite ||= Test::Unit::TestSuite.new
|
58
|
+
Test::Unit::UI::Emacs::TestRunner.new(suite)
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Author:: Nathaniel Talbott.
|
2
|
+
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
3
|
+
# License:: Ruby license.
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
|
7
|
+
module Test
|
8
|
+
module Unit
|
9
|
+
class TC_Error < TestCase
|
10
|
+
TF_Exception = Struct.new('TF_Exception', :message, :backtrace)
|
11
|
+
def test_display
|
12
|
+
ex = TF_Exception.new("message1\nmessage2", ['line1', 'line2'])
|
13
|
+
e = Error.new("name", ex)
|
14
|
+
assert_equal("name: #{TF_Exception.name}: message1", e.short_display)
|
15
|
+
assert_equal(<<EOM.strip, e.long_display)
|
16
|
+
Error:
|
17
|
+
name:
|
18
|
+
Struct::TF_Exception: message1
|
19
|
+
message2
|
20
|
+
line1
|
21
|
+
line2
|
22
|
+
EOM
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Author:: Nathaniel Talbott.
|
2
|
+
# Copyright:: Copyright (c) 2003 Nathaniel Talbott. All rights reserved.
|
3
|
+
# License:: Ruby license.
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'test/unit/failure'
|
7
|
+
|
8
|
+
module Test::Unit
|
9
|
+
class TestFailure < TestCase
|
10
|
+
def test_display
|
11
|
+
f = Failure.new("name", [%q{location:1 in 'l'}], "message1\nmessage2")
|
12
|
+
assert_equal("name: message1", f.short_display)
|
13
|
+
assert_equal(<<EOM.strip, f.long_display)
|
14
|
+
Failure:
|
15
|
+
name [location:1]:
|
16
|
+
message1
|
17
|
+
message2
|
18
|
+
EOM
|
19
|
+
|
20
|
+
f = Failure.new("name", [%q{location1:2 in 'l1'}, 'location2:1', %q{location3:3 in 'l3'}], "message1\nmessage2")
|
21
|
+
assert_equal("name: message1", f.short_display)
|
22
|
+
assert_equal(<<EOM.strip, f.long_display)
|
23
|
+
Failure:
|
24
|
+
name
|
25
|
+
[location1:2 in 'l1'
|
26
|
+
location2:1
|
27
|
+
location3:3 in 'l3']:
|
28
|
+
message1
|
29
|
+
message2
|
30
|
+
EOM
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# License: Ruby's
|
4
|
+
|
5
|
+
require "test-unit"
|
6
|
+
require "test/unit/fault-location-detector"
|
7
|
+
require "testunit-test-util"
|
8
|
+
|
9
|
+
class TestFaultLocationDetector < Test::Unit::TestCase
|
10
|
+
include TestUnitTestUtil
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@fetcher = Test::Unit::CodeSnippetFetcher.new
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
def run_test_case(test_case)
|
18
|
+
suite = test_case.suite
|
19
|
+
result = Test::Unit::TestResult.new
|
20
|
+
suite.run(result) {}
|
21
|
+
result.faults[0]
|
22
|
+
end
|
23
|
+
|
24
|
+
def assert_detect(fault, target_line_number)
|
25
|
+
detector = Test::Unit::FaultLocationDetector.new(fault, @fetcher)
|
26
|
+
|
27
|
+
expected_backtrace_entries_until_detected = []
|
28
|
+
fault.location.each do |backtrace_entry|
|
29
|
+
expected_backtrace_entries_until_detected << backtrace_entry
|
30
|
+
_, line_number, = detector.split_backtrace_entry(backtrace_entry)
|
31
|
+
break if target_line_number == line_number
|
32
|
+
end
|
33
|
+
|
34
|
+
actual_backtrace_entries_until_detected = []
|
35
|
+
fault.location.each do |backtrace_entry|
|
36
|
+
actual_backtrace_entries_until_detected << backtrace_entry
|
37
|
+
break if detector.target?(backtrace_entry)
|
38
|
+
end
|
39
|
+
|
40
|
+
assert_equal(expected_backtrace_entries_until_detected,
|
41
|
+
actual_backtrace_entries_until_detected)
|
42
|
+
end
|
43
|
+
|
44
|
+
module AlwaysFailAssertion
|
45
|
+
private
|
46
|
+
def assert_always_failed
|
47
|
+
assert_true(false)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class TestSourceLocation < self
|
52
|
+
setup
|
53
|
+
def setup_check_source_location
|
54
|
+
unless lambda {}.respond_to?(:source_location)
|
55
|
+
omit("Need Proc#source_location")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_detected
|
60
|
+
target_line_number = nil
|
61
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
62
|
+
include AlwaysFailAssertion
|
63
|
+
|
64
|
+
test "failed" do
|
65
|
+
target_line_number = __LINE__; assert_always_failed
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
fault = run_test_case(test_case)
|
70
|
+
assert_detect(fault, target_line_number)
|
71
|
+
end
|
72
|
+
|
73
|
+
class TestOneLine < self
|
74
|
+
def test_brace
|
75
|
+
target_line_number = nil
|
76
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
77
|
+
include AlwaysFailAssertion
|
78
|
+
|
79
|
+
test("failed") {target_line_number = __LINE__; assert_always_failed}
|
80
|
+
|
81
|
+
def other_method
|
82
|
+
# body
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
fault = run_test_case(test_case)
|
87
|
+
assert_detect(fault, target_line_number)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_do_end
|
91
|
+
target_line_number = nil
|
92
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
93
|
+
include AlwaysFailAssertion
|
94
|
+
|
95
|
+
test "failed" do target_line_number = __LINE__; assert_always_failed; end
|
96
|
+
|
97
|
+
def other_method
|
98
|
+
# body
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
fault = run_test_case(test_case)
|
103
|
+
assert_detect(fault, target_line_number)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class TestMethodName < self
|
109
|
+
def test_detected
|
110
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
111
|
+
include AlwaysFailAssertion
|
112
|
+
|
113
|
+
class << self
|
114
|
+
def target_line_number
|
115
|
+
@@target_line_number
|
116
|
+
end
|
117
|
+
|
118
|
+
def target_line_number=(line_number)
|
119
|
+
@@target_line_number = line_number
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_failed
|
124
|
+
self.class.target_line_number = __LINE__; assert_always_failed
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
fault = run_test_case(test_case)
|
129
|
+
assert_detect(fault, test_case.target_line_number)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
class TestInBlock < self
|
134
|
+
def test_in_block
|
135
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
136
|
+
include AlwaysFailAssertion
|
137
|
+
|
138
|
+
class << self
|
139
|
+
def target_line_number
|
140
|
+
@@target_line_number
|
141
|
+
end
|
142
|
+
|
143
|
+
def target_line_number=(line_number)
|
144
|
+
@@target_line_number = line_number
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def run_yield
|
149
|
+
yield
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_failed
|
153
|
+
run_yield do
|
154
|
+
self.class.target_line_number = __LINE__; assert_always_failed
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
fault = run_test_case(test_case)
|
160
|
+
assert_detect(fault, test_case.target_line_number)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
@@ -0,0 +1,713 @@
|
|
1
|
+
class TestUnitFixture < Test::Unit::TestCase
|
2
|
+
module EmptyModule
|
3
|
+
end
|
4
|
+
|
5
|
+
class TestSetup < self
|
6
|
+
def test_without_option
|
7
|
+
expected_setup_calls = [:setup,
|
8
|
+
:custom_setup_method0,
|
9
|
+
:custom_setup_callback0,
|
10
|
+
:custom_setup_method1,
|
11
|
+
:custom_setup_callback1,
|
12
|
+
:custom_setup_method3,
|
13
|
+
:custom_setup_callback3]
|
14
|
+
test_case = assert_setup(expected_setup_calls, [])
|
15
|
+
assert_inherited_setup(expected_setup_calls, test_case)
|
16
|
+
|
17
|
+
assert_inherited_setup([:setup], nil)
|
18
|
+
assert_called_fixtures(expected_setup_calls, test_case)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_with_before_option
|
22
|
+
expected_setup_calls = [:custom_setup_callback3,
|
23
|
+
:custom_setup_method3,
|
24
|
+
:custom_setup_method0,
|
25
|
+
:custom_setup_callback0,
|
26
|
+
:custom_setup_method1,
|
27
|
+
:custom_setup_callback1,
|
28
|
+
:setup]
|
29
|
+
test_case = assert_setup(expected_setup_calls,
|
30
|
+
[[{:before => :append}],
|
31
|
+
[{:before => :append}],
|
32
|
+
[{:before => :prepend}],
|
33
|
+
[{:before => :prepend}]])
|
34
|
+
assert_inherited_setup(expected_setup_calls, test_case)
|
35
|
+
|
36
|
+
assert_inherited_setup([:setup], nil)
|
37
|
+
assert_called_fixtures(expected_setup_calls, test_case)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_with_after_option
|
41
|
+
expected_setup_calls = [:setup,
|
42
|
+
:custom_setup_callback3,
|
43
|
+
:custom_setup_method3,
|
44
|
+
:custom_setup_method0,
|
45
|
+
:custom_setup_callback0,
|
46
|
+
:custom_setup_method1,
|
47
|
+
:custom_setup_callback1]
|
48
|
+
test_case = assert_setup(expected_setup_calls,
|
49
|
+
[[{:after => :append}],
|
50
|
+
[{:after => :append}],
|
51
|
+
[{:after => :prepend}],
|
52
|
+
[{:after => :prepend}]])
|
53
|
+
assert_inherited_setup(expected_setup_calls, test_case)
|
54
|
+
|
55
|
+
assert_inherited_setup([:setup], nil)
|
56
|
+
assert_called_fixtures(expected_setup_calls, test_case)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_with_invalid_option
|
60
|
+
assert_invalid_setup_option(:unknown => true)
|
61
|
+
assert_invalid_setup_option(:before => :unknown)
|
62
|
+
assert_invalid_setup_option(:after => :unknown)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_with_option_to_inherited
|
66
|
+
expected_setup_calls = [:setup]
|
67
|
+
test_case = assert_setup(expected_setup_calls, nil)
|
68
|
+
assert_inherited_setup([:setup,
|
69
|
+
:custom_setup_method0,
|
70
|
+
:custom_setup_callback0,
|
71
|
+
:custom_setup_method1,
|
72
|
+
:custom_setup_callback1,
|
73
|
+
:custom_setup_method3,
|
74
|
+
:custom_setup_callback3],
|
75
|
+
test_case,
|
76
|
+
[])
|
77
|
+
|
78
|
+
assert_inherited_setup([:setup], nil)
|
79
|
+
assert_called_fixtures(expected_setup_calls, test_case)
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
def assert_setup_customizable(expected, parent, options)
|
84
|
+
test_case = Class.new(parent || Test::Unit::TestCase) do
|
85
|
+
yield(self, :before) if block_given?
|
86
|
+
|
87
|
+
def called_ids
|
88
|
+
@called_ids ||= []
|
89
|
+
end
|
90
|
+
|
91
|
+
def called(id)
|
92
|
+
called_ids << id
|
93
|
+
end
|
94
|
+
|
95
|
+
def setup
|
96
|
+
called(:setup)
|
97
|
+
end
|
98
|
+
|
99
|
+
setup(*(options[0] || [])) if options
|
100
|
+
def custom_setup_method0
|
101
|
+
called(:custom_setup_method0)
|
102
|
+
end
|
103
|
+
|
104
|
+
if options
|
105
|
+
setup(*(options[0] || [])) do
|
106
|
+
called(:custom_setup_callback0)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def custom_setup_method1
|
111
|
+
called(:custom_setup_method1)
|
112
|
+
end
|
113
|
+
setup(*[:custom_setup_method1, *(options[1] || [])]) if options
|
114
|
+
|
115
|
+
if options
|
116
|
+
setup(*(options[1] || [])) do
|
117
|
+
called(:custom_setup_callback1)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
setup(*(options[2] || [])) if options
|
122
|
+
def custom_setup_method2
|
123
|
+
called(:custom_setup_method2)
|
124
|
+
end
|
125
|
+
unregister_setup(:custom_setup_method2) if options
|
126
|
+
|
127
|
+
if options
|
128
|
+
callback = lambda do
|
129
|
+
called(:custom_setup_callback2)
|
130
|
+
end
|
131
|
+
setup(*(options[2] || []), &callback)
|
132
|
+
unregister_setup(callback)
|
133
|
+
end
|
134
|
+
|
135
|
+
setup(*(options[3] || [])) if options
|
136
|
+
def custom_setup_method3
|
137
|
+
called(:custom_setup_method3)
|
138
|
+
end
|
139
|
+
|
140
|
+
if options
|
141
|
+
setup(*(options[3] || [])) do
|
142
|
+
called(:custom_setup_callback3)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_nothing
|
147
|
+
end
|
148
|
+
|
149
|
+
yield(self, :after) if block_given?
|
150
|
+
end
|
151
|
+
|
152
|
+
assert_called_fixtures(expected, test_case)
|
153
|
+
test_case
|
154
|
+
end
|
155
|
+
|
156
|
+
def assert_setup(expected, options)
|
157
|
+
_test_case = assert_setup_customizable(expected, nil, options)
|
158
|
+
assert_setup_customizable(expected, nil, options) do |test_case, tag|
|
159
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
160
|
+
end
|
161
|
+
_test_case
|
162
|
+
end
|
163
|
+
|
164
|
+
def assert_inherited_setup(expected, parent, options=nil)
|
165
|
+
_test_case = assert_setup_customizable(expected, parent, options)
|
166
|
+
assert_setup_customizable(expected, parent, options) do |test_case, tag|
|
167
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
168
|
+
end
|
169
|
+
_test_case
|
170
|
+
end
|
171
|
+
|
172
|
+
def assert_invalid_setup_option(option)
|
173
|
+
assert_invalid_option(:setup, option)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
class TestCleanup < self
|
178
|
+
def test_without_option
|
179
|
+
expected_cleanup_calls = [:custom_cleanup_callback3,
|
180
|
+
:custom_cleanup_method3,
|
181
|
+
:custom_cleanup_callback1,
|
182
|
+
:custom_cleanup_method1,
|
183
|
+
:custom_cleanup_callback0,
|
184
|
+
:custom_cleanup_method0,
|
185
|
+
:cleanup]
|
186
|
+
test_case = assert_cleanup(expected_cleanup_calls, [])
|
187
|
+
assert_inherited_cleanup(expected_cleanup_calls, test_case)
|
188
|
+
|
189
|
+
assert_inherited_cleanup([:cleanup], nil)
|
190
|
+
assert_called_fixtures(expected_cleanup_calls, test_case)
|
191
|
+
end
|
192
|
+
|
193
|
+
def test_with_before_option
|
194
|
+
expected_cleanup_calls = [:custom_cleanup_callback3,
|
195
|
+
:custom_cleanup_method3,
|
196
|
+
:custom_cleanup_method0,
|
197
|
+
:custom_cleanup_callback0,
|
198
|
+
:custom_cleanup_method1,
|
199
|
+
:custom_cleanup_callback1,
|
200
|
+
:cleanup]
|
201
|
+
test_case = assert_cleanup(expected_cleanup_calls,
|
202
|
+
[[{:before => :append}],
|
203
|
+
[{:before => :append}],
|
204
|
+
[{:before => :prepend}],
|
205
|
+
[{:before => :prepend}]])
|
206
|
+
assert_inherited_cleanup(expected_cleanup_calls, test_case)
|
207
|
+
|
208
|
+
assert_inherited_cleanup([:cleanup], nil)
|
209
|
+
assert_called_fixtures(expected_cleanup_calls, test_case)
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_with_after_option
|
213
|
+
expected_cleanup_calls = [:cleanup,
|
214
|
+
:custom_cleanup_callback3,
|
215
|
+
:custom_cleanup_method3,
|
216
|
+
:custom_cleanup_method0,
|
217
|
+
:custom_cleanup_callback0,
|
218
|
+
:custom_cleanup_method1,
|
219
|
+
:custom_cleanup_callback1]
|
220
|
+
test_case = assert_cleanup(expected_cleanup_calls,
|
221
|
+
[[{:after => :append}],
|
222
|
+
[{:after => :append}],
|
223
|
+
[{:after => :prepend}],
|
224
|
+
[{:after => :prepend}]])
|
225
|
+
assert_inherited_cleanup(expected_cleanup_calls, test_case)
|
226
|
+
|
227
|
+
assert_inherited_cleanup([:cleanup], nil)
|
228
|
+
assert_called_fixtures(expected_cleanup_calls, test_case)
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_with_invalid_option
|
232
|
+
assert_invalid_cleanup_option(:unknown => true)
|
233
|
+
assert_invalid_cleanup_option(:before => :unknown)
|
234
|
+
assert_invalid_cleanup_option(:after => :unknown)
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_with_option_to_inherited
|
238
|
+
expected_cleanup_calls = [:cleanup]
|
239
|
+
test_case = assert_cleanup(expected_cleanup_calls, nil)
|
240
|
+
assert_inherited_cleanup([:custom_cleanup_callback3,
|
241
|
+
:custom_cleanup_method3,
|
242
|
+
:custom_cleanup_callback1,
|
243
|
+
:custom_cleanup_method1,
|
244
|
+
:custom_cleanup_callback0,
|
245
|
+
:custom_cleanup_method0,
|
246
|
+
:cleanup],
|
247
|
+
test_case, [])
|
248
|
+
|
249
|
+
assert_inherited_cleanup([:cleanup], nil)
|
250
|
+
assert_called_fixtures(expected_cleanup_calls, test_case)
|
251
|
+
end
|
252
|
+
|
253
|
+
def test_with_exception
|
254
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
255
|
+
def called_ids
|
256
|
+
@called_ids ||= []
|
257
|
+
end
|
258
|
+
|
259
|
+
def called(id)
|
260
|
+
called_ids << id
|
261
|
+
end
|
262
|
+
|
263
|
+
def cleanup
|
264
|
+
called(:cleanup)
|
265
|
+
raise "cleanup"
|
266
|
+
end
|
267
|
+
|
268
|
+
cleanup
|
269
|
+
def custom_cleanup_method0
|
270
|
+
called(:custom_cleanup_method0)
|
271
|
+
raise "custom_cleanup_method0"
|
272
|
+
end
|
273
|
+
|
274
|
+
cleanup do
|
275
|
+
called(:custom_cleanup_callback0)
|
276
|
+
raise "custom_cleanup_callback0"
|
277
|
+
end
|
278
|
+
|
279
|
+
cleanup
|
280
|
+
def custom_cleanup_method1
|
281
|
+
called(:custom_cleanup_method1)
|
282
|
+
raise "custom_cleanup_method1"
|
283
|
+
end
|
284
|
+
|
285
|
+
cleanup do
|
286
|
+
called(:custom_cleanup_callback1)
|
287
|
+
raise "custom_cleanup_callback1"
|
288
|
+
end
|
289
|
+
|
290
|
+
def test_nothing
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
assert_called_fixtures([:custom_cleanup_callback1],
|
295
|
+
test_case)
|
296
|
+
end
|
297
|
+
|
298
|
+
private
|
299
|
+
def assert_cleanup_customizable(expected, parent, options)
|
300
|
+
test_case = Class.new(parent || Test::Unit::TestCase) do
|
301
|
+
yield(self, :before) if block_given?
|
302
|
+
|
303
|
+
def called_ids
|
304
|
+
@called_ids ||= []
|
305
|
+
end
|
306
|
+
|
307
|
+
def called(id)
|
308
|
+
called_ids << id
|
309
|
+
end
|
310
|
+
|
311
|
+
def cleanup
|
312
|
+
called(:cleanup)
|
313
|
+
end
|
314
|
+
|
315
|
+
cleanup(*(options[0] || [])) if options
|
316
|
+
def custom_cleanup_method0
|
317
|
+
called(:custom_cleanup_method0)
|
318
|
+
end
|
319
|
+
|
320
|
+
if options
|
321
|
+
cleanup(*(options[0] || [])) do
|
322
|
+
called(:custom_cleanup_callback0)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
def custom_cleanup_method1
|
327
|
+
called(:custom_cleanup_method1)
|
328
|
+
end
|
329
|
+
cleanup(*[:custom_cleanup_method1, *(options[1] || [])]) if options
|
330
|
+
|
331
|
+
if options
|
332
|
+
cleanup(*(options[1] || [])) do
|
333
|
+
called(:custom_cleanup_callback1)
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
cleanup(*(options[2] || [])) if options
|
338
|
+
def custom_cleanup_method2
|
339
|
+
called(:custom_cleanup_method2)
|
340
|
+
end
|
341
|
+
unregister_cleanup(:custom_cleanup_method2) if options
|
342
|
+
|
343
|
+
if options
|
344
|
+
callback = lambda do
|
345
|
+
called(:custom_cleanup_callback2)
|
346
|
+
end
|
347
|
+
cleanup(*(options[2] || []), &callback)
|
348
|
+
unregister_cleanup(callback)
|
349
|
+
end
|
350
|
+
|
351
|
+
cleanup(*(options[3] || [])) if options
|
352
|
+
def custom_cleanup_method3
|
353
|
+
called(:custom_cleanup_method3)
|
354
|
+
end
|
355
|
+
|
356
|
+
if options
|
357
|
+
cleanup(*(options[3] || [])) do
|
358
|
+
called(:custom_cleanup_callback3)
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
def test_nothing
|
363
|
+
end
|
364
|
+
|
365
|
+
yield(self, :after) if block_given?
|
366
|
+
end
|
367
|
+
|
368
|
+
assert_called_fixtures(expected, test_case)
|
369
|
+
test_case
|
370
|
+
end
|
371
|
+
|
372
|
+
def assert_cleanup(expected, options)
|
373
|
+
assert_cleanup_customizable(expected, nil, options)
|
374
|
+
assert_cleanup_customizable(expected, nil, options) do |test_case, tag|
|
375
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
def assert_inherited_cleanup(expected, parent, options=nil)
|
380
|
+
assert_cleanup_customizable(expected, parent, options)
|
381
|
+
assert_cleanup_customizable(expected, parent, options) do |test_case, tag|
|
382
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
def assert_invalid_cleanup_option(option)
|
387
|
+
assert_invalid_option(:cleanup, option)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
class TestTeardown < self
|
392
|
+
def test_without_option
|
393
|
+
expected_teardown_calls = [:custom_teardown_callback3,
|
394
|
+
:custom_teardown_method3,
|
395
|
+
:custom_teardown_callback1,
|
396
|
+
:custom_teardown_method1,
|
397
|
+
:custom_teardown_callback0,
|
398
|
+
:custom_teardown_method0,
|
399
|
+
:teardown]
|
400
|
+
test_case = assert_teardown(expected_teardown_calls, [])
|
401
|
+
assert_inherited_teardown(expected_teardown_calls, test_case)
|
402
|
+
|
403
|
+
assert_inherited_teardown([:teardown], nil)
|
404
|
+
assert_called_fixtures(expected_teardown_calls, test_case)
|
405
|
+
end
|
406
|
+
|
407
|
+
def test_with_before_option
|
408
|
+
expected_teardown_calls = [:custom_teardown_callback3,
|
409
|
+
:custom_teardown_method3,
|
410
|
+
:custom_teardown_method0,
|
411
|
+
:custom_teardown_callback0,
|
412
|
+
:custom_teardown_method1,
|
413
|
+
:custom_teardown_callback1,
|
414
|
+
:teardown]
|
415
|
+
test_case = assert_teardown(expected_teardown_calls,
|
416
|
+
[[{:before => :append}],
|
417
|
+
[{:before => :append}],
|
418
|
+
[{:before => :prepend}],
|
419
|
+
[{:before => :prepend}]])
|
420
|
+
assert_inherited_teardown(expected_teardown_calls, test_case)
|
421
|
+
|
422
|
+
assert_inherited_teardown([:teardown], nil)
|
423
|
+
assert_called_fixtures(expected_teardown_calls, test_case)
|
424
|
+
end
|
425
|
+
|
426
|
+
def test_with_after_option
|
427
|
+
expected_teardown_calls = [:teardown,
|
428
|
+
:custom_teardown_callback3,
|
429
|
+
:custom_teardown_method3,
|
430
|
+
:custom_teardown_method0,
|
431
|
+
:custom_teardown_callback0,
|
432
|
+
:custom_teardown_method1,
|
433
|
+
:custom_teardown_callback1]
|
434
|
+
test_case = assert_teardown(expected_teardown_calls,
|
435
|
+
[[{:after => :append}],
|
436
|
+
[{:after => :append}],
|
437
|
+
[{:after => :prepend}],
|
438
|
+
[{:after => :prepend}]])
|
439
|
+
assert_inherited_teardown(expected_teardown_calls, test_case)
|
440
|
+
|
441
|
+
assert_inherited_teardown([:teardown], nil)
|
442
|
+
assert_called_fixtures(expected_teardown_calls, test_case)
|
443
|
+
end
|
444
|
+
|
445
|
+
def test_with_invalid_option
|
446
|
+
assert_invalid_teardown_option(:unknown => true)
|
447
|
+
assert_invalid_teardown_option(:before => :unknown)
|
448
|
+
assert_invalid_teardown_option(:after => :unknown)
|
449
|
+
end
|
450
|
+
|
451
|
+
def test_with_option_to_inherited
|
452
|
+
expected_teardown_calls = [:teardown]
|
453
|
+
test_case = assert_teardown(expected_teardown_calls, nil)
|
454
|
+
assert_inherited_teardown([:custom_teardown_callback3,
|
455
|
+
:custom_teardown_method3,
|
456
|
+
:custom_teardown_callback1,
|
457
|
+
:custom_teardown_method1,
|
458
|
+
:custom_teardown_callback0,
|
459
|
+
:custom_teardown_method0,
|
460
|
+
:teardown],
|
461
|
+
test_case, [])
|
462
|
+
|
463
|
+
assert_inherited_teardown([:teardown], nil)
|
464
|
+
assert_called_fixtures(expected_teardown_calls, test_case)
|
465
|
+
end
|
466
|
+
|
467
|
+
def test_with_exception
|
468
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
469
|
+
def called_ids
|
470
|
+
@called_ids ||= []
|
471
|
+
end
|
472
|
+
|
473
|
+
def called(id)
|
474
|
+
called_ids << id
|
475
|
+
end
|
476
|
+
|
477
|
+
def teardown
|
478
|
+
called(:teardown)
|
479
|
+
raise "teardown"
|
480
|
+
end
|
481
|
+
|
482
|
+
teardown
|
483
|
+
def custom_teardown_method0
|
484
|
+
called(:custom_teardown_method0)
|
485
|
+
raise "custom_teardown_method0"
|
486
|
+
end
|
487
|
+
|
488
|
+
teardown do
|
489
|
+
called(:custom_teardown_callback0)
|
490
|
+
raise "custom_teardown_callback0"
|
491
|
+
end
|
492
|
+
|
493
|
+
teardown
|
494
|
+
def custom_teardown_method1
|
495
|
+
called(:custom_teardown_method1)
|
496
|
+
raise "custom_teardown_method1"
|
497
|
+
end
|
498
|
+
|
499
|
+
teardown do
|
500
|
+
called(:custom_teardown_callback1)
|
501
|
+
raise "custom_teardown_callback1"
|
502
|
+
end
|
503
|
+
|
504
|
+
def test_nothing
|
505
|
+
end
|
506
|
+
end
|
507
|
+
|
508
|
+
assert_called_fixtures([:custom_teardown_callback1,
|
509
|
+
:custom_teardown_method1,
|
510
|
+
:custom_teardown_callback0,
|
511
|
+
:custom_teardown_method0,
|
512
|
+
:teardown],
|
513
|
+
test_case)
|
514
|
+
end
|
515
|
+
|
516
|
+
def test_nested
|
517
|
+
called = []
|
518
|
+
parent_test_case = Class.new(Test::Unit::TestCase) do
|
519
|
+
teardown do
|
520
|
+
called << :parent
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
524
|
+
child_test_case = Class.new(parent_test_case) do
|
525
|
+
teardown do
|
526
|
+
called << :child
|
527
|
+
end
|
528
|
+
|
529
|
+
def test_nothing
|
530
|
+
end
|
531
|
+
end
|
532
|
+
|
533
|
+
run_test_nothing(child_test_case)
|
534
|
+
assert_equal([:child, :parent],
|
535
|
+
called)
|
536
|
+
end
|
537
|
+
|
538
|
+
def test_setup_with_block
|
539
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
540
|
+
def called_ids
|
541
|
+
@called_ids ||= []
|
542
|
+
end
|
543
|
+
|
544
|
+
def called(id)
|
545
|
+
called_ids << id
|
546
|
+
end
|
547
|
+
|
548
|
+
setup
|
549
|
+
def setup1
|
550
|
+
called(:setup1)
|
551
|
+
begin
|
552
|
+
yield
|
553
|
+
called(:setup1_after_yield)
|
554
|
+
ensure
|
555
|
+
called(:setup1_teardown)
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
setup
|
560
|
+
def setup2
|
561
|
+
called(:setup2)
|
562
|
+
begin
|
563
|
+
yield
|
564
|
+
called(:setup2_after_yield)
|
565
|
+
ensure
|
566
|
+
called(:setup2_teardown)
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
570
|
+
def teardown
|
571
|
+
called(:teardown)
|
572
|
+
end
|
573
|
+
|
574
|
+
def test_nothing
|
575
|
+
called(:test)
|
576
|
+
flunk
|
577
|
+
called(:test_after_failure)
|
578
|
+
end
|
579
|
+
end
|
580
|
+
|
581
|
+
assert_called_fixtures([
|
582
|
+
:setup1,
|
583
|
+
:setup2,
|
584
|
+
:test,
|
585
|
+
:setup2_teardown,
|
586
|
+
:setup1_teardown,
|
587
|
+
:teardown,
|
588
|
+
],
|
589
|
+
test_case)
|
590
|
+
end
|
591
|
+
|
592
|
+
private
|
593
|
+
def assert_teardown_customizable(expected, parent, options)
|
594
|
+
test_case = Class.new(parent || Test::Unit::TestCase) do
|
595
|
+
yield(self, :before) if block_given?
|
596
|
+
|
597
|
+
def called_ids
|
598
|
+
@called_ids ||= []
|
599
|
+
end
|
600
|
+
|
601
|
+
def called(id)
|
602
|
+
called_ids << id
|
603
|
+
end
|
604
|
+
|
605
|
+
def teardown
|
606
|
+
called(:teardown)
|
607
|
+
end
|
608
|
+
|
609
|
+
teardown(*(options[0] || [])) if options
|
610
|
+
def custom_teardown_method0
|
611
|
+
called(:custom_teardown_method0)
|
612
|
+
end
|
613
|
+
|
614
|
+
if options
|
615
|
+
teardown(*(options[0] || [])) do
|
616
|
+
called(:custom_teardown_callback0)
|
617
|
+
end
|
618
|
+
end
|
619
|
+
|
620
|
+
def custom_teardown_method1
|
621
|
+
called(:custom_teardown_method1)
|
622
|
+
end
|
623
|
+
teardown(*[:custom_teardown_method1, *(options[1] || [])]) if options
|
624
|
+
|
625
|
+
if options
|
626
|
+
teardown(*(options[1] || [])) do
|
627
|
+
called(:custom_teardown_callback1)
|
628
|
+
end
|
629
|
+
end
|
630
|
+
|
631
|
+
teardown(*(options[2] || [])) if options
|
632
|
+
def custom_teardown_method2
|
633
|
+
called(:custom_teardown_method2)
|
634
|
+
end
|
635
|
+
unregister_teardown(:custom_teardown_method2) if options
|
636
|
+
|
637
|
+
if options
|
638
|
+
callback = lambda do
|
639
|
+
called(:custom_teardown_callback2)
|
640
|
+
end
|
641
|
+
teardown(*(options[2] || []), &callback)
|
642
|
+
unregister_teardown(callback)
|
643
|
+
end
|
644
|
+
|
645
|
+
teardown(*(options[3] || [])) if options
|
646
|
+
def custom_teardown_method3
|
647
|
+
called(:custom_teardown_method3)
|
648
|
+
end
|
649
|
+
|
650
|
+
if options
|
651
|
+
teardown(*(options[3] || [])) do
|
652
|
+
called(:custom_teardown_callback3)
|
653
|
+
end
|
654
|
+
end
|
655
|
+
|
656
|
+
def test_nothing
|
657
|
+
end
|
658
|
+
|
659
|
+
yield(self, :after) if block_given?
|
660
|
+
end
|
661
|
+
|
662
|
+
assert_called_fixtures(expected, test_case)
|
663
|
+
test_case
|
664
|
+
end
|
665
|
+
|
666
|
+
def assert_teardown(expected, options)
|
667
|
+
assert_teardown_customizable(expected, nil, options)
|
668
|
+
assert_teardown_customizable(expected, nil, options) do |test_case, tag|
|
669
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
670
|
+
end
|
671
|
+
end
|
672
|
+
|
673
|
+
def assert_inherited_teardown(expected, parent, options=nil)
|
674
|
+
assert_teardown_customizable(expected, parent, options)
|
675
|
+
assert_teardown_customizable(expected, parent, options) do |test_case, tag|
|
676
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
680
|
+
def assert_invalid_teardown_option(option)
|
681
|
+
assert_invalid_option(:teardown, option)
|
682
|
+
end
|
683
|
+
end
|
684
|
+
|
685
|
+
private
|
686
|
+
def run_test_nothing(test_case)
|
687
|
+
test = test_case.new("test_nothing")
|
688
|
+
test.run(Test::Unit::TestResult.new) {}
|
689
|
+
test
|
690
|
+
end
|
691
|
+
|
692
|
+
def assert_called_fixtures(expected, test_case)
|
693
|
+
test = run_test_nothing(test_case)
|
694
|
+
assert_equal(expected, test.called_ids)
|
695
|
+
end
|
696
|
+
|
697
|
+
def assert_invalid_option(fixture_type, option)
|
698
|
+
exception = assert_raise(ArgumentError) do
|
699
|
+
Class.new(Test::Unit::TestCase) do
|
700
|
+
def test_nothing
|
701
|
+
end
|
702
|
+
|
703
|
+
send(fixture_type, option)
|
704
|
+
def fixture
|
705
|
+
end
|
706
|
+
end
|
707
|
+
end
|
708
|
+
assert_equal("must be {:before => :prepend}, {:before => :append}, " +
|
709
|
+
"{:after => :prepend} or {:after => :append}" +
|
710
|
+
": #{option.inspect}",
|
711
|
+
exception.message)
|
712
|
+
end
|
713
|
+
end
|