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,132 @@
|
|
1
|
+
#--
|
2
|
+
# Author:: Nathaniel Talbott.
|
3
|
+
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
4
|
+
# License:: Ruby license.
|
5
|
+
|
6
|
+
require 'test/unit/util/observable'
|
7
|
+
require 'test/unit/failure'
|
8
|
+
require 'test/unit/error'
|
9
|
+
require 'test/unit/omission'
|
10
|
+
require 'test/unit/pending'
|
11
|
+
require 'test/unit/notification'
|
12
|
+
|
13
|
+
module Test
|
14
|
+
module Unit
|
15
|
+
module NullResultContainerInitializer
|
16
|
+
private
|
17
|
+
def initialize_containers
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Collects Test::Unit::Failure and Test::Unit::Error so that
|
22
|
+
# they can be displayed to the user. To this end, observers
|
23
|
+
# can be added to it, allowing the dynamic updating of, say, a
|
24
|
+
# UI.
|
25
|
+
class TestResult
|
26
|
+
include Util::Observable
|
27
|
+
include NullResultContainerInitializer
|
28
|
+
include TestResultFailureSupport
|
29
|
+
include TestResultErrorSupport
|
30
|
+
include TestResultPendingSupport
|
31
|
+
include TestResultOmissionSupport
|
32
|
+
include TestResultNotificationSupport
|
33
|
+
|
34
|
+
FINISHED = name + "::FINISHED"
|
35
|
+
CHANGED = name + "::CHANGED"
|
36
|
+
PASS_ASSERTION = name + "::PASS_ASSERTION"
|
37
|
+
FAULT = name + "::FAULT"
|
38
|
+
|
39
|
+
attr_reader :run_count, :pass_count, :assertion_count, :faults
|
40
|
+
|
41
|
+
attr_accessor :stop_tag
|
42
|
+
|
43
|
+
# Constructs a new, empty TestResult.
|
44
|
+
def initialize
|
45
|
+
@run_count, @pass_count, @assertion_count = 0, 0, 0
|
46
|
+
@summary_generators = []
|
47
|
+
@problem_checkers = []
|
48
|
+
@faults = []
|
49
|
+
@stop_tag = nil
|
50
|
+
initialize_containers
|
51
|
+
end
|
52
|
+
|
53
|
+
# Records a test run.
|
54
|
+
def add_run
|
55
|
+
@run_count += 1
|
56
|
+
notify_listeners(FINISHED, self)
|
57
|
+
notify_changed
|
58
|
+
end
|
59
|
+
|
60
|
+
def add_pass
|
61
|
+
@pass_count += 1
|
62
|
+
end
|
63
|
+
|
64
|
+
# Records an individual assertion.
|
65
|
+
def add_assertion
|
66
|
+
@assertion_count += 1
|
67
|
+
notify_listeners(PASS_ASSERTION, self)
|
68
|
+
notify_changed
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns a string contain the recorded runs, assertions,
|
72
|
+
# failures and errors in this TestResult.
|
73
|
+
def summary
|
74
|
+
["#{run_count} tests",
|
75
|
+
"#{assertion_count} assertions",
|
76
|
+
*@summary_generators.collect {|generator| __send__(generator)}].join(", ")
|
77
|
+
end
|
78
|
+
|
79
|
+
# Returnes a string that shows result status.
|
80
|
+
def status
|
81
|
+
if passed?
|
82
|
+
if pending_count > 0
|
83
|
+
"pending"
|
84
|
+
elsif omission_count > 0
|
85
|
+
"omission"
|
86
|
+
elsif notification_count > 0
|
87
|
+
"notification"
|
88
|
+
else
|
89
|
+
"pass"
|
90
|
+
end
|
91
|
+
elsif error_count > 0
|
92
|
+
"error"
|
93
|
+
elsif failure_count > 0
|
94
|
+
"failure"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def stop
|
99
|
+
throw @stop_tag
|
100
|
+
end
|
101
|
+
|
102
|
+
def to_s
|
103
|
+
summary
|
104
|
+
end
|
105
|
+
|
106
|
+
# Returns whether or not this TestResult represents
|
107
|
+
# successful completion.
|
108
|
+
def passed?
|
109
|
+
@problem_checkers.all? {|checker| not __send__(checker)}
|
110
|
+
end
|
111
|
+
|
112
|
+
def pass_percentage
|
113
|
+
n_tests = @run_count - omission_count
|
114
|
+
if n_tests.zero?
|
115
|
+
0
|
116
|
+
else
|
117
|
+
100.0 * (@pass_count / n_tests.to_f)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
private
|
122
|
+
def notify_changed
|
123
|
+
notify_listeners(CHANGED, self)
|
124
|
+
end
|
125
|
+
|
126
|
+
def notify_fault(fault)
|
127
|
+
@faults << fault
|
128
|
+
notify_listeners(FAULT, fault)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
#--
|
2
|
+
#
|
3
|
+
# Author:: Nathaniel Talbott.
|
4
|
+
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
5
|
+
# Copyright:: Copyright (c) 2008-2011 Kouhei Sutou. All rights reserved.
|
6
|
+
# License:: Ruby license.
|
7
|
+
|
8
|
+
require 'test/unit/error'
|
9
|
+
|
10
|
+
module Test
|
11
|
+
module Unit
|
12
|
+
|
13
|
+
# A collection of tests which can be #run.
|
14
|
+
#
|
15
|
+
# Note: It is easy to confuse a TestSuite instance with
|
16
|
+
# something that has a static suite method; I know because _I_
|
17
|
+
# have trouble keeping them straight. Think of something that
|
18
|
+
# has a suite method as simply providing a way to get a
|
19
|
+
# meaningful TestSuite instance.
|
20
|
+
class TestSuite
|
21
|
+
attr_reader :name, :tests, :test_case, :start_time, :elapsed_time
|
22
|
+
|
23
|
+
# Test suite that has higher priority is ran prior to
|
24
|
+
# test suites that have lower priority.
|
25
|
+
attr_accessor :priority
|
26
|
+
|
27
|
+
STARTED = name + "::STARTED"
|
28
|
+
STARTED_OBJECT = name + "::STARTED::OBJECT"
|
29
|
+
FINISHED = name + "::FINISHED"
|
30
|
+
FINISHED_OBJECT = name + "::FINISHED::OBJECT"
|
31
|
+
|
32
|
+
# Creates a new TestSuite with the given name.
|
33
|
+
def initialize(name="Unnamed TestSuite", test_case=nil)
|
34
|
+
@name = name
|
35
|
+
@tests = []
|
36
|
+
@test_case = test_case
|
37
|
+
@n_tests = 0
|
38
|
+
@priority = 0
|
39
|
+
@start_time = nil
|
40
|
+
@elapsed_time = nil
|
41
|
+
@passed = true
|
42
|
+
end
|
43
|
+
|
44
|
+
# Runs the tests and/or suites contained in this
|
45
|
+
# TestSuite.
|
46
|
+
def run(result, &progress_block)
|
47
|
+
@start_time = Time.now
|
48
|
+
yield(STARTED, name)
|
49
|
+
yield(STARTED_OBJECT, self)
|
50
|
+
run_startup(result)
|
51
|
+
while test = @tests.shift
|
52
|
+
@n_tests += test.size
|
53
|
+
run_test(test, result, &progress_block)
|
54
|
+
@passed = false unless test.passed?
|
55
|
+
end
|
56
|
+
ensure
|
57
|
+
begin
|
58
|
+
run_shutdown(result)
|
59
|
+
ensure
|
60
|
+
@elapsed_time = Time.now - @start_time
|
61
|
+
yield(FINISHED, name)
|
62
|
+
yield(FINISHED_OBJECT, self)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Adds the test to the suite.
|
67
|
+
def <<(test)
|
68
|
+
@tests << test
|
69
|
+
self
|
70
|
+
end
|
71
|
+
|
72
|
+
def delete(test)
|
73
|
+
@tests.delete(test)
|
74
|
+
end
|
75
|
+
|
76
|
+
def delete_tests(tests)
|
77
|
+
@tests -= tests
|
78
|
+
end
|
79
|
+
|
80
|
+
# Retuns the rolled up number of tests in this suite;
|
81
|
+
# i.e. if the suite contains other suites, it counts the
|
82
|
+
# tests within those suites, not the suites themselves.
|
83
|
+
def size
|
84
|
+
total_size = @n_tests
|
85
|
+
@tests.each { |test| total_size += test.size }
|
86
|
+
total_size
|
87
|
+
end
|
88
|
+
|
89
|
+
def empty?
|
90
|
+
size.zero?
|
91
|
+
end
|
92
|
+
|
93
|
+
# Overridden to return the name given the suite at
|
94
|
+
# creation.
|
95
|
+
def to_s
|
96
|
+
@name
|
97
|
+
end
|
98
|
+
|
99
|
+
# It's handy to be able to compare TestSuite instances.
|
100
|
+
def ==(other)
|
101
|
+
return false unless(other.kind_of?(self.class))
|
102
|
+
return false unless(@name == other.name)
|
103
|
+
@tests == other.tests
|
104
|
+
end
|
105
|
+
|
106
|
+
def passed?
|
107
|
+
@passed
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
def run_startup(result)
|
112
|
+
return if @test_case.nil? or !@test_case.respond_to?(:startup)
|
113
|
+
begin
|
114
|
+
@test_case.startup
|
115
|
+
rescue Exception
|
116
|
+
raise unless handle_exception($!, result)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def run_test(test, result)
|
121
|
+
finished_is_yielded = false
|
122
|
+
finished_object_is_yielded = false
|
123
|
+
previous_event_name = nil
|
124
|
+
test.run(result) do |event_name, *args|
|
125
|
+
case previous_event_name
|
126
|
+
when Test::Unit::TestCase::STARTED
|
127
|
+
if event_name != Test::Unit::TestCase::STARTED_OBJECT
|
128
|
+
yield(Test::Unit::TestCase::STARTED_OBJECT, test)
|
129
|
+
end
|
130
|
+
when Test::Unit::TestCase::FINISHED
|
131
|
+
if event_name != Test::Unit::TestCase::FINISHED_OBJECT
|
132
|
+
yield(Test::Unit::TestCase::FINISHED_OBJECT, test)
|
133
|
+
end
|
134
|
+
finished_object_is_yielded = true
|
135
|
+
end
|
136
|
+
|
137
|
+
case event_name
|
138
|
+
when Test::Unit::TestCase::STARTED
|
139
|
+
finished_is_yielded = false
|
140
|
+
finished_object_is_yielded = false
|
141
|
+
when Test::Unit::TestCase::FINISHED
|
142
|
+
finished_is_yielded = true
|
143
|
+
end
|
144
|
+
|
145
|
+
previous_event_name = event_name
|
146
|
+
yield(event_name, *args)
|
147
|
+
end
|
148
|
+
|
149
|
+
if finished_is_yielded and not finished_object_is_yielded
|
150
|
+
yield(Test::Unit::TestCase::FINISHED_OBJECT, test)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def run_shutdown(result)
|
155
|
+
return if @test_case.nil? or !@test_case.respond_to?(:shutdown)
|
156
|
+
begin
|
157
|
+
@test_case.shutdown
|
158
|
+
rescue Exception
|
159
|
+
raise unless handle_exception($!, result)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def handle_exception(exception, result)
|
164
|
+
case exception
|
165
|
+
when *ErrorHandler::PASS_THROUGH_EXCEPTIONS
|
166
|
+
false
|
167
|
+
else
|
168
|
+
result.add_error(Error.new(@test_case.name, exception))
|
169
|
+
@passed = false
|
170
|
+
true
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,693 @@
|
|
1
|
+
#--
|
2
|
+
#
|
3
|
+
# Author:: Nathaniel Talbott.
|
4
|
+
# Copyright::
|
5
|
+
# * Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
6
|
+
# * Copyright (c) 2008-2013 Kouhei Sutou <kou@clear-code.com>
|
7
|
+
# License:: Ruby license.
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'io/console'
|
11
|
+
rescue LoadError
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'test/unit/color-scheme'
|
15
|
+
require 'test/unit/code-snippet-fetcher'
|
16
|
+
require 'test/unit/fault-location-detector'
|
17
|
+
require 'test/unit/diff'
|
18
|
+
require 'test/unit/ui/testrunner'
|
19
|
+
require 'test/unit/ui/testrunnermediator'
|
20
|
+
require 'test/unit/ui/console/outputlevel'
|
21
|
+
|
22
|
+
module Test
|
23
|
+
module Unit
|
24
|
+
module UI
|
25
|
+
module Console
|
26
|
+
|
27
|
+
# Runs a Test::Unit::TestSuite on the console.
|
28
|
+
class TestRunner < UI::TestRunner
|
29
|
+
include OutputLevel
|
30
|
+
|
31
|
+
# Creates a new TestRunner for running the passed
|
32
|
+
# suite. If quiet_mode is true, the output while
|
33
|
+
# running is limited to progress dots, errors and
|
34
|
+
# failures, and the final result. io specifies
|
35
|
+
# where runner output should go to; defaults to
|
36
|
+
# STDOUT.
|
37
|
+
def initialize(suite, options={})
|
38
|
+
super
|
39
|
+
@output_level = @options[:output_level] || NORMAL
|
40
|
+
@output = @options[:output] || STDOUT
|
41
|
+
@use_color = @options[:use_color]
|
42
|
+
@use_color = guess_color_availability if @use_color.nil?
|
43
|
+
@color_scheme = @options[:color_scheme] || ColorScheme.default
|
44
|
+
@reset_color = Color.new("reset")
|
45
|
+
@progress_row = 0
|
46
|
+
@progress_row_max = @options[:progress_row_max]
|
47
|
+
@progress_row_max ||= guess_progress_row_max
|
48
|
+
@show_detail_immediately = @options[:show_detail_immediately]
|
49
|
+
@show_detail_immediately = true if @show_detail_immediately.nil?
|
50
|
+
@already_outputted = false
|
51
|
+
@indent = 0
|
52
|
+
@top_level = true
|
53
|
+
@current_output_level = NORMAL
|
54
|
+
@faults = []
|
55
|
+
@code_snippet_fetcher = CodeSnippetFetcher.new
|
56
|
+
@test_suites = []
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
def change_output_level(level)
|
61
|
+
old_output_level = @current_output_level
|
62
|
+
@current_output_level = level
|
63
|
+
yield
|
64
|
+
@current_output_level = old_output_level
|
65
|
+
end
|
66
|
+
|
67
|
+
def setup_mediator
|
68
|
+
super
|
69
|
+
output_setup_end
|
70
|
+
end
|
71
|
+
|
72
|
+
def output_setup_end
|
73
|
+
suite_name = @suite.to_s
|
74
|
+
suite_name = @suite.name if @suite.kind_of?(Module)
|
75
|
+
output("Loaded suite #{suite_name}")
|
76
|
+
end
|
77
|
+
|
78
|
+
def attach_to_mediator
|
79
|
+
@mediator.add_listener(TestResult::FAULT,
|
80
|
+
&method(:add_fault))
|
81
|
+
@mediator.add_listener(TestRunnerMediator::STARTED,
|
82
|
+
&method(:started))
|
83
|
+
@mediator.add_listener(TestRunnerMediator::FINISHED,
|
84
|
+
&method(:finished))
|
85
|
+
@mediator.add_listener(TestCase::STARTED_OBJECT,
|
86
|
+
&method(:test_started))
|
87
|
+
@mediator.add_listener(TestCase::FINISHED_OBJECT,
|
88
|
+
&method(:test_finished))
|
89
|
+
@mediator.add_listener(TestSuite::STARTED_OBJECT,
|
90
|
+
&method(:test_suite_started))
|
91
|
+
@mediator.add_listener(TestSuite::FINISHED_OBJECT,
|
92
|
+
&method(:test_suite_finished))
|
93
|
+
end
|
94
|
+
|
95
|
+
def add_fault(fault)
|
96
|
+
@faults << fault
|
97
|
+
output_progress(fault.single_character_display,
|
98
|
+
fault_marker_color(fault))
|
99
|
+
output_progress_in_detail(fault) if @show_detail_immediately
|
100
|
+
@already_outputted = true if fault.critical?
|
101
|
+
end
|
102
|
+
|
103
|
+
def started(result)
|
104
|
+
@result = result
|
105
|
+
output_started
|
106
|
+
end
|
107
|
+
|
108
|
+
def output_started
|
109
|
+
output("Started")
|
110
|
+
end
|
111
|
+
|
112
|
+
def finished(elapsed_time)
|
113
|
+
nl if output?(NORMAL) and !output?(VERBOSE)
|
114
|
+
output_faults unless @show_detail_immediately
|
115
|
+
nl(PROGRESS_ONLY)
|
116
|
+
change_output_level(IMPORTANT_FAULTS_ONLY) do
|
117
|
+
output_statistics(elapsed_time)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def output_faults
|
122
|
+
categorized_faults = categorize_faults
|
123
|
+
change_output_level(IMPORTANT_FAULTS_ONLY) do
|
124
|
+
output_faults_in_detail(categorized_faults[:need_detail_faults])
|
125
|
+
end
|
126
|
+
output_faults_in_short("Omissions", Omission,
|
127
|
+
categorized_faults[:omissions])
|
128
|
+
output_faults_in_short("Notifications", Notification,
|
129
|
+
categorized_faults[:notifications])
|
130
|
+
end
|
131
|
+
|
132
|
+
def max_digit(max_number)
|
133
|
+
(Math.log10(max_number) + 1).truncate
|
134
|
+
end
|
135
|
+
|
136
|
+
def output_faults_in_detail(faults)
|
137
|
+
return if faults.nil?
|
138
|
+
digit = max_digit(faults.size)
|
139
|
+
faults.each_with_index do |fault, index|
|
140
|
+
nl
|
141
|
+
output_single("%#{digit}d) " % (index + 1))
|
142
|
+
output_fault_in_detail(fault)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def output_faults_in_short(label, fault_class, faults)
|
147
|
+
return if faults.nil?
|
148
|
+
digit = max_digit(faults.size)
|
149
|
+
nl
|
150
|
+
output_single(label, fault_class_color(fault_class))
|
151
|
+
output(":")
|
152
|
+
faults.each_with_index do |fault, index|
|
153
|
+
output_single("%#{digit}d) " % (index + 1))
|
154
|
+
output_fault_in_short(fault)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def categorize_faults
|
159
|
+
faults = {}
|
160
|
+
@faults.each do |fault|
|
161
|
+
category = categorize_fault(fault)
|
162
|
+
faults[category] ||= []
|
163
|
+
faults[category] << fault
|
164
|
+
end
|
165
|
+
faults
|
166
|
+
end
|
167
|
+
|
168
|
+
def categorize_fault(fault)
|
169
|
+
case fault
|
170
|
+
when Omission
|
171
|
+
:omissions
|
172
|
+
when Notification
|
173
|
+
:notifications
|
174
|
+
else
|
175
|
+
:need_detail_faults
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def output_fault_in_detail(fault)
|
180
|
+
if fault.is_a?(Failure) and
|
181
|
+
fault.inspected_expected and fault.inspected_actual
|
182
|
+
output_single("#{fault.label}: ")
|
183
|
+
output(fault.test_name, fault_color(fault))
|
184
|
+
output_fault_backtrace(fault)
|
185
|
+
output_failure_message(fault)
|
186
|
+
else
|
187
|
+
if fault.is_a?(Error)
|
188
|
+
output_single("#{fault.label}: ")
|
189
|
+
output_single(fault.test_name, fault_color(fault))
|
190
|
+
output_fault_message(fault)
|
191
|
+
else
|
192
|
+
output_single(fault.label, fault_color(fault))
|
193
|
+
output_fault_message(fault)
|
194
|
+
output(fault.test_name)
|
195
|
+
end
|
196
|
+
output_fault_backtrace(fault)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def output_fault_message(fault)
|
201
|
+
message = fault.message
|
202
|
+
return if message.nil?
|
203
|
+
|
204
|
+
if message.include?("\n")
|
205
|
+
output(":")
|
206
|
+
message.each_line do |line|
|
207
|
+
output(" #{line.chomp}")
|
208
|
+
end
|
209
|
+
else
|
210
|
+
output(": #{message}")
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def output_fault_backtrace(fault)
|
215
|
+
snippet_is_shown = false
|
216
|
+
detector = FaultLocationDetector.new(fault, @code_snippet_fetcher)
|
217
|
+
backtrace = fault.location
|
218
|
+
# workaround for test-spec. :<
|
219
|
+
# see also GitHub:#22
|
220
|
+
backtrace ||= []
|
221
|
+
backtrace.each_with_index do |entry, i|
|
222
|
+
output(entry)
|
223
|
+
next if snippet_is_shown
|
224
|
+
next unless detector.target?(entry)
|
225
|
+
file, line_number, = detector.split_backtrace_entry(entry)
|
226
|
+
snippet_is_shown = output_code_snippet(file, line_number,
|
227
|
+
fault_color(fault))
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def output_code_snippet(file, line_number, target_line_color=nil)
|
232
|
+
lines = @code_snippet_fetcher.fetch(file, line_number)
|
233
|
+
return false if lines.empty?
|
234
|
+
|
235
|
+
max_n = lines.collect {|n, line, attributes| n}.max
|
236
|
+
digits = (Math.log10(max_n) + 1).truncate
|
237
|
+
lines.each do |n, line, attributes|
|
238
|
+
if attributes[:target_line?]
|
239
|
+
line_color = target_line_color
|
240
|
+
current_line_mark = "=>"
|
241
|
+
else
|
242
|
+
line_color = nil
|
243
|
+
current_line_mark = ""
|
244
|
+
end
|
245
|
+
output(" %2s %*d: %s" % [current_line_mark, digits, n, line],
|
246
|
+
line_color)
|
247
|
+
end
|
248
|
+
true
|
249
|
+
end
|
250
|
+
|
251
|
+
def output_failure_message(failure)
|
252
|
+
if failure.expected.respond_to?(:encoding) and
|
253
|
+
failure.actual.respond_to?(:encoding) and
|
254
|
+
failure.expected.encoding != failure.actual.encoding
|
255
|
+
need_encoding = true
|
256
|
+
else
|
257
|
+
need_encoding = false
|
258
|
+
end
|
259
|
+
output(failure.user_message) if failure.user_message
|
260
|
+
output_single("<")
|
261
|
+
output_single(failure.inspected_expected, color("pass"))
|
262
|
+
output_single(">")
|
263
|
+
if need_encoding
|
264
|
+
output_single("(")
|
265
|
+
output_single(failure.expected.encoding.name, color("pass"))
|
266
|
+
output_single(")")
|
267
|
+
end
|
268
|
+
output(" expected but was")
|
269
|
+
output_single("<")
|
270
|
+
output_single(failure.inspected_actual, color("failure"))
|
271
|
+
output_single(">")
|
272
|
+
if need_encoding
|
273
|
+
output_single("(")
|
274
|
+
output_single(failure.actual.encoding.name, color("failure"))
|
275
|
+
output_single(")")
|
276
|
+
end
|
277
|
+
output("")
|
278
|
+
from, to = prepare_for_diff(failure.expected, failure.actual)
|
279
|
+
if from and to
|
280
|
+
if need_encoding
|
281
|
+
unless from.valid_encoding?
|
282
|
+
from = from.dup.force_encoding("ASCII-8BIT")
|
283
|
+
end
|
284
|
+
unless to.valid_encoding?
|
285
|
+
to = to.dup.force_encoding("ASCII-8BIT")
|
286
|
+
end
|
287
|
+
end
|
288
|
+
from_lines = from.split(/\r?\n/)
|
289
|
+
to_lines = to.split(/\r?\n/)
|
290
|
+
if need_encoding
|
291
|
+
from_lines << ""
|
292
|
+
to_lines << ""
|
293
|
+
from_lines << "Encoding: #{failure.expected.encoding.name}"
|
294
|
+
to_lines << "Encoding: #{failure.actual.encoding.name}"
|
295
|
+
end
|
296
|
+
differ = ColorizedReadableDiffer.new(from_lines, to_lines, self)
|
297
|
+
if differ.need_diff?
|
298
|
+
output("")
|
299
|
+
output("diff:")
|
300
|
+
differ.diff
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
def output_fault_in_short(fault)
|
306
|
+
output_single(fault.message, fault_color(fault))
|
307
|
+
output(" [#{fault.test_name}]")
|
308
|
+
output(fault.location.first)
|
309
|
+
end
|
310
|
+
|
311
|
+
def format_fault(fault)
|
312
|
+
fault.long_display
|
313
|
+
end
|
314
|
+
|
315
|
+
def output_statistics(elapsed_time)
|
316
|
+
output("Finished in #{elapsed_time} seconds.")
|
317
|
+
output_summary_marker
|
318
|
+
output(@result)
|
319
|
+
output("%g%% passed" % @result.pass_percentage)
|
320
|
+
unless elapsed_time.zero?
|
321
|
+
output_summary_marker
|
322
|
+
test_throughput = @result.run_count / elapsed_time
|
323
|
+
assertion_throughput = @result.assertion_count / elapsed_time
|
324
|
+
throughput = [
|
325
|
+
"%.2f tests/s" % test_throughput,
|
326
|
+
"%.2f assertions/s" % assertion_throughput,
|
327
|
+
]
|
328
|
+
output(throughput.join(", "))
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
def output_summary_marker
|
333
|
+
term_width = guess_term_width
|
334
|
+
if term_width.zero?
|
335
|
+
marker_width = 6
|
336
|
+
else
|
337
|
+
marker_width = term_width
|
338
|
+
end
|
339
|
+
output("-" * marker_width, summary_marker_color)
|
340
|
+
end
|
341
|
+
|
342
|
+
def test_started(test)
|
343
|
+
return unless output?(VERBOSE)
|
344
|
+
|
345
|
+
name = test.name.sub(/\(.+?\)\z/, '')
|
346
|
+
right_space = 8 * 2
|
347
|
+
left_space = @progress_row_max - right_space
|
348
|
+
left_space = left_space - indent.size - name.size
|
349
|
+
tab_stop = "\t" * ([left_space - 1, 0].max / 8)
|
350
|
+
output_single("#{indent}#{name}:#{tab_stop}", nil, VERBOSE)
|
351
|
+
@test_start = Time.now
|
352
|
+
end
|
353
|
+
|
354
|
+
def test_finished(test)
|
355
|
+
unless @already_outputted
|
356
|
+
output_progress(".", color("pass-marker"))
|
357
|
+
end
|
358
|
+
@already_outputted = false
|
359
|
+
|
360
|
+
return unless output?(VERBOSE)
|
361
|
+
|
362
|
+
output(": (%f)" % (Time.now - @test_start), nil, VERBOSE)
|
363
|
+
end
|
364
|
+
|
365
|
+
def suite_name(prefix, suite)
|
366
|
+
name = suite.name
|
367
|
+
if name.nil?
|
368
|
+
"(anonymous)"
|
369
|
+
else
|
370
|
+
name.sub(/\A#{Regexp.escape(prefix)}/, "")
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
def test_suite_started(suite)
|
375
|
+
last_test_suite = @test_suites.last
|
376
|
+
@test_suites << suite
|
377
|
+
if @top_level
|
378
|
+
@top_level = false
|
379
|
+
return
|
380
|
+
end
|
381
|
+
|
382
|
+
output_single(indent, nil, VERBOSE)
|
383
|
+
if suite.test_case.nil?
|
384
|
+
_color = color("suite")
|
385
|
+
else
|
386
|
+
_color = color("case")
|
387
|
+
end
|
388
|
+
prefix = "#{last_test_suite.name}::"
|
389
|
+
output_single(suite_name(prefix, suite), _color, VERBOSE)
|
390
|
+
output(": ", nil, VERBOSE)
|
391
|
+
@indent += 2
|
392
|
+
end
|
393
|
+
|
394
|
+
def test_suite_finished(suite)
|
395
|
+
@indent -= 2
|
396
|
+
@test_suites.pop
|
397
|
+
end
|
398
|
+
|
399
|
+
def indent
|
400
|
+
if output?(VERBOSE)
|
401
|
+
" " * @indent
|
402
|
+
else
|
403
|
+
""
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
def nl(level=nil)
|
408
|
+
output("", nil, level)
|
409
|
+
end
|
410
|
+
|
411
|
+
def output(something, color=nil, level=nil)
|
412
|
+
return unless output?(level)
|
413
|
+
output_single(something, color, level)
|
414
|
+
@output.puts
|
415
|
+
end
|
416
|
+
|
417
|
+
def output_single(something, color=nil, level=nil)
|
418
|
+
return false unless output?(level)
|
419
|
+
if @use_color and color
|
420
|
+
something = "%s%s%s" % [color.escape_sequence,
|
421
|
+
something,
|
422
|
+
@reset_color.escape_sequence]
|
423
|
+
end
|
424
|
+
@output.write(something)
|
425
|
+
@output.flush
|
426
|
+
true
|
427
|
+
end
|
428
|
+
|
429
|
+
def output_progress(mark, color=nil)
|
430
|
+
if output_single(mark, color, PROGRESS_ONLY)
|
431
|
+
return unless @progress_row_max > 0
|
432
|
+
@progress_row += mark.size
|
433
|
+
if @progress_row >= @progress_row_max
|
434
|
+
nl unless @output_level == VERBOSE
|
435
|
+
@progress_row = 0
|
436
|
+
end
|
437
|
+
end
|
438
|
+
end
|
439
|
+
|
440
|
+
def output_progress_in_detail_marker(fault)
|
441
|
+
if @progress_row_max > 0
|
442
|
+
output("=" * @progress_row_max)
|
443
|
+
else
|
444
|
+
nl
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
def output_progress_in_detail(fault)
|
449
|
+
return if @output_level == SILENT
|
450
|
+
nl
|
451
|
+
output_progress_in_detail_marker(fault)
|
452
|
+
if categorize_fault(fault) == :need_detail_faults
|
453
|
+
output_fault_in_detail(fault)
|
454
|
+
else
|
455
|
+
output_fault_in_short(fault)
|
456
|
+
end
|
457
|
+
output_progress_in_detail_marker(fault)
|
458
|
+
@progress_row = 0
|
459
|
+
end
|
460
|
+
|
461
|
+
def output?(level)
|
462
|
+
(level || @current_output_level) <= @output_level
|
463
|
+
end
|
464
|
+
|
465
|
+
def color(name)
|
466
|
+
_color = @color_scheme[name]
|
467
|
+
_color ||= @color_scheme["success"] if name == "pass"
|
468
|
+
_color ||= ColorScheme.default[name]
|
469
|
+
_color
|
470
|
+
end
|
471
|
+
|
472
|
+
def fault_class_color_name(fault_class)
|
473
|
+
fault_class.name.split(/::/).last.downcase
|
474
|
+
end
|
475
|
+
|
476
|
+
def fault_color(fault)
|
477
|
+
color(fault_class_color_name(fault.class))
|
478
|
+
end
|
479
|
+
|
480
|
+
def fault_marker_color(fault)
|
481
|
+
color("#{fault_class_color_name(fault.class)}-marker")
|
482
|
+
end
|
483
|
+
|
484
|
+
def summary_marker_color
|
485
|
+
color("#{@result.status}-marker")
|
486
|
+
end
|
487
|
+
|
488
|
+
def guess_color_availability
|
489
|
+
return false unless @output.tty?
|
490
|
+
return true if windows? and ruby_2_0_or_later?
|
491
|
+
case ENV["TERM"]
|
492
|
+
when /(?:term|screen)(?:-(?:256)?color)?\z/
|
493
|
+
true
|
494
|
+
else
|
495
|
+
return true if ENV["EMACS"] == "t"
|
496
|
+
false
|
497
|
+
end
|
498
|
+
end
|
499
|
+
|
500
|
+
def windows?
|
501
|
+
/mswin|mingw/ === RUBY_PLATFORM
|
502
|
+
end
|
503
|
+
|
504
|
+
def ruby_2_0_or_later?
|
505
|
+
RUBY_VERSION >= "2.0.0"
|
506
|
+
end
|
507
|
+
|
508
|
+
def guess_progress_row_max
|
509
|
+
term_width = guess_term_width
|
510
|
+
if term_width.zero?
|
511
|
+
if ENV["EMACS"] == "t"
|
512
|
+
-1
|
513
|
+
else
|
514
|
+
79
|
515
|
+
end
|
516
|
+
else
|
517
|
+
term_width
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
521
|
+
def guess_term_width
|
522
|
+
guess_term_width_from_io || guess_term_width_from_env || 0
|
523
|
+
end
|
524
|
+
|
525
|
+
def guess_term_width_from_io
|
526
|
+
if @output.respond_to?(:winsize)
|
527
|
+
begin
|
528
|
+
@output.winsize[1]
|
529
|
+
rescue SystemCallError
|
530
|
+
nil
|
531
|
+
end
|
532
|
+
else
|
533
|
+
nil
|
534
|
+
end
|
535
|
+
end
|
536
|
+
|
537
|
+
def guess_term_width_from_env
|
538
|
+
env = ENV["COLUMNS"] || ENV["TERM_WIDTH"]
|
539
|
+
return nil if env.nil?
|
540
|
+
|
541
|
+
begin
|
542
|
+
Integer(env)
|
543
|
+
rescue ArgumentError
|
544
|
+
nil
|
545
|
+
end
|
546
|
+
end
|
547
|
+
end
|
548
|
+
|
549
|
+
class ColorizedReadableDiffer < Diff::ReadableDiffer
|
550
|
+
def initialize(from, to, runner)
|
551
|
+
@runner = runner
|
552
|
+
super(from, to)
|
553
|
+
end
|
554
|
+
|
555
|
+
def need_diff?(options={})
|
556
|
+
return false if one_line_all_change?
|
557
|
+
operations.each do |tag,|
|
558
|
+
return true if [:replace, :equal].include?(tag)
|
559
|
+
end
|
560
|
+
false
|
561
|
+
end
|
562
|
+
|
563
|
+
private
|
564
|
+
def one_line_all_change?
|
565
|
+
return false if operations.size != 1
|
566
|
+
|
567
|
+
tag, from_start, from_end, to_start, to_end = operations.first
|
568
|
+
return false if tag != :replace
|
569
|
+
return false if [from_start, from_end] != [0, 1]
|
570
|
+
return false if [from_start, from_end] != [to_start, to_end]
|
571
|
+
|
572
|
+
_, _, _line_operations = line_operations(@from.first, @to.first)
|
573
|
+
_line_operations.size == 1
|
574
|
+
end
|
575
|
+
|
576
|
+
def output_single(something, color=nil)
|
577
|
+
@runner.__send__(:output_single, something, color)
|
578
|
+
end
|
579
|
+
|
580
|
+
def output(something, color=nil)
|
581
|
+
@runner.__send__(:output, something, color)
|
582
|
+
end
|
583
|
+
|
584
|
+
def color(name)
|
585
|
+
@runner.__send__(:color, name)
|
586
|
+
end
|
587
|
+
|
588
|
+
def cut_off_ratio
|
589
|
+
0
|
590
|
+
end
|
591
|
+
|
592
|
+
def default_ratio
|
593
|
+
0
|
594
|
+
end
|
595
|
+
|
596
|
+
def tag(mark, color_name, contents)
|
597
|
+
_color = color(color_name)
|
598
|
+
contents.each do |content|
|
599
|
+
output_single(mark, _color)
|
600
|
+
output_single(" ")
|
601
|
+
output(content)
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
def tag_deleted(contents)
|
606
|
+
tag("-", "diff-deleted-tag", contents)
|
607
|
+
end
|
608
|
+
|
609
|
+
def tag_inserted(contents)
|
610
|
+
tag("+", "diff-inserted-tag", contents)
|
611
|
+
end
|
612
|
+
|
613
|
+
def tag_equal(contents)
|
614
|
+
tag(" ", "normal", contents)
|
615
|
+
end
|
616
|
+
|
617
|
+
def tag_difference(contents)
|
618
|
+
tag("?", "diff-difference-tag", contents)
|
619
|
+
end
|
620
|
+
|
621
|
+
def diff_line(from_line, to_line)
|
622
|
+
to_operations = []
|
623
|
+
from_line, to_line, _operations = line_operations(from_line, to_line)
|
624
|
+
|
625
|
+
no_replace = true
|
626
|
+
_operations.each do |tag,|
|
627
|
+
if tag == :replace
|
628
|
+
no_replace = false
|
629
|
+
break
|
630
|
+
end
|
631
|
+
end
|
632
|
+
|
633
|
+
output_single("?", color("diff-difference-tag"))
|
634
|
+
output_single(" ")
|
635
|
+
_operations.each do |tag, from_start, from_end, to_start, to_end|
|
636
|
+
from_width = compute_width(from_line, from_start, from_end)
|
637
|
+
to_width = compute_width(to_line, to_start, to_end)
|
638
|
+
case tag
|
639
|
+
when :replace
|
640
|
+
output_single(from_line[from_start...from_end],
|
641
|
+
color("diff-deleted"))
|
642
|
+
if (from_width < to_width)
|
643
|
+
output_single(" " * (to_width - from_width))
|
644
|
+
end
|
645
|
+
to_operations << Proc.new do
|
646
|
+
output_single(to_line[to_start...to_end],
|
647
|
+
color("diff-inserted"))
|
648
|
+
if (to_width < from_width)
|
649
|
+
output_single(" " * (from_width - to_width))
|
650
|
+
end
|
651
|
+
end
|
652
|
+
when :delete
|
653
|
+
output_single(from_line[from_start...from_end],
|
654
|
+
color("diff-deleted"))
|
655
|
+
unless no_replace
|
656
|
+
to_operations << Proc.new {output_single(" " * from_width)}
|
657
|
+
end
|
658
|
+
when :insert
|
659
|
+
if no_replace
|
660
|
+
output_single(to_line[to_start...to_end],
|
661
|
+
color("diff-inserted"))
|
662
|
+
else
|
663
|
+
output_single(" " * to_width)
|
664
|
+
to_operations << Proc.new do
|
665
|
+
output_single(to_line[to_start...to_end],
|
666
|
+
color("diff-inserted"))
|
667
|
+
end
|
668
|
+
end
|
669
|
+
when :equal
|
670
|
+
output_single(from_line[from_start...from_end])
|
671
|
+
unless no_replace
|
672
|
+
to_operations << Proc.new {output_single(" " * to_width)}
|
673
|
+
end
|
674
|
+
else
|
675
|
+
raise "unknown tag: #{tag}"
|
676
|
+
end
|
677
|
+
end
|
678
|
+
output("")
|
679
|
+
|
680
|
+
unless to_operations.empty?
|
681
|
+
output_single("?", color("diff-difference-tag"))
|
682
|
+
output_single(" ")
|
683
|
+
to_operations.each do |operation|
|
684
|
+
operation.call
|
685
|
+
end
|
686
|
+
output("")
|
687
|
+
end
|
688
|
+
end
|
689
|
+
end
|
690
|
+
end
|
691
|
+
end
|
692
|
+
end
|
693
|
+
end
|