win32-api 1.6.0-universal-mingw32 → 1.6.1.beta1-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +4 -0
- data/Gemfile.lock +5 -5
- data/Rakefile +45 -19
- data/appveyor.yml +12 -0
- data/appveyor/build.cmd +3 -0
- data/lib/win32/api.rb +8 -0
- 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/ruby24_32/win32/api.so +0 -0
- data/lib/win32/ruby24_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/win32-api.gemspec +1 -1
- metadata +8 -341
- data/vendor/bundle/ruby/2.2.0/bin/devkit +0 -23
- data/vendor/bundle/ruby/2.2.0/bin/devkit.bat +0 -6
- data/vendor/bundle/ruby/2.2.0/bin/rake +0 -23
- data/vendor/bundle/ruby/2.2.0/bin/rake.bat +0 -6
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/CHANGELOG +0 -55
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/LICENSE +0 -339
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/README.md +0 -73
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/Rakefile +0 -8
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/colorize.gemspec +0 -35
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize.rb +0 -12
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize/class_methods.rb +0 -116
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize/instance_methods.rb +0 -135
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/test/test_colorize.rb +0 -161
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Gemfile +0 -4
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/LICENSE.txt +0 -22
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/README.md +0 -34
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Rakefile +0 -1
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Rspec-example-matchers.txt +0 -184
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/bin/devkit +0 -87
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/devkit.gemspec +0 -27
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit.rb +0 -18
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/core.rb +0 -53
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/identity.rb +0 -78
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/ssh_identity.rb +0 -53
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/version.rb +0 -3
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/core_spec.rb +0 -46
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/identity_spec.rb +0 -1
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/ssh_identity_spec.rb +0 -1
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit_spec.rb +0 -5
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/spec_helper.rb +0 -8
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/AUTHORS +0 -3
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/COPYING +0 -339
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Changelog.md +0 -415
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Gemfile +0 -9
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/INSTALL +0 -59
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/LICENSE +0 -7
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/README.rdoc +0 -74
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Rakefile +0 -30
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/TODO +0 -6
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/ansi_colors.rb +0 -38
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/asking_for_arrays.rb +0 -18
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/basic_usage.rb +0 -75
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/color_scheme.rb +0 -32
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/get_character.rb +0 -12
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/limit.rb +0 -12
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/menus.rb +0 -65
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/overwrite.rb +0 -19
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/page_and_wrap.rb +0 -322
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/password.rb +0 -7
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/repeat_entry.rb +0 -21
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/trapping_eof.rb +0 -22
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/using_readline.rb +0 -17
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/highline.gemspec +0 -37
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline.rb +0 -1048
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/color_scheme.rb +0 -134
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/compatibility.rb +0 -16
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/import.rb +0 -41
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/menu.rb +0 -381
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/question.rb +0 -480
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/simulate.rb +0 -48
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/style.rb +0 -192
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/version.rb +0 -4
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/setup.rb +0 -1360
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/highline.css +0 -65
- 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 +0 -58
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/string_methods.rb +0 -32
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_color_scheme.rb +0 -96
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_highline.rb +0 -1402
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_import.rb +0 -52
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_menu.rb +0 -439
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_simulator.rb +0 -23
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_string_highline.rb +0 -38
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_style.rb +0 -578
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/BSDL +0 -22
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/COPYING +0 -57
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/Gemfile +0 -9
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/LEGAL +0 -4
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/README.rdoc +0 -19
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/Rakefile +0 -16
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/benchmarks/bm_yhpg.rb +0 -59
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/benchmarks/helper.rb +0 -8
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert.rb +0 -338
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert/enable_tracepoint_events.rb +0 -82
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert/version.rb +0 -3
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/power_assert.gemspec +0 -23
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/test/helper.rb +0 -10
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/test/test_power_assert.rb +0 -512
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/CONTRIBUTING.rdoc +0 -38
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/History.rdoc +0 -719
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/MIT-LICENSE +0 -21
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/Manifest.txt +0 -154
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/README.rdoc +0 -157
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/Rakefile +0 -82
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/bin/rake +0 -33
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/command_line_usage.rdoc +0 -158
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/Rakefile1 +0 -38
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/Rakefile2 +0 -35
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/a.c +0 -6
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/b.c +0 -6
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/main.c +0 -11
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/glossary.rdoc +0 -42
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/jamis.rb +0 -591
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/proto_rake.rdoc +0 -127
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rake.1 +0 -141
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rakefile.rdoc +0 -624
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rational.rdoc +0 -151
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.4.14.rdoc +0 -23
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.4.15.rdoc +0 -35
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.0.rdoc +0 -53
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.3.rdoc +0 -78
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.4.rdoc +0 -46
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.6.0.rdoc +0 -141
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.0.rdoc +0 -119
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.1.rdoc +0 -59
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.2.rdoc +0 -121
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.3.rdoc +0 -47
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.0.rdoc +0 -114
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.2.rdoc +0 -165
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.3.rdoc +0 -112
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.4.rdoc +0 -147
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.5.rdoc +0 -53
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.6.rdoc +0 -37
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.7.rdoc +0 -55
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.0.rdoc +0 -112
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.1.rdoc +0 -52
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.2.2.rdoc +0 -55
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.2.rdoc +0 -49
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.3.rdoc +0 -102
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.4.rdoc +0 -60
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.5.rdoc +0 -55
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.6.rdoc +0 -64
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.0.rdoc +0 -178
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.1.rdoc +0 -58
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.2.rdoc +0 -53
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.3.rdoc +0 -191
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.1.0.rdoc +0 -61
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake.rb +0 -73
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb +0 -787
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/backtrace.rb +0 -23
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/clean.rb +0 -76
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/cloneable.rb +0 -16
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/compositepublisher.rb +0 -21
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/ftptools.rb +0 -137
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/sshpublisher.rb +0 -60
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/cpu_counter.rb +0 -120
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/default_loader.rb +0 -14
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/dsl_definition.rb +0 -194
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/early_time.rb +0 -21
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_creation_task.rb +0 -24
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_list.rb +0 -436
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_task.rb +0 -46
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_utils.rb +0 -123
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/invocation_chain.rb +0 -56
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/invocation_exception_mixin.rb +0 -16
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/late_time.rb +0 -17
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/linked_list.rb +0 -111
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/loaders/makefile.rb +0 -53
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/multi_task.rb +0 -13
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/name_space.rb +0 -38
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/packagetask.rb +0 -199
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/phony.rb +0 -15
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/private_reader.rb +0 -20
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/promise.rb +0 -99
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/pseudo_status.rb +0 -29
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb +0 -38
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_test_loader.rb +0 -22
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rule_recursion_overflow_error.rb +0 -20
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/scope.rb +0 -42
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task.rb +0 -391
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_argument_error.rb +0 -7
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_arguments.rb +0 -102
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_manager.rb +0 -316
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/tasklib.rb +0 -11
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/testtask.rb +0 -204
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/thread_history_display.rb +0 -48
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/thread_pool.rb +0 -163
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/trace_output.rb +0 -22
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/version.rb +0 -7
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/win32.rb +0 -50
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/rakelib/test_times.rake +0 -25
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/file_creation.rb +0 -34
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/helper.rb +0 -134
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/support/rakefile_definitions.rb +0 -476
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/support/ruby_runner.rb +0 -34
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_private_reader.rb +0 -42
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake.rb +0 -40
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_application.rb +0 -659
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_application_options.rb +0 -468
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_backtrace.rb +0 -119
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_clean.rb +0 -61
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_cpu_counter.rb +0 -68
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_definitions.rb +0 -84
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_directory_task.rb +0 -76
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_dsl.rb +0 -40
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_early_time.rb +0 -31
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_creation_task.rb +0 -56
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_list.rb +0 -687
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_list_path_map.rb +0 -15
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_task.rb +0 -197
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_utils.rb +0 -318
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_ftp_file.rb +0 -74
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_functional.rb +0 -484
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_invocation_chain.rb +0 -64
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_late_time.rb +0 -18
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_linked_list.rb +0 -84
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_makefile_loader.rb +0 -46
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_multi_task.rb +0 -64
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_name_space.rb +0 -57
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_package_task.rb +0 -79
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map.rb +0 -168
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map_explode.rb +0 -34
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map_partial.rb +0 -18
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_pseudo_status.rb +0 -21
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_rake_test_loader.rb +0 -20
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_reduce_compat.rb +0 -26
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_require.rb +0 -40
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_rules.rb +0 -388
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_scope.rb +0 -44
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task.rb +0 -430
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_argument_parsing.rb +0 -119
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_arguments.rb +0 -134
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_manager.rb +0 -178
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_manager_argument_resolution.rb +0 -19
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_with_arguments.rb +0 -172
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_test_task.rb +0 -130
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_thread_pool.rb +0 -145
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_top_level_functions.rb +0 -71
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_win32.rb +0 -72
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_thread_history_display.rb +0 -101
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_trace_output.rb +0 -52
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/COPYING +0 -64
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/GPL +0 -339
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/LGPL +0 -502
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/PSFL +0 -271
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/README.md +0 -101
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/Rakefile +0 -71
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test-unit.rb +0 -34
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit.rb +0 -505
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/assertion-failed-error.rb +0 -25
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/assertions.rb +0 -2218
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/attribute-matcher.rb +0 -26
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/attribute.rb +0 -158
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/auto-runner-loader.rb +0 -17
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/autorunner.rb +0 -536
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/code-snippet-fetcher.rb +0 -58
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector.rb +0 -73
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/descendant.rb +0 -19
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/dir.rb +0 -108
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/load.rb +0 -202
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/objectspace.rb +0 -34
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/xml.rb +0 -249
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/color-scheme.rb +0 -198
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/color.rb +0 -134
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/data.rb +0 -262
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/diff.rb +0 -746
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/error.rb +0 -158
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/exception-handler.rb +0 -82
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/failure.rb +0 -169
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/fault-location-detector.rb +0 -100
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/fixture.rb +0 -295
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/notification.rb +0 -136
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/omission.rb +0 -195
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/pending.rb +0 -154
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/priority.rb +0 -192
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/console.rb +0 -59
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/emacs.rb +0 -8
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/xml.rb +0 -15
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/test-suite-creator.rb +0 -89
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testcase.rb +0 -811
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testresult.rb +0 -132
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testsuite.rb +0 -175
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/console/outputlevel.rb +0 -15
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/console/testrunner.rb +0 -693
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/emacs/testrunner.rb +0 -49
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunner.rb +0 -53
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunnermediator.rb +0 -114
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunnerutilities.rb +0 -41
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/xml/testrunner.rb +0 -224
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/backtracefilter.rb +0 -59
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/method-owner-finder.rb +0 -28
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/observable.rb +0 -90
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/output.rb +0 -31
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/procwrapper.rb +0 -48
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/version.rb +0 -5
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/adder.rb +0 -13
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/subtracter.rb +0 -12
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_adder.rb +0 -20
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_subtracter.rb +0 -20
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_user.rb +0 -23
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test-descendant.rb +0 -178
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test-load.rb +0 -442
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test_dir.rb +0 -406
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test_objectspace.rb +0 -100
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header-label.csv +0 -3
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header-label.tsv +0 -3
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header.csv +0 -3
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header.tsv +0 -3
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/no-header.csv +0 -2
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/no-header.tsv +0 -2
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/plus.csv +0 -3
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/run-test.rb +0 -22
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-assertions.rb +0 -2160
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute-matcher.rb +0 -38
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute.rb +0 -123
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-code-snippet.rb +0 -37
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-color-scheme.rb +0 -82
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-color.rb +0 -47
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-data.rb +0 -303
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-diff.rb +0 -518
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-emacs-runner.rb +0 -60
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-error.rb +0 -26
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-failure.rb +0 -33
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-fault-location-detector.rb +0 -163
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-fixture.rb +0 -713
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-notification.rb +0 -33
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-omission.rb +0 -81
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-pending.rb +0 -70
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-priority.rb +0 -173
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-case.rb +0 -1171
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-result.rb +0 -113
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-suite-creator.rb +0 -97
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-suite.rb +0 -150
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/testunit-test-util.rb +0 -31
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/ui/test_testrunmediator.rb +0 -20
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test-method-owner-finder.rb +0 -38
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test-output.rb +0 -11
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_backtracefilter.rb +0 -52
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_observable.rb +0 -102
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_procwrapper.rb +0 -36
- data/vendor/bundle/ruby/2.2.0/specifications/colorize-0.7.7.gemspec +0 -38
- data/vendor/bundle/ruby/2.2.0/specifications/devkit-0.1.0.gemspec +0 -46
- data/vendor/bundle/ruby/2.2.0/specifications/highline-1.7.8.gemspec +0 -37
- data/vendor/bundle/ruby/2.2.0/specifications/power_assert-0.3.0.gemspec +0 -41
- data/vendor/bundle/ruby/2.2.0/specifications/rake-11.1.2.gemspec +0 -43
- data/vendor/bundle/ruby/2.2.0/specifications/test-unit-3.1.9.gemspec +0 -47
| @@ -1,25 +0,0 @@ | |
| 1 | 
            -
            #--
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # Author:: Nathaniel Talbott.
         | 
| 4 | 
            -
            # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
         | 
| 5 | 
            -
            # License:: Ruby license.
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            module Test
         | 
| 8 | 
            -
              module Unit
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                # Thrown by Test::Unit::Assertions when an assertion fails.
         | 
| 11 | 
            -
                class AssertionFailedError < StandardError
         | 
| 12 | 
            -
                  attr_accessor :expected, :actual, :user_message
         | 
| 13 | 
            -
                  attr_accessor :inspected_expected, :inspected_actual
         | 
| 14 | 
            -
                  def initialize(message=nil, options=nil)
         | 
| 15 | 
            -
                    options ||= {}
         | 
| 16 | 
            -
                    @expected = options[:expected]
         | 
| 17 | 
            -
                    @actual = options[:actual]
         | 
| 18 | 
            -
                    @inspected_expected = options[:inspected_expected]
         | 
| 19 | 
            -
                    @inspected_actual = options[:inspected_actual]
         | 
| 20 | 
            -
                    @user_message = options[:user_message]
         | 
| 21 | 
            -
                    super(message)
         | 
| 22 | 
            -
                  end
         | 
| 23 | 
            -
                end
         | 
| 24 | 
            -
              end
         | 
| 25 | 
            -
            end
         | 
| @@ -1,2218 +0,0 @@ | |
| 1 | 
            -
            # Author:: Nathaniel Talbott.
         | 
| 2 | 
            -
            # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
         | 
| 3 | 
            -
            #             Copyright (c) 2009-2013 Kouhei Sutou. All rights reserved.
         | 
| 4 | 
            -
            # License:: Ruby license.
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            require 'test/unit/assertion-failed-error'
         | 
| 7 | 
            -
            require 'test/unit/util/backtracefilter'
         | 
| 8 | 
            -
            require 'test/unit/util/method-owner-finder'
         | 
| 9 | 
            -
            require 'test/unit/diff'
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            begin
         | 
| 12 | 
            -
              require 'power_assert'
         | 
| 13 | 
            -
            rescue LoadError, SyntaxError
         | 
| 14 | 
            -
            end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            module Test
         | 
| 17 | 
            -
              module Unit
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                ##
         | 
| 20 | 
            -
                # Test::Unit::Assertions contains the standard Test::Unit assertions.
         | 
| 21 | 
            -
                # Assertions is included in Test::Unit::TestCase.
         | 
| 22 | 
            -
                #
         | 
| 23 | 
            -
                # To include it in your own code and use its functionality, you simply
         | 
| 24 | 
            -
                # need to rescue Test::Unit::AssertionFailedError. Additionally you may
         | 
| 25 | 
            -
                # override add_assertion to get notified whenever an assertion is made.
         | 
| 26 | 
            -
                #
         | 
| 27 | 
            -
                # Notes:
         | 
| 28 | 
            -
                #
         | 
| 29 | 
            -
                # * The message to each assertion, if given, will be propagated with the
         | 
| 30 | 
            -
                #   failure.
         | 
| 31 | 
            -
                # * It is easy to add your own assertions based on assert_block().
         | 
| 32 | 
            -
                #
         | 
| 33 | 
            -
                # @example Example Custom Assertion
         | 
| 34 | 
            -
                #
         | 
| 35 | 
            -
                #   def deny(boolean, message = nil)
         | 
| 36 | 
            -
                #     message = build_message message, '<?> is not false or nil.', boolean
         | 
| 37 | 
            -
                #     assert_block message do
         | 
| 38 | 
            -
                #       not boolean
         | 
| 39 | 
            -
                #     end
         | 
| 40 | 
            -
                #   end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                module Assertions
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                  ##
         | 
| 45 | 
            -
                  # The assertion upon which all other assertions are based. Passes if the
         | 
| 46 | 
            -
                  # block yields true.
         | 
| 47 | 
            -
                  #
         | 
| 48 | 
            -
                  # @example
         | 
| 49 | 
            -
                  #   assert_block "Couldn't do the thing" do
         | 
| 50 | 
            -
                  #     do_the_thing
         | 
| 51 | 
            -
                  #   end
         | 
| 52 | 
            -
                  def assert_block(message="assert_block failed.")
         | 
| 53 | 
            -
                    _wrap_assertion do
         | 
| 54 | 
            -
                      if (! yield)
         | 
| 55 | 
            -
                        raise AssertionFailedError.new(message.to_s)
         | 
| 56 | 
            -
                      end
         | 
| 57 | 
            -
                    end
         | 
| 58 | 
            -
                  end
         | 
| 59 | 
            -
             | 
| 60 | 
            -
                  # @private
         | 
| 61 | 
            -
                  NOT_SPECIFIED = Object.new
         | 
| 62 | 
            -
             | 
| 63 | 
            -
                  # @overload assert(object, message=nil)
         | 
| 64 | 
            -
                  #
         | 
| 65 | 
            -
                  #   Asserts that `object` is not false nor nil.
         | 
| 66 | 
            -
                  #
         | 
| 67 | 
            -
                  #   Normally, you don't need to use this assertion. Use more
         | 
| 68 | 
            -
                  #   specific assertions such as #assert_equal and
         | 
| 69 | 
            -
                  #   #assert_include.
         | 
| 70 | 
            -
                  #
         | 
| 71 | 
            -
                  #   @example Pass patterns
         | 
| 72 | 
            -
                  #     assert(true)               # => pass
         | 
| 73 | 
            -
                  #     assert([1, 2].include?(1)) # => pass
         | 
| 74 | 
            -
                  #
         | 
| 75 | 
            -
                  #   @example Failure patterns
         | 
| 76 | 
            -
                  #     assert(nil)                # => failure
         | 
| 77 | 
            -
                  #     assert(false)              # => failure
         | 
| 78 | 
            -
                  #     assert([1, 2].include?(5)) # => failure
         | 
| 79 | 
            -
                  #
         | 
| 80 | 
            -
                  #   @param [Object] object The check target.
         | 
| 81 | 
            -
                  #   @param [String] message The additional user message. It is
         | 
| 82 | 
            -
                  #     showed when the assertion is failed.
         | 
| 83 | 
            -
                  #   @return [void]
         | 
| 84 | 
            -
                  #
         | 
| 85 | 
            -
                  # @overload assert(message=nil) {}
         | 
| 86 | 
            -
                  #
         | 
| 87 | 
            -
                  #   Asserts that the givens block returns not false nor nil.
         | 
| 88 | 
            -
                  #
         | 
| 89 | 
            -
                  #   This style uses Power Assert. It means that you can see each
         | 
| 90 | 
            -
                  #   object values in method chains on failure. See the following
         | 
| 91 | 
            -
                  #   example about Power Assert.
         | 
| 92 | 
            -
                  #
         | 
| 93 | 
            -
                  #   @example Power Assert
         | 
| 94 | 
            -
                  #     coins = [1, 5, 50]
         | 
| 95 | 
            -
                  #     target_coin = 10
         | 
| 96 | 
            -
                  #     assert do
         | 
| 97 | 
            -
                  #       coins.include?(target_coin)
         | 
| 98 | 
            -
                  #     end
         | 
| 99 | 
            -
                  #     # =>
         | 
| 100 | 
            -
                  #     #  coins.include?(target_coin)
         | 
| 101 | 
            -
                  #     #  |     |        |
         | 
| 102 | 
            -
                  #     #  |     |        10
         | 
| 103 | 
            -
                  #     #  |     false
         | 
| 104 | 
            -
                  #     #  [1, 5, 50]
         | 
| 105 | 
            -
                  #
         | 
| 106 | 
            -
                  #   We recommend you to use Power Assert for predicate method
         | 
| 107 | 
            -
                  #   checks rather than existing assertions such as
         | 
| 108 | 
            -
                  #   #assert_include and #assert_predicate. Power Assert shows
         | 
| 109 | 
            -
                  #   useful message for debugging.
         | 
| 110 | 
            -
                  #
         | 
| 111 | 
            -
                  #   We don't recommend you use Power Assert for equality
         | 
| 112 | 
            -
                  #   check. You should use #assert_equal for the case. Because
         | 
| 113 | 
            -
                  #   #assert_equal shows more useful message for debugging.
         | 
| 114 | 
            -
                  #
         | 
| 115 | 
            -
                  #   @example Pass patterns
         | 
| 116 | 
            -
                  #     assert {true}               # => pass
         | 
| 117 | 
            -
                  #     assert {[1, 2].include?(1)} # => pass
         | 
| 118 | 
            -
                  #
         | 
| 119 | 
            -
                  #   @example Failure patterns
         | 
| 120 | 
            -
                  #     assert {nil}                # => failure
         | 
| 121 | 
            -
                  #     assert {false}              # => failure
         | 
| 122 | 
            -
                  #     assert {[1, 2].include?(5)} # => failure
         | 
| 123 | 
            -
                  #
         | 
| 124 | 
            -
                  #   @param [String] message The additional user message. It is
         | 
| 125 | 
            -
                  #     showed when the assertion is failed.
         | 
| 126 | 
            -
                  #   @yield [] Given no parameters to the block.
         | 
| 127 | 
            -
                  #   @yieldreturn [Object] The checked object.
         | 
| 128 | 
            -
                  #   @return [void]
         | 
| 129 | 
            -
                  def assert(object=NOT_SPECIFIED, message=nil, &block)
         | 
| 130 | 
            -
                    _wrap_assertion do
         | 
| 131 | 
            -
                      have_object = !NOT_SPECIFIED.equal?(object)
         | 
| 132 | 
            -
                      if block
         | 
| 133 | 
            -
                        message = object if have_object
         | 
| 134 | 
            -
                        if defined?(PowerAssert)
         | 
| 135 | 
            -
                          PowerAssert.start(block, :assertion_method => __callee__) do |pa|
         | 
| 136 | 
            -
                            pa_message = AssertionMessage.delayed_literal(&pa.message_proc)
         | 
| 137 | 
            -
                            assertion_message = build_message(message, "?", pa_message)
         | 
| 138 | 
            -
                            assert_block(assertion_message) do
         | 
| 139 | 
            -
                              pa.yield
         | 
| 140 | 
            -
                            end
         | 
| 141 | 
            -
                          end
         | 
| 142 | 
            -
                        else
         | 
| 143 | 
            -
                          assert(yield, message)
         | 
| 144 | 
            -
                        end
         | 
| 145 | 
            -
                      else
         | 
| 146 | 
            -
                        unless have_object
         | 
| 147 | 
            -
                          raise ArgumentError, "wrong number of arguments (0 for 1..2)"
         | 
| 148 | 
            -
                        end
         | 
| 149 | 
            -
                        assertion_message = nil
         | 
| 150 | 
            -
                        case message
         | 
| 151 | 
            -
                        when nil, String, Proc
         | 
| 152 | 
            -
                        when AssertionMessage
         | 
| 153 | 
            -
                          assertion_message = message
         | 
| 154 | 
            -
                        else
         | 
| 155 | 
            -
                          error_message = "assertion message must be String, Proc or "
         | 
| 156 | 
            -
                          error_message << "#{AssertionMessage}: "
         | 
| 157 | 
            -
                          error_message << "<#{message.inspect}>(<#{message.class}>)"
         | 
| 158 | 
            -
                          raise ArgumentError, error_message, filter_backtrace(caller)
         | 
| 159 | 
            -
                        end
         | 
| 160 | 
            -
                        assertion_message ||= build_message(message,
         | 
| 161 | 
            -
                                                            "<?> is not true.",
         | 
| 162 | 
            -
                                                            object)
         | 
| 163 | 
            -
                        assert_block(assertion_message) do
         | 
| 164 | 
            -
                          object
         | 
| 165 | 
            -
                        end
         | 
| 166 | 
            -
                      end
         | 
| 167 | 
            -
                    end
         | 
| 168 | 
            -
                  end
         | 
| 169 | 
            -
             | 
| 170 | 
            -
                  # Asserts that +object+ is false or nil.
         | 
| 171 | 
            -
                  #
         | 
| 172 | 
            -
                  # @note Just for minitest compatibility. :<
         | 
| 173 | 
            -
                  #
         | 
| 174 | 
            -
                  # @param [Object] object The object to be asserted.
         | 
| 175 | 
            -
                  # @return [void]
         | 
| 176 | 
            -
                  #
         | 
| 177 | 
            -
                  # @example Pass patterns
         | 
| 178 | 
            -
                  #   refute(false)    # => pass
         | 
| 179 | 
            -
                  #   refute(nil)      # => pass
         | 
| 180 | 
            -
                  #
         | 
| 181 | 
            -
                  # @example Failure patterns
         | 
| 182 | 
            -
                  #   refute(true)     # => failure
         | 
| 183 | 
            -
                  #   refute("string") # => failure
         | 
| 184 | 
            -
                  #
         | 
| 185 | 
            -
                  # @since 2.5.3
         | 
| 186 | 
            -
                  def refute(object, message=nil)
         | 
| 187 | 
            -
                    _wrap_assertion do
         | 
| 188 | 
            -
                      assertion_message = nil
         | 
| 189 | 
            -
                      case message
         | 
| 190 | 
            -
                      when nil, String, Proc
         | 
| 191 | 
            -
                      when AssertionMessage
         | 
| 192 | 
            -
                        assertion_message = message
         | 
| 193 | 
            -
                      else
         | 
| 194 | 
            -
                        error_message = "assertion message must be String, Proc or "
         | 
| 195 | 
            -
                        error_message << "#{AssertionMessage}: "
         | 
| 196 | 
            -
                        error_message << "<#{message.inspect}>(<#{message.class}>)"
         | 
| 197 | 
            -
                        raise ArgumentError, error_message, filter_backtrace(caller)
         | 
| 198 | 
            -
                      end
         | 
| 199 | 
            -
                      assert_block("refute should not be called with a block.") do
         | 
| 200 | 
            -
                        !block_given?
         | 
| 201 | 
            -
                      end
         | 
| 202 | 
            -
                      assertion_message ||= build_message(message,
         | 
| 203 | 
            -
                                                          "<?> is neither nil or false.",
         | 
| 204 | 
            -
                                                          object)
         | 
| 205 | 
            -
                      assert_block(assertion_message) do
         | 
| 206 | 
            -
                        not object
         | 
| 207 | 
            -
                      end
         | 
| 208 | 
            -
                    end
         | 
| 209 | 
            -
                  end
         | 
| 210 | 
            -
             | 
| 211 | 
            -
                  ##
         | 
| 212 | 
            -
                  # Passes if +expected+ == +actual+.
         | 
| 213 | 
            -
                  #
         | 
| 214 | 
            -
                  # Note that the ordering of arguments is important, since a helpful
         | 
| 215 | 
            -
                  # error message is generated when this one fails that tells you the
         | 
| 216 | 
            -
                  # values of expected and actual.
         | 
| 217 | 
            -
                  #
         | 
| 218 | 
            -
                  # @example
         | 
| 219 | 
            -
                  #   assert_equal 'MY STRING', 'my string'.upcase
         | 
| 220 | 
            -
                  def assert_equal(expected, actual, message=nil)
         | 
| 221 | 
            -
                    diff = AssertionMessage.delayed_diff(expected, actual)
         | 
| 222 | 
            -
                    if expected.respond_to?(:encoding) and
         | 
| 223 | 
            -
                        actual.respond_to?(:encoding) and
         | 
| 224 | 
            -
                        expected.encoding != actual.encoding
         | 
| 225 | 
            -
                      format = <<EOT
         | 
| 226 | 
            -
            <?>(?) expected but was
         | 
| 227 | 
            -
            <?>(?).?
         | 
| 228 | 
            -
            EOT
         | 
| 229 | 
            -
                      full_message = build_message(message, format,
         | 
| 230 | 
            -
                                                   expected, expected.encoding.name,
         | 
| 231 | 
            -
                                                   actual, actual.encoding.name,
         | 
| 232 | 
            -
                                                   diff)
         | 
| 233 | 
            -
                    else
         | 
| 234 | 
            -
                      full_message = build_message(message, <<EOT, expected, actual, diff)
         | 
| 235 | 
            -
            <?> expected but was
         | 
| 236 | 
            -
            <?>.?
         | 
| 237 | 
            -
            EOT
         | 
| 238 | 
            -
                    end
         | 
| 239 | 
            -
                    begin
         | 
| 240 | 
            -
                      assert_block(full_message) { expected == actual }
         | 
| 241 | 
            -
                    rescue AssertionFailedError => failure
         | 
| 242 | 
            -
                      _set_failed_information(failure, expected, actual, message)
         | 
| 243 | 
            -
                      raise failure # For JRuby. :<
         | 
| 244 | 
            -
                    end
         | 
| 245 | 
            -
                  end
         | 
| 246 | 
            -
             | 
| 247 | 
            -
                  ##
         | 
| 248 | 
            -
                  # Passes if the block raises one of the expected
         | 
| 249 | 
            -
                  # exceptions. When an expected exception is an Exception
         | 
| 250 | 
            -
                  # object, passes if expected_exception == actual_exception.
         | 
| 251 | 
            -
                  #
         | 
| 252 | 
            -
                  # @example
         | 
| 253 | 
            -
                  #   assert_raise(RuntimeError, LoadError) do
         | 
| 254 | 
            -
                  #     raise 'Boom!!!'
         | 
| 255 | 
            -
                  #   end # -> pass
         | 
| 256 | 
            -
                  #
         | 
| 257 | 
            -
                  #   assert_raise do
         | 
| 258 | 
            -
                  #     raise Exception, 'Any exception should be raised!!!'
         | 
| 259 | 
            -
                  #   end # -> pass
         | 
| 260 | 
            -
                  #
         | 
| 261 | 
            -
                  #   assert_raise(RuntimeError.new("XXX")) {raise "XXX"} # -> pass
         | 
| 262 | 
            -
                  #   assert_raise(MyError.new("XXX"))      {raise "XXX"} # -> fail
         | 
| 263 | 
            -
                  #   assert_raise(RuntimeError.new("ZZZ")) {raise "XXX"} # -> fail
         | 
| 264 | 
            -
                  def assert_raise(*args, &block)
         | 
| 265 | 
            -
                    assert_expected_exception = Proc.new do |*_args|
         | 
| 266 | 
            -
                      message, assert_exception_helper, actual_exception = _args
         | 
| 267 | 
            -
                      expected = assert_exception_helper.expected_exceptions
         | 
| 268 | 
            -
                      diff = AssertionMessage.delayed_diff(expected, actual_exception)
         | 
| 269 | 
            -
                      full_message = build_message(message,
         | 
| 270 | 
            -
                                                   "<?> exception expected but was\n<?>.?",
         | 
| 271 | 
            -
                                                   expected, actual_exception, diff)
         | 
| 272 | 
            -
                      begin
         | 
| 273 | 
            -
                        assert_block(full_message) do
         | 
| 274 | 
            -
                          expected == [] or
         | 
| 275 | 
            -
                            assert_exception_helper.expected?(actual_exception)
         | 
| 276 | 
            -
                        end
         | 
| 277 | 
            -
                      rescue AssertionFailedError => failure
         | 
| 278 | 
            -
                        _set_failed_information(failure, expected, actual_exception,
         | 
| 279 | 
            -
                                                message)
         | 
| 280 | 
            -
                        raise failure # For JRuby. :<
         | 
| 281 | 
            -
                      end
         | 
| 282 | 
            -
                    end
         | 
| 283 | 
            -
                    _assert_raise(assert_expected_exception, *args, &block)
         | 
| 284 | 
            -
                  end
         | 
| 285 | 
            -
             | 
| 286 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 287 | 
            -
                  alias_method :assert_raises, :assert_raise
         | 
| 288 | 
            -
             | 
| 289 | 
            -
                  ##
         | 
| 290 | 
            -
                  # Passes if the block raises one of the given
         | 
| 291 | 
            -
                  # exceptions or sub exceptions of the given exceptions.
         | 
| 292 | 
            -
                  #
         | 
| 293 | 
            -
                  # @example
         | 
| 294 | 
            -
                  #   assert_raise_kind_of(SystemCallError) do
         | 
| 295 | 
            -
                  #     raise Errno::EACCES
         | 
| 296 | 
            -
                  #   end
         | 
| 297 | 
            -
                  def assert_raise_kind_of(*args, &block)
         | 
| 298 | 
            -
                    assert_expected_exception = Proc.new do |*_args|
         | 
| 299 | 
            -
                      message, assert_exception_helper, actual_exception = _args
         | 
| 300 | 
            -
                      expected = assert_exception_helper.expected_exceptions
         | 
| 301 | 
            -
                      full_message = build_message(message,
         | 
| 302 | 
            -
                                                   "<?> family exception expected " +
         | 
| 303 | 
            -
                                                   "but was\n<?>.",
         | 
| 304 | 
            -
                                                   expected, actual_exception)
         | 
| 305 | 
            -
                      assert_block(full_message) do
         | 
| 306 | 
            -
                        assert_exception_helper.expected?(actual_exception, :kind_of?)
         | 
| 307 | 
            -
                      end
         | 
| 308 | 
            -
                    end
         | 
| 309 | 
            -
                    _assert_raise(assert_expected_exception, *args, &block)
         | 
| 310 | 
            -
                  end
         | 
| 311 | 
            -
             | 
| 312 | 
            -
             | 
| 313 | 
            -
                  ##
         | 
| 314 | 
            -
                  # Passes if +object+.instance_of?(+klass+). When +klass+ is
         | 
| 315 | 
            -
                  # an array of classes, it passes if any class
         | 
| 316 | 
            -
                  # satisfies +object.instance_of?(class).
         | 
| 317 | 
            -
                  #
         | 
| 318 | 
            -
                  # @example
         | 
| 319 | 
            -
                  #   assert_instance_of(String, 'foo')            # -> pass
         | 
| 320 | 
            -
                  #   assert_instance_of([Fixnum, NilClass], 100)  # -> pass
         | 
| 321 | 
            -
                  #   assert_instance_of([Numeric, NilClass], 100) # -> fail
         | 
| 322 | 
            -
                  def assert_instance_of(klass, object, message="")
         | 
| 323 | 
            -
                    _wrap_assertion do
         | 
| 324 | 
            -
                      if klass.is_a?(Array)
         | 
| 325 | 
            -
                        klasses = klass
         | 
| 326 | 
            -
                      else
         | 
| 327 | 
            -
                        klasses = [klass]
         | 
| 328 | 
            -
                      end
         | 
| 329 | 
            -
                      assert_block("The first parameter to assert_instance_of should be " +
         | 
| 330 | 
            -
                                   "a Class or an Array of Class.") do
         | 
| 331 | 
            -
                        klasses.all? {|k| k.is_a?(Class)}
         | 
| 332 | 
            -
                      end
         | 
| 333 | 
            -
                      klass_message = AssertionMessage.maybe_container(klass) do |value|
         | 
| 334 | 
            -
                        "<#{value}>"
         | 
| 335 | 
            -
                      end
         | 
| 336 | 
            -
                      full_message = build_message(message, <<EOT, object, klass_message, object.class)
         | 
| 337 | 
            -
            <?> expected to be instance_of\\?
         | 
| 338 | 
            -
            ? but was
         | 
| 339 | 
            -
            <?>.
         | 
| 340 | 
            -
            EOT
         | 
| 341 | 
            -
                      assert_block(full_message) do
         | 
| 342 | 
            -
                        klasses.any? {|k| object.instance_of?(k)}
         | 
| 343 | 
            -
                      end
         | 
| 344 | 
            -
                    end
         | 
| 345 | 
            -
                  end
         | 
| 346 | 
            -
             | 
| 347 | 
            -
                  ##
         | 
| 348 | 
            -
                  # Passes if +object+.instance_of?(+klass+) does not hold.
         | 
| 349 | 
            -
                  # When +klass+ is an array of classes, it passes if no class
         | 
| 350 | 
            -
                  # satisfies +object.instance_of?(class).
         | 
| 351 | 
            -
                  #
         | 
| 352 | 
            -
                  # @example
         | 
| 353 | 
            -
                  #   assert_not_instance_of(String, 100)                # -> pass
         | 
| 354 | 
            -
                  #   assert_not_instance_of([Fixnum, NilClass], '100')  # -> pass
         | 
| 355 | 
            -
                  #   assert_not_instance_of([Numeric, NilClass], 100)   # -> fail
         | 
| 356 | 
            -
                  #
         | 
| 357 | 
            -
                  # @since 3.0.0
         | 
| 358 | 
            -
                  def assert_not_instance_of(klass, object, message="")
         | 
| 359 | 
            -
                    _wrap_assertion do
         | 
| 360 | 
            -
                      if klass.is_a?(Array)
         | 
| 361 | 
            -
                        klasses = klass
         | 
| 362 | 
            -
                      else
         | 
| 363 | 
            -
                        klasses = [klass]
         | 
| 364 | 
            -
                      end
         | 
| 365 | 
            -
                      assert_block("The first parameter to assert_not_instance_of should be " <<
         | 
| 366 | 
            -
                                   "a Class or an Array of Class.") do
         | 
| 367 | 
            -
                        klasses.all? {|k| k.is_a?(Class)}
         | 
| 368 | 
            -
                      end
         | 
| 369 | 
            -
                      klass_message = AssertionMessage.maybe_container(klass) do |value|
         | 
| 370 | 
            -
                        "<#{value}>"
         | 
| 371 | 
            -
                      end
         | 
| 372 | 
            -
                      full_message = build_message(message,
         | 
| 373 | 
            -
                                                   "<?> expected to not be instance_of\\?\n" +
         | 
| 374 | 
            -
                                                   "? but was.",
         | 
| 375 | 
            -
                                                   object,
         | 
| 376 | 
            -
                                                   klass_message)
         | 
| 377 | 
            -
                      assert_block(full_message) do
         | 
| 378 | 
            -
                        klasses.none? {|k| object.instance_of?(k)}
         | 
| 379 | 
            -
                      end
         | 
| 380 | 
            -
                    end
         | 
| 381 | 
            -
                  end
         | 
| 382 | 
            -
             | 
| 383 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 384 | 
            -
                  #
         | 
| 385 | 
            -
                  # @since 3.0.0
         | 
| 386 | 
            -
                  alias_method :refute_instance_of, :assert_not_instance_of
         | 
| 387 | 
            -
             | 
| 388 | 
            -
                  ##
         | 
| 389 | 
            -
                  # Passes if +object+ is nil.
         | 
| 390 | 
            -
                  #
         | 
| 391 | 
            -
                  # @example
         | 
| 392 | 
            -
                  #   assert_nil [1, 2].uniq!
         | 
| 393 | 
            -
                  def assert_nil(object, message="")
         | 
| 394 | 
            -
                    full_message = build_message(message, <<EOT, object)
         | 
| 395 | 
            -
            <?> expected to be nil.
         | 
| 396 | 
            -
            EOT
         | 
| 397 | 
            -
                    assert_block(full_message) { object.nil? }
         | 
| 398 | 
            -
                  end
         | 
| 399 | 
            -
             | 
| 400 | 
            -
                  ##
         | 
| 401 | 
            -
                  # Passes if +object+.kind_of?(+klass+). When +klass+ is
         | 
| 402 | 
            -
                  # an array of classes or modules, it passes if any
         | 
| 403 | 
            -
                  # class or module satisfies +object.kind_of?(class_or_module).
         | 
| 404 | 
            -
                  #
         | 
| 405 | 
            -
                  # @example
         | 
| 406 | 
            -
                  #   assert_kind_of(Object, 'foo')                # -> pass
         | 
| 407 | 
            -
                  #   assert_kind_of([Fixnum, NilClass], 100)      # -> pass
         | 
| 408 | 
            -
                  #   assert_kind_of([Fixnum, NilClass], "string") # -> fail
         | 
| 409 | 
            -
                  def assert_kind_of(klass, object, message="")
         | 
| 410 | 
            -
                    _wrap_assertion do
         | 
| 411 | 
            -
                      if klass.is_a?(Array)
         | 
| 412 | 
            -
                        klasses = klass
         | 
| 413 | 
            -
                      else
         | 
| 414 | 
            -
                        klasses = [klass]
         | 
| 415 | 
            -
                      end
         | 
| 416 | 
            -
                      assert_block("The first parameter to assert_kind_of should be " +
         | 
| 417 | 
            -
                                   "a kind_of Module or an Array of a kind_of Module.") do
         | 
| 418 | 
            -
                        klasses.all? {|k| k.kind_of?(Module)}
         | 
| 419 | 
            -
                      end
         | 
| 420 | 
            -
                      klass_message = AssertionMessage.maybe_container(klass) do |value|
         | 
| 421 | 
            -
                        "<#{value}>"
         | 
| 422 | 
            -
                      end
         | 
| 423 | 
            -
                      full_message = build_message(message,
         | 
| 424 | 
            -
                                                   "<?> expected to be kind_of\\?\n" +
         | 
| 425 | 
            -
                                                   "? but was\n" +
         | 
| 426 | 
            -
                                                   "<?>.",
         | 
| 427 | 
            -
                                                   object,
         | 
| 428 | 
            -
                                                   klass_message,
         | 
| 429 | 
            -
                                                   object.class)
         | 
| 430 | 
            -
                      assert_block(full_message) do
         | 
| 431 | 
            -
                        klasses.any? {|k| object.kind_of?(k)}
         | 
| 432 | 
            -
                      end
         | 
| 433 | 
            -
                    end
         | 
| 434 | 
            -
                  end
         | 
| 435 | 
            -
             | 
| 436 | 
            -
                  ##
         | 
| 437 | 
            -
                  # Passes if +object+.kind_of?(+klass+) does not hold.
         | 
| 438 | 
            -
                  # When +klass+ is an array of classes or modules, it passes only if all
         | 
| 439 | 
            -
                  # classes (and modules) do not satisfy +object.kind_of?(class_or_module).
         | 
| 440 | 
            -
                  #
         | 
| 441 | 
            -
                  # @example
         | 
| 442 | 
            -
                  #   assert_not_kind_of(Fixnum, 'foo')           # -> pass
         | 
| 443 | 
            -
                  #   assert_not_kind_of([Fixnum, NilClass], '0') # -> pass
         | 
| 444 | 
            -
                  #   assert_not_kind_of([Fixnum, NilClass], 100) # -> fail
         | 
| 445 | 
            -
                  #
         | 
| 446 | 
            -
                  # @since 3.0.0
         | 
| 447 | 
            -
                  def assert_not_kind_of(klass, object, message="")
         | 
| 448 | 
            -
                    _wrap_assertion do
         | 
| 449 | 
            -
                      if klass.is_a?(Array)
         | 
| 450 | 
            -
                        klasses = klass
         | 
| 451 | 
            -
                      else
         | 
| 452 | 
            -
                        klasses = [klass]
         | 
| 453 | 
            -
                      end
         | 
| 454 | 
            -
                      assert_block("The first parameter to assert_not_kind_of should be " +
         | 
| 455 | 
            -
                                   "a kind_of Module or an Array of a kind_of Module.") do
         | 
| 456 | 
            -
                        klasses.all? {|k| k.kind_of?(Module)}
         | 
| 457 | 
            -
                      end
         | 
| 458 | 
            -
                      klass_message = AssertionMessage.maybe_container(klass) do |value|
         | 
| 459 | 
            -
                        "<#{value}>"
         | 
| 460 | 
            -
                      end
         | 
| 461 | 
            -
                      full_message = build_message(message,
         | 
| 462 | 
            -
                                                   "<?> expected to not be kind_of\\?\n" +
         | 
| 463 | 
            -
                                                   "? but was.",
         | 
| 464 | 
            -
                                                   object,
         | 
| 465 | 
            -
                                                   klass_message)
         | 
| 466 | 
            -
                      assert_block(full_message) do
         | 
| 467 | 
            -
                        klasses.none? {|k| object.kind_of?(k)}
         | 
| 468 | 
            -
                      end
         | 
| 469 | 
            -
                    end
         | 
| 470 | 
            -
                  end
         | 
| 471 | 
            -
             | 
| 472 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 473 | 
            -
                  #
         | 
| 474 | 
            -
                  # @since 3.0.0
         | 
| 475 | 
            -
                  alias_method :refute_kind_of, :assert_not_kind_of
         | 
| 476 | 
            -
             | 
| 477 | 
            -
                  ##
         | 
| 478 | 
            -
                  # Passes if +object+ .respond_to? +method+
         | 
| 479 | 
            -
                  #
         | 
| 480 | 
            -
                  # @example
         | 
| 481 | 
            -
                  #   assert_respond_to 'bugbear', :slice
         | 
| 482 | 
            -
                  def assert_respond_to(object, method, message="")
         | 
| 483 | 
            -
                    _wrap_assertion do
         | 
| 484 | 
            -
                      full_message = build_message(message,
         | 
| 485 | 
            -
                                                   "<?>.kind_of\\?(Symbol) or\n" +
         | 
| 486 | 
            -
                                                   "<?>.respond_to\\?(:to_str) expected",
         | 
| 487 | 
            -
                                                   method, method)
         | 
| 488 | 
            -
                      assert_block(full_message) do
         | 
| 489 | 
            -
                        method.kind_of?(Symbol) or method.respond_to?(:to_str)
         | 
| 490 | 
            -
                      end
         | 
| 491 | 
            -
                      full_message = build_message(message,
         | 
| 492 | 
            -
                                                   "<?>.respond_to\\?(?) expected\n" +
         | 
| 493 | 
            -
                                                   "(Class: <?>)",
         | 
| 494 | 
            -
                                                   object, method, object.class)
         | 
| 495 | 
            -
                      assert_block(full_message) {object.respond_to?(method)}
         | 
| 496 | 
            -
                    end
         | 
| 497 | 
            -
                  end
         | 
| 498 | 
            -
             | 
| 499 | 
            -
                  ##
         | 
| 500 | 
            -
                  # Passes if +object+ does not .respond_to? +method+.
         | 
| 501 | 
            -
                  #
         | 
| 502 | 
            -
                  # @example
         | 
| 503 | 
            -
                  #   assert_not_respond_to('bugbear', :nonexistence) # -> pass
         | 
| 504 | 
            -
                  #   assert_not_respond_to('bugbear', :size)         # -> fail
         | 
| 505 | 
            -
                  def assert_not_respond_to(object, method, message="")
         | 
| 506 | 
            -
                    _wrap_assertion do
         | 
| 507 | 
            -
                      full_message = build_message(message,
         | 
| 508 | 
            -
                                                   "<?>.kind_of\\?(Symbol) or\n" +
         | 
| 509 | 
            -
                                                   "<?>.respond_to\\?(:to_str) expected",
         | 
| 510 | 
            -
                                                   method, method)
         | 
| 511 | 
            -
                      assert_block(full_message) do
         | 
| 512 | 
            -
                        method.kind_of?(Symbol) or method.respond_to?(:to_str)
         | 
| 513 | 
            -
                      end
         | 
| 514 | 
            -
                      full_message = build_message(message,
         | 
| 515 | 
            -
                                                   "!<?>.respond_to\\?(?) expected\n" +
         | 
| 516 | 
            -
                                                   "(Class: <?>)",
         | 
| 517 | 
            -
                                                   object, method, object.class)
         | 
| 518 | 
            -
                      assert_block(full_message) {!object.respond_to?(method)}
         | 
| 519 | 
            -
                    end
         | 
| 520 | 
            -
                  end
         | 
| 521 | 
            -
             | 
| 522 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 523 | 
            -
                  #
         | 
| 524 | 
            -
                  # @since 2.5.3
         | 
| 525 | 
            -
                  alias_method :refute_respond_to, :assert_not_respond_to
         | 
| 526 | 
            -
             | 
| 527 | 
            -
                  ##
         | 
| 528 | 
            -
                  # Passes if +pattern+ =~ +string+.
         | 
| 529 | 
            -
                  #
         | 
| 530 | 
            -
                  # @example
         | 
| 531 | 
            -
                  #   assert_match(/\d+/, 'five, 6, seven')
         | 
| 532 | 
            -
                  def assert_match(pattern, string, message="")
         | 
| 533 | 
            -
                    _wrap_assertion do
         | 
| 534 | 
            -
                      pattern = case(pattern)
         | 
| 535 | 
            -
                        when String
         | 
| 536 | 
            -
                          Regexp.new(Regexp.escape(pattern))
         | 
| 537 | 
            -
                        else
         | 
| 538 | 
            -
                          pattern
         | 
| 539 | 
            -
                      end
         | 
| 540 | 
            -
                      full_message = build_message(message, "<?> expected to be =~\n<?>.",
         | 
| 541 | 
            -
                                                   pattern, string)
         | 
| 542 | 
            -
                      assert_block(full_message) { pattern =~ string }
         | 
| 543 | 
            -
                    end
         | 
| 544 | 
            -
                  end
         | 
| 545 | 
            -
             | 
| 546 | 
            -
                  ##
         | 
| 547 | 
            -
                  # Passes if +actual+ .equal? +expected+ (i.e. they are the same
         | 
| 548 | 
            -
                  # instance).
         | 
| 549 | 
            -
                  #
         | 
| 550 | 
            -
                  # @example
         | 
| 551 | 
            -
                  #   o = Object.new
         | 
| 552 | 
            -
                  #   assert_same o, o
         | 
| 553 | 
            -
                  def assert_same(expected, actual, message="")
         | 
| 554 | 
            -
                    full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
         | 
| 555 | 
            -
            <?>
         | 
| 556 | 
            -
            with id <?> expected to be equal\\? to
         | 
| 557 | 
            -
            <?>
         | 
| 558 | 
            -
            with id <?>.
         | 
| 559 | 
            -
            EOT
         | 
| 560 | 
            -
                    assert_block(full_message) { actual.equal?(expected) }
         | 
| 561 | 
            -
                  end
         | 
| 562 | 
            -
             | 
| 563 | 
            -
                  ##
         | 
| 564 | 
            -
                  # Compares the +object1+ with +object2+ using +operator+.
         | 
| 565 | 
            -
                  #
         | 
| 566 | 
            -
                  # Passes if object1.__send__(operator, object2) is true.
         | 
| 567 | 
            -
                  #
         | 
| 568 | 
            -
                  # @example
         | 
| 569 | 
            -
                  #   assert_operator 5, :>=, 4
         | 
| 570 | 
            -
                  def assert_operator(object1, operator, object2, message="")
         | 
| 571 | 
            -
                    _wrap_assertion do
         | 
| 572 | 
            -
                      full_message = build_message(nil, "<?>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
         | 
| 573 | 
            -
                      assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
         | 
| 574 | 
            -
                      full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
         | 
| 575 | 
            -
            <?> expected to be
         | 
| 576 | 
            -
            ?
         | 
| 577 | 
            -
            <?>.
         | 
| 578 | 
            -
            EOT
         | 
| 579 | 
            -
                      assert_block(full_message) { object1.__send__(operator, object2) }
         | 
| 580 | 
            -
                    end
         | 
| 581 | 
            -
                  end
         | 
| 582 | 
            -
             | 
| 583 | 
            -
                  ##
         | 
| 584 | 
            -
                  # Compares the +object1+ with +object2+ using +operator+.
         | 
| 585 | 
            -
                  #
         | 
| 586 | 
            -
                  # Passes if object1.__send__(operator, object2) is not true.
         | 
| 587 | 
            -
                  #
         | 
| 588 | 
            -
                  # @example
         | 
| 589 | 
            -
                  #   assert_not_operator(5, :<, 4) # => pass
         | 
| 590 | 
            -
                  #   assert_not_operator(5, :>, 4) # => fail
         | 
| 591 | 
            -
                  #
         | 
| 592 | 
            -
                  # @since 3.0.0
         | 
| 593 | 
            -
                  def assert_not_operator(object1, operator, object2, message="")
         | 
| 594 | 
            -
                    _wrap_assertion do
         | 
| 595 | 
            -
                      full_message = build_message(nil, "<?>\ngiven as the operator for #assert_not_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
         | 
| 596 | 
            -
                      assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
         | 
| 597 | 
            -
                      full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
         | 
| 598 | 
            -
            <?> expected to not be
         | 
| 599 | 
            -
            ?
         | 
| 600 | 
            -
            <?>.
         | 
| 601 | 
            -
            EOT
         | 
| 602 | 
            -
                      assert_block(full_message) { ! object1.__send__(operator, object2) }
         | 
| 603 | 
            -
                    end
         | 
| 604 | 
            -
                  end
         | 
| 605 | 
            -
             | 
| 606 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 607 | 
            -
                  #
         | 
| 608 | 
            -
                  # @since 3.0.0
         | 
| 609 | 
            -
                  alias_method :refute_operator, :assert_not_operator
         | 
| 610 | 
            -
             | 
| 611 | 
            -
                  ##
         | 
| 612 | 
            -
                  # Passes if block does not raise an exception.
         | 
| 613 | 
            -
                  #
         | 
| 614 | 
            -
                  # @example
         | 
| 615 | 
            -
                  #   assert_nothing_raised do
         | 
| 616 | 
            -
                  #     [1, 2].uniq
         | 
| 617 | 
            -
                  #   end
         | 
| 618 | 
            -
                  def assert_nothing_raised(*args)
         | 
| 619 | 
            -
                    _wrap_assertion do
         | 
| 620 | 
            -
                      if args.last.is_a?(String)
         | 
| 621 | 
            -
                        message = args.pop
         | 
| 622 | 
            -
                      else
         | 
| 623 | 
            -
                        message = ""
         | 
| 624 | 
            -
                      end
         | 
| 625 | 
            -
             | 
| 626 | 
            -
                      assert_exception_helper = AssertExceptionHelper.new(self, args)
         | 
| 627 | 
            -
                      begin
         | 
| 628 | 
            -
                        yield
         | 
| 629 | 
            -
                      rescue Exception => e
         | 
| 630 | 
            -
                        if ((args.empty? && !e.instance_of?(AssertionFailedError)) ||
         | 
| 631 | 
            -
                            assert_exception_helper.expected?(e))
         | 
| 632 | 
            -
                          failure_message = build_message(message, "Exception raised:\n?", e)
         | 
| 633 | 
            -
                          assert_block(failure_message) {false}
         | 
| 634 | 
            -
                        else
         | 
| 635 | 
            -
                          raise
         | 
| 636 | 
            -
                        end
         | 
| 637 | 
            -
                      end
         | 
| 638 | 
            -
                    end
         | 
| 639 | 
            -
                  end
         | 
| 640 | 
            -
             | 
| 641 | 
            -
                  ##
         | 
| 642 | 
            -
                  # Flunk always fails.
         | 
| 643 | 
            -
                  #
         | 
| 644 | 
            -
                  # @example
         | 
| 645 | 
            -
                  #   flunk 'Not done testing yet.'
         | 
| 646 | 
            -
                  def flunk(message="Flunked")
         | 
| 647 | 
            -
                    assert_block(build_message(message)){false}
         | 
| 648 | 
            -
                  end
         | 
| 649 | 
            -
             | 
| 650 | 
            -
                  ##
         | 
| 651 | 
            -
                  # Passes if ! +actual+ .equal? +expected+
         | 
| 652 | 
            -
                  #
         | 
| 653 | 
            -
                  # @example
         | 
| 654 | 
            -
                  #   assert_not_same Object.new, Object.new
         | 
| 655 | 
            -
                  def assert_not_same(expected, actual, message="")
         | 
| 656 | 
            -
                    full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
         | 
| 657 | 
            -
            <?>
         | 
| 658 | 
            -
            with id <?> expected to not be equal\\? to
         | 
| 659 | 
            -
            <?>
         | 
| 660 | 
            -
            with id <?>.
         | 
| 661 | 
            -
            EOT
         | 
| 662 | 
            -
                    assert_block(full_message) { !actual.equal?(expected) }
         | 
| 663 | 
            -
                  end
         | 
| 664 | 
            -
             | 
| 665 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 666 | 
            -
                  #
         | 
| 667 | 
            -
                  # @since 2.5.3
         | 
| 668 | 
            -
                  alias_method :refute_same, :assert_not_same
         | 
| 669 | 
            -
             | 
| 670 | 
            -
                  ##
         | 
| 671 | 
            -
                  # Passes if +expected+ != +actual+
         | 
| 672 | 
            -
                  #
         | 
| 673 | 
            -
                  # @example
         | 
| 674 | 
            -
                  #   assert_not_equal 'some string', 5
         | 
| 675 | 
            -
                  def assert_not_equal(expected, actual, message="")
         | 
| 676 | 
            -
                    full_message = build_message(message, "<?> expected to be != to\n<?>.", expected, actual)
         | 
| 677 | 
            -
                    assert_block(full_message) { expected != actual }
         | 
| 678 | 
            -
                  end
         | 
| 679 | 
            -
             | 
| 680 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 681 | 
            -
                  #
         | 
| 682 | 
            -
                  # @since 2.5.3
         | 
| 683 | 
            -
                  alias_method :refute_equal, :assert_not_equal
         | 
| 684 | 
            -
             | 
| 685 | 
            -
                  ##
         | 
| 686 | 
            -
                  # Passes if ! +object+ .nil?
         | 
| 687 | 
            -
                  #
         | 
| 688 | 
            -
                  # @example
         | 
| 689 | 
            -
                  #   assert_not_nil '1 two 3'.sub!(/two/, '2')
         | 
| 690 | 
            -
                  def assert_not_nil(object, message="")
         | 
| 691 | 
            -
                    full_message = build_message(message, "<?> expected to not be nil.", object)
         | 
| 692 | 
            -
                    assert_block(full_message){!object.nil?}
         | 
| 693 | 
            -
                  end
         | 
| 694 | 
            -
             | 
| 695 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 696 | 
            -
                  #
         | 
| 697 | 
            -
                  # @since 2.5.3
         | 
| 698 | 
            -
                  alias_method :refute_nil, :assert_not_nil
         | 
| 699 | 
            -
             | 
| 700 | 
            -
                  ##
         | 
| 701 | 
            -
                  # Passes if +regexp+ !~ +string+
         | 
| 702 | 
            -
                  #
         | 
| 703 | 
            -
                  # @example
         | 
| 704 | 
            -
                  #   assert_not_match(/two/, 'one 2 three')   # -> pass
         | 
| 705 | 
            -
                  #   assert_not_match(/three/, 'one 2 three') # -> fail
         | 
| 706 | 
            -
                  def assert_not_match(regexp, string, message="")
         | 
| 707 | 
            -
                    _wrap_assertion do
         | 
| 708 | 
            -
                      assert_instance_of(Regexp, regexp,
         | 
| 709 | 
            -
                                         "<REGEXP> in assert_not_match(<REGEXP>, ...) " +
         | 
| 710 | 
            -
                                         "should be a Regexp.")
         | 
| 711 | 
            -
                      full_message = build_message(message,
         | 
| 712 | 
            -
                                                   "<?> expected to not match\n<?>.",
         | 
| 713 | 
            -
                                                   regexp, string)
         | 
| 714 | 
            -
                      assert_block(full_message) { regexp !~ string }
         | 
| 715 | 
            -
                    end
         | 
| 716 | 
            -
                  end
         | 
| 717 | 
            -
             | 
| 718 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 719 | 
            -
                  #
         | 
| 720 | 
            -
                  # @since 2.5.3
         | 
| 721 | 
            -
                  alias_method :refute_match, :assert_not_match
         | 
| 722 | 
            -
             | 
| 723 | 
            -
                  ##
         | 
| 724 | 
            -
                  # Deprecated. Use #assert_not_match instead.
         | 
| 725 | 
            -
                  #
         | 
| 726 | 
            -
                  # Passes if +regexp+ !~ +string+
         | 
| 727 | 
            -
                  #
         | 
| 728 | 
            -
                  # @example
         | 
| 729 | 
            -
                  #   assert_no_match(/two/, 'one 2 three')   # -> pass
         | 
| 730 | 
            -
                  #   assert_no_match(/three/, 'one 2 three') # -> fail
         | 
| 731 | 
            -
                  def assert_no_match(regexp, string, message="")
         | 
| 732 | 
            -
                    _wrap_assertion do
         | 
| 733 | 
            -
                      assert_instance_of(Regexp, regexp,
         | 
| 734 | 
            -
                                         "The first argument to assert_no_match " +
         | 
| 735 | 
            -
                                         "should be a Regexp.")
         | 
| 736 | 
            -
                      assert_not_match(regexp, string, message)
         | 
| 737 | 
            -
                    end
         | 
| 738 | 
            -
                  end
         | 
| 739 | 
            -
             | 
| 740 | 
            -
                  # @private
         | 
| 741 | 
            -
                  class ThrowTagExtractor
         | 
| 742 | 
            -
                    @@have_uncaught_throw_error = const_defined?(:UncaughtThrowError)
         | 
| 743 | 
            -
             | 
| 744 | 
            -
                    UncaughtThrowPatterns = {
         | 
| 745 | 
            -
                      NameError => /^uncaught throw `(.+)'$/,
         | 
| 746 | 
            -
                      ArgumentError => /^uncaught throw (`.+'|.+)$/,
         | 
| 747 | 
            -
                      ThreadError => /^uncaught throw `(.+)' in thread /,
         | 
| 748 | 
            -
                    }
         | 
| 749 | 
            -
             | 
| 750 | 
            -
                    def initialize(error)
         | 
| 751 | 
            -
                      @error = error
         | 
| 752 | 
            -
                    end
         | 
| 753 | 
            -
             | 
| 754 | 
            -
                    def extract_tag
         | 
| 755 | 
            -
                      tag = nil
         | 
| 756 | 
            -
                      if @@have_uncaught_throw_error
         | 
| 757 | 
            -
                        return nil unless @error.is_a?(UncaughtThrowError)
         | 
| 758 | 
            -
                        tag = @error.tag
         | 
| 759 | 
            -
                      else
         | 
| 760 | 
            -
                        pattern = UncaughtThrowPatterns[@error.class]
         | 
| 761 | 
            -
                        return nil if pattern.nil?
         | 
| 762 | 
            -
                        return nil unless pattern =~ @error.message
         | 
| 763 | 
            -
                        tag = $1
         | 
| 764 | 
            -
                      end
         | 
| 765 | 
            -
                      normalize_tag(tag)
         | 
| 766 | 
            -
                    end
         | 
| 767 | 
            -
             | 
| 768 | 
            -
                    private
         | 
| 769 | 
            -
                    def normalize_tag(tag)
         | 
| 770 | 
            -
                      case tag
         | 
| 771 | 
            -
                      when /\A:/
         | 
| 772 | 
            -
                        tag[1..-1].intern
         | 
| 773 | 
            -
                      when /\A`(.+)'\z/
         | 
| 774 | 
            -
                        $1.intern
         | 
| 775 | 
            -
                      when String
         | 
| 776 | 
            -
                        tag.intern
         | 
| 777 | 
            -
                      else
         | 
| 778 | 
            -
                        tag
         | 
| 779 | 
            -
                      end
         | 
| 780 | 
            -
                    end
         | 
| 781 | 
            -
                  end
         | 
| 782 | 
            -
             | 
| 783 | 
            -
                  ##
         | 
| 784 | 
            -
                  # Passes if the block throws +expected_object+
         | 
| 785 | 
            -
                  #
         | 
| 786 | 
            -
                  # @example
         | 
| 787 | 
            -
                  #   assert_throw(:done) do
         | 
| 788 | 
            -
                  #     throw(:done)
         | 
| 789 | 
            -
                  #   end
         | 
| 790 | 
            -
                  def assert_throw(expected_object, message="", &proc)
         | 
| 791 | 
            -
                    _wrap_assertion do
         | 
| 792 | 
            -
                      begin
         | 
| 793 | 
            -
                        catch([]) {}
         | 
| 794 | 
            -
                      rescue TypeError
         | 
| 795 | 
            -
                        assert_instance_of(Symbol, expected_object,
         | 
| 796 | 
            -
                                           "assert_throws expects the symbol that should be thrown for its first argument")
         | 
| 797 | 
            -
                      end
         | 
| 798 | 
            -
                      assert_block("Should have passed a block to assert_throw.") do
         | 
| 799 | 
            -
                        block_given?
         | 
| 800 | 
            -
                      end
         | 
| 801 | 
            -
                      caught = true
         | 
| 802 | 
            -
                      begin
         | 
| 803 | 
            -
                        catch(expected_object) do
         | 
| 804 | 
            -
                          proc.call
         | 
| 805 | 
            -
                          caught = false
         | 
| 806 | 
            -
                        end
         | 
| 807 | 
            -
                        full_message = build_message(message,
         | 
| 808 | 
            -
                                                     "<?> should have been thrown.",
         | 
| 809 | 
            -
                                                     expected_object)
         | 
| 810 | 
            -
                        assert_block(full_message) {caught}
         | 
| 811 | 
            -
                      rescue => error
         | 
| 812 | 
            -
                        extractor = ThrowTagExtractor.new(error)
         | 
| 813 | 
            -
                        tag = extractor.extract_tag
         | 
| 814 | 
            -
                        raise if tag.nil?
         | 
| 815 | 
            -
                        full_message = build_message(message,
         | 
| 816 | 
            -
                                                     "<?> expected to be thrown but\n" +
         | 
| 817 | 
            -
                                                     "<?> was thrown.",
         | 
| 818 | 
            -
                                                     expected_object, tag)
         | 
| 819 | 
            -
                        flunk(full_message)
         | 
| 820 | 
            -
                      end
         | 
| 821 | 
            -
                    end
         | 
| 822 | 
            -
                  end
         | 
| 823 | 
            -
             | 
| 824 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 825 | 
            -
                  #
         | 
| 826 | 
            -
                  # @since 2.5.3
         | 
| 827 | 
            -
                  alias_method :assert_throws, :assert_throw
         | 
| 828 | 
            -
             | 
| 829 | 
            -
                  ##
         | 
| 830 | 
            -
                  # Passes if block does not throw anything.
         | 
| 831 | 
            -
                  #
         | 
| 832 | 
            -
                  # @example
         | 
| 833 | 
            -
                  #  assert_nothing_thrown do
         | 
| 834 | 
            -
                  #    [1, 2].uniq
         | 
| 835 | 
            -
                  #  end
         | 
| 836 | 
            -
                  def assert_nothing_thrown(message="", &proc)
         | 
| 837 | 
            -
                    _wrap_assertion do
         | 
| 838 | 
            -
                      assert(block_given?, "Should have passed a block to assert_nothing_thrown")
         | 
| 839 | 
            -
                      begin
         | 
| 840 | 
            -
                        proc.call
         | 
| 841 | 
            -
                      rescue => error
         | 
| 842 | 
            -
                        extractor = ThrowTagExtractor.new(error)
         | 
| 843 | 
            -
                        tag = extractor.extract_tag
         | 
| 844 | 
            -
                        raise if tag.nil?
         | 
| 845 | 
            -
                        full_message = build_message(message,
         | 
| 846 | 
            -
                                                     "<?> was thrown when nothing was expected",
         | 
| 847 | 
            -
                                                     tag)
         | 
| 848 | 
            -
                        flunk(full_message)
         | 
| 849 | 
            -
                      end
         | 
| 850 | 
            -
                      assert(true, "Expected nothing to be thrown")
         | 
| 851 | 
            -
                    end
         | 
| 852 | 
            -
                  end
         | 
| 853 | 
            -
             | 
| 854 | 
            -
                  ##
         | 
| 855 | 
            -
                  # Passes if +expected_float+ and +actual_float+ are equal
         | 
| 856 | 
            -
                  # within +delta+ tolerance.
         | 
| 857 | 
            -
                  #
         | 
| 858 | 
            -
                  # @example
         | 
| 859 | 
            -
                  #   assert_in_delta 0.05, (50000.0 / 10**6), 0.00001
         | 
| 860 | 
            -
                  def assert_in_delta(expected_float, actual_float, delta=0.001, message="")
         | 
| 861 | 
            -
                    _wrap_assertion do
         | 
| 862 | 
            -
                      _assert_in_delta_validate_arguments(expected_float,
         | 
| 863 | 
            -
                                                          actual_float,
         | 
| 864 | 
            -
                                                          delta)
         | 
| 865 | 
            -
                      full_message = _assert_in_delta_message(expected_float,
         | 
| 866 | 
            -
                                                              actual_float,
         | 
| 867 | 
            -
                                                              delta,
         | 
| 868 | 
            -
                                                              message)
         | 
| 869 | 
            -
                      assert_block(full_message) do
         | 
| 870 | 
            -
                        (expected_float.to_f - actual_float.to_f).abs <= delta.to_f
         | 
| 871 | 
            -
                      end
         | 
| 872 | 
            -
                    end
         | 
| 873 | 
            -
                  end
         | 
| 874 | 
            -
             | 
| 875 | 
            -
                  ##
         | 
| 876 | 
            -
                  # Passes if +expected_float+ and +actual_float+ are
         | 
| 877 | 
            -
                  # not equal within +delta+ tolerance.
         | 
| 878 | 
            -
                  #
         | 
| 879 | 
            -
                  # @example
         | 
| 880 | 
            -
                  #   assert_not_in_delta(0.05, (50000.0 / 10**6), 0.00002) # -> pass
         | 
| 881 | 
            -
                  #   assert_not_in_delta(0.05, (50000.0 / 10**6), 0.00001) # -> fail
         | 
| 882 | 
            -
                  def assert_not_in_delta(expected_float, actual_float, delta=0.001, message="")
         | 
| 883 | 
            -
                    _wrap_assertion do
         | 
| 884 | 
            -
                      _assert_in_delta_validate_arguments(expected_float,
         | 
| 885 | 
            -
                                                          actual_float,
         | 
| 886 | 
            -
                                                          delta)
         | 
| 887 | 
            -
                      full_message = _assert_in_delta_message(expected_float,
         | 
| 888 | 
            -
                                                              actual_float,
         | 
| 889 | 
            -
                                                              delta,
         | 
| 890 | 
            -
                                                              message,
         | 
| 891 | 
            -
                                                              :negative_assertion => true)
         | 
| 892 | 
            -
                      assert_block(full_message) do
         | 
| 893 | 
            -
                        (expected_float.to_f - actual_float.to_f).abs > delta.to_f
         | 
| 894 | 
            -
                      end
         | 
| 895 | 
            -
                    end
         | 
| 896 | 
            -
                  end
         | 
| 897 | 
            -
             | 
| 898 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 899 | 
            -
                  #
         | 
| 900 | 
            -
                  # @since 2.5.3
         | 
| 901 | 
            -
                  alias_method :refute_in_delta, :assert_not_in_delta
         | 
| 902 | 
            -
             | 
| 903 | 
            -
                  private
         | 
| 904 | 
            -
                  def _assert_in_delta_validate_arguments(expected_float,
         | 
| 905 | 
            -
                                                          actual_float,
         | 
| 906 | 
            -
                                                          delta)
         | 
| 907 | 
            -
                    {
         | 
| 908 | 
            -
                      expected_float => "first float",
         | 
| 909 | 
            -
                      actual_float => "second float",
         | 
| 910 | 
            -
                      delta => "delta"
         | 
| 911 | 
            -
                    }.each do |float, name|
         | 
| 912 | 
            -
                      assert_respond_to(float, :to_f,
         | 
| 913 | 
            -
                                        "The arguments must respond to to_f; " +
         | 
| 914 | 
            -
                                        "the #{name} did not")
         | 
| 915 | 
            -
                    end
         | 
| 916 | 
            -
                    delta = delta.to_f
         | 
| 917 | 
            -
                    assert_operator(delta, :>=, 0.0, "The delta should not be negative")
         | 
| 918 | 
            -
                  end
         | 
| 919 | 
            -
             | 
| 920 | 
            -
                  def _assert_in_delta_message(expected_float, actual_float, delta,
         | 
| 921 | 
            -
                                               message, options={})
         | 
| 922 | 
            -
                    if options[:negative_assertion]
         | 
| 923 | 
            -
                      format = <<-EOT
         | 
| 924 | 
            -
            <?> -/+ <?> expected to not include
         | 
| 925 | 
            -
            <?>.
         | 
| 926 | 
            -
            EOT
         | 
| 927 | 
            -
                    else
         | 
| 928 | 
            -
                      format = <<-EOT
         | 
| 929 | 
            -
            <?> -/+ <?> expected to include
         | 
| 930 | 
            -
            <?>.
         | 
| 931 | 
            -
            EOT
         | 
| 932 | 
            -
                    end
         | 
| 933 | 
            -
                    arguments = [expected_float, delta, actual_float]
         | 
| 934 | 
            -
                    normalized_expected = expected_float.to_f
         | 
| 935 | 
            -
                    normalized_actual = actual_float.to_f
         | 
| 936 | 
            -
                    normalized_delta = delta.to_f
         | 
| 937 | 
            -
                    relation_format = nil
         | 
| 938 | 
            -
                    relation_arguments = nil
         | 
| 939 | 
            -
                    if normalized_actual < normalized_expected - normalized_delta
         | 
| 940 | 
            -
                      relation_format = "<<?> < <?>-<?>[?] <= <?>+<?>[?]>"
         | 
| 941 | 
            -
                      relation_arguments = [actual_float,
         | 
| 942 | 
            -
                                            expected_float, delta,
         | 
| 943 | 
            -
                                            normalized_expected - normalized_delta,
         | 
| 944 | 
            -
                                            expected_float, delta,
         | 
| 945 | 
            -
                                            normalized_expected + normalized_delta]
         | 
| 946 | 
            -
                    elsif normalized_actual <= normalized_expected + normalized_delta
         | 
| 947 | 
            -
                      relation_format = "<<?>-<?>[?] <= <?> <= <?>+<?>[?]>"
         | 
| 948 | 
            -
                      relation_arguments = [expected_float, delta,
         | 
| 949 | 
            -
                                            normalized_expected - normalized_delta,
         | 
| 950 | 
            -
                                            actual_float,
         | 
| 951 | 
            -
                                            expected_float, delta,
         | 
| 952 | 
            -
                                            normalized_expected + normalized_delta]
         | 
| 953 | 
            -
                    else
         | 
| 954 | 
            -
                      relation_format = "<<?>-<?>[?] <= <?>+<?>[?] < <?>>"
         | 
| 955 | 
            -
                      relation_arguments = [expected_float, delta,
         | 
| 956 | 
            -
                                            normalized_expected - normalized_delta,
         | 
| 957 | 
            -
                                            expected_float, delta,
         | 
| 958 | 
            -
                                            normalized_expected + normalized_delta,
         | 
| 959 | 
            -
                                            actual_float]
         | 
| 960 | 
            -
                    end
         | 
| 961 | 
            -
             | 
| 962 | 
            -
                    if relation_format
         | 
| 963 | 
            -
                      format << <<-EOT
         | 
| 964 | 
            -
             | 
| 965 | 
            -
            Relation:
         | 
| 966 | 
            -
            #{relation_format}
         | 
| 967 | 
            -
            EOT
         | 
| 968 | 
            -
                      arguments.concat(relation_arguments)
         | 
| 969 | 
            -
                    end
         | 
| 970 | 
            -
             | 
| 971 | 
            -
                    build_message(message, format, *arguments)
         | 
| 972 | 
            -
                  end
         | 
| 973 | 
            -
             | 
| 974 | 
            -
                  public
         | 
| 975 | 
            -
                  ##
         | 
| 976 | 
            -
                  # Passes if +expected_float+ and +actual_float+ are equal
         | 
| 977 | 
            -
                  # within +epsilon+ relative error of +expected_float+.
         | 
| 978 | 
            -
                  #
         | 
| 979 | 
            -
                  # @example
         | 
| 980 | 
            -
                  #   assert_in_epsilon(10000.0, 9900.0, 0.1) # -> pass
         | 
| 981 | 
            -
                  #   assert_in_epsilon(10000.0, 9899.0, 0.1) # -> fail
         | 
| 982 | 
            -
                  def assert_in_epsilon(expected_float, actual_float, epsilon=0.001,
         | 
| 983 | 
            -
                                        message="")
         | 
| 984 | 
            -
                    _wrap_assertion do
         | 
| 985 | 
            -
                      _assert_in_epsilon_validate_arguments(expected_float,
         | 
| 986 | 
            -
                                                            actual_float,
         | 
| 987 | 
            -
                                                            epsilon)
         | 
| 988 | 
            -
                      full_message = _assert_in_epsilon_message(expected_float,
         | 
| 989 | 
            -
                                                                actual_float,
         | 
| 990 | 
            -
                                                                epsilon,
         | 
| 991 | 
            -
                                                                message)
         | 
| 992 | 
            -
                      assert_block(full_message) do
         | 
| 993 | 
            -
                        normalized_expected_float = expected_float.to_f
         | 
| 994 | 
            -
                        if normalized_expected_float.zero?
         | 
| 995 | 
            -
                          delta = epsilon.to_f ** 2
         | 
| 996 | 
            -
                        else
         | 
| 997 | 
            -
                          delta = normalized_expected_float * epsilon.to_f
         | 
| 998 | 
            -
                        end
         | 
| 999 | 
            -
                        delta = delta.abs
         | 
| 1000 | 
            -
                        (normalized_expected_float - actual_float.to_f).abs <= delta
         | 
| 1001 | 
            -
                      end
         | 
| 1002 | 
            -
                    end
         | 
| 1003 | 
            -
                  end
         | 
| 1004 | 
            -
             | 
| 1005 | 
            -
                  ##
         | 
| 1006 | 
            -
                  # Passes if +expected_float+ and +actual_float+ are
         | 
| 1007 | 
            -
                  # not equal within +epsilon+ relative error of
         | 
| 1008 | 
            -
                  # +expected_float+.
         | 
| 1009 | 
            -
                  #
         | 
| 1010 | 
            -
                  # @example
         | 
| 1011 | 
            -
                  #   assert_not_in_epsilon(10000.0, 9900.0, 0.1) # -> fail
         | 
| 1012 | 
            -
                  #   assert_not_in_epsilon(10000.0, 9899.0, 0.1) # -> pass
         | 
| 1013 | 
            -
                  def assert_not_in_epsilon(expected_float, actual_float, epsilon=0.001,
         | 
| 1014 | 
            -
                                            message="")
         | 
| 1015 | 
            -
                    _wrap_assertion do
         | 
| 1016 | 
            -
                      _assert_in_epsilon_validate_arguments(expected_float,
         | 
| 1017 | 
            -
                                                            actual_float,
         | 
| 1018 | 
            -
                                                            epsilon)
         | 
| 1019 | 
            -
                      full_message = _assert_in_epsilon_message(expected_float,
         | 
| 1020 | 
            -
                                                                actual_float,
         | 
| 1021 | 
            -
                                                                epsilon,
         | 
| 1022 | 
            -
                                                                message,
         | 
| 1023 | 
            -
                                                                :negative_assertion => true)
         | 
| 1024 | 
            -
                      assert_block(full_message) do
         | 
| 1025 | 
            -
                        normalized_expected_float = expected_float.to_f
         | 
| 1026 | 
            -
                        delta = normalized_expected_float * epsilon.to_f
         | 
| 1027 | 
            -
                        (normalized_expected_float - actual_float.to_f).abs > delta
         | 
| 1028 | 
            -
                      end
         | 
| 1029 | 
            -
                    end
         | 
| 1030 | 
            -
                  end
         | 
| 1031 | 
            -
             | 
| 1032 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 1033 | 
            -
                  #
         | 
| 1034 | 
            -
                  # @since 3.0.0
         | 
| 1035 | 
            -
                  alias_method :refute_in_epsilon, :assert_not_in_epsilon
         | 
| 1036 | 
            -
             | 
| 1037 | 
            -
                  private
         | 
| 1038 | 
            -
                  def _assert_in_epsilon_validate_arguments(expected_float,
         | 
| 1039 | 
            -
                                                            actual_float,
         | 
| 1040 | 
            -
                                                            epsilon)
         | 
| 1041 | 
            -
                    {
         | 
| 1042 | 
            -
                      expected_float => "first float",
         | 
| 1043 | 
            -
                      actual_float => "second float",
         | 
| 1044 | 
            -
                      epsilon => "epsilon"
         | 
| 1045 | 
            -
                    }.each do |float, name|
         | 
| 1046 | 
            -
                      assert_respond_to(float, :to_f,
         | 
| 1047 | 
            -
                                        "The arguments must respond to to_f; " +
         | 
| 1048 | 
            -
                                        "the #{name} did not")
         | 
| 1049 | 
            -
                    end
         | 
| 1050 | 
            -
                    epsilon = epsilon.to_f
         | 
| 1051 | 
            -
                    assert_operator(epsilon, :>=, 0.0, "The epsilon should not be negative")
         | 
| 1052 | 
            -
                  end
         | 
| 1053 | 
            -
             | 
| 1054 | 
            -
                  def _assert_in_epsilon_message(expected_float, actual_float, epsilon,
         | 
| 1055 | 
            -
                                                 message, options={})
         | 
| 1056 | 
            -
                    normalized_expected = expected_float.to_f
         | 
| 1057 | 
            -
                    normalized_actual = actual_float.to_f
         | 
| 1058 | 
            -
                    normalized_epsilon = epsilon.to_f
         | 
| 1059 | 
            -
                    delta = normalized_expected * normalized_epsilon
         | 
| 1060 | 
            -
             | 
| 1061 | 
            -
                    if options[:negative_assertion]
         | 
| 1062 | 
            -
                      format = <<-EOT
         | 
| 1063 | 
            -
            <?> -/+ (<?> * <?>)[?] expected to not include
         | 
| 1064 | 
            -
            <?>.
         | 
| 1065 | 
            -
            EOT
         | 
| 1066 | 
            -
                    else
         | 
| 1067 | 
            -
                      format = <<-EOT
         | 
| 1068 | 
            -
            <?> -/+ (<?> * <?>)[?] expected to include
         | 
| 1069 | 
            -
            <?>.
         | 
| 1070 | 
            -
            EOT
         | 
| 1071 | 
            -
                    end
         | 
| 1072 | 
            -
                    arguments = [expected_float, expected_float, epsilon, delta,
         | 
| 1073 | 
            -
                                 actual_float]
         | 
| 1074 | 
            -
             | 
| 1075 | 
            -
                    relation_format = nil
         | 
| 1076 | 
            -
                    relation_arguments = nil
         | 
| 1077 | 
            -
                    if normalized_actual < normalized_expected - delta
         | 
| 1078 | 
            -
                      relation_format = "<<?> < <?>-(<?>*<?>)[?] <= <?>+(<?>*<?>)[?]>"
         | 
| 1079 | 
            -
                      relation_arguments = [actual_float,
         | 
| 1080 | 
            -
                                            expected_float, expected_float, epsilon,
         | 
| 1081 | 
            -
                                            normalized_expected - delta,
         | 
| 1082 | 
            -
                                            expected_float, expected_float, epsilon,
         | 
| 1083 | 
            -
                                            normalized_expected + delta]
         | 
| 1084 | 
            -
                    elsif normalized_actual <= normalized_expected + delta
         | 
| 1085 | 
            -
                      relation_format = "<<?>-(<?>*<?>)[?] <= <?> <= <?>+(<?>*<?>)[?]>"
         | 
| 1086 | 
            -
                      relation_arguments = [expected_float, expected_float, epsilon,
         | 
| 1087 | 
            -
                                            normalized_expected - delta,
         | 
| 1088 | 
            -
                                            actual_float,
         | 
| 1089 | 
            -
                                            expected_float, expected_float, epsilon,
         | 
| 1090 | 
            -
                                            normalized_expected + delta]
         | 
| 1091 | 
            -
                    else
         | 
| 1092 | 
            -
                      relation_format = "<<?>-(<?>*<?>)[?] <= <?>+(<?>*<?>)[?] < <?>>"
         | 
| 1093 | 
            -
                      relation_arguments = [expected_float, expected_float, epsilon,
         | 
| 1094 | 
            -
                                            normalized_expected - delta,
         | 
| 1095 | 
            -
                                            expected_float, expected_float, epsilon,
         | 
| 1096 | 
            -
                                            normalized_expected + delta,
         | 
| 1097 | 
            -
                                            actual_float]
         | 
| 1098 | 
            -
                    end
         | 
| 1099 | 
            -
             | 
| 1100 | 
            -
                    if relation_format
         | 
| 1101 | 
            -
                      format << <<-EOT
         | 
| 1102 | 
            -
             | 
| 1103 | 
            -
            Relation:
         | 
| 1104 | 
            -
            #{relation_format}
         | 
| 1105 | 
            -
            EOT
         | 
| 1106 | 
            -
                      arguments.concat(relation_arguments)
         | 
| 1107 | 
            -
                    end
         | 
| 1108 | 
            -
             | 
| 1109 | 
            -
                    build_message(message, format, *arguments)
         | 
| 1110 | 
            -
                  end
         | 
| 1111 | 
            -
             | 
| 1112 | 
            -
                  public
         | 
| 1113 | 
            -
                  ##
         | 
| 1114 | 
            -
                  # Passes if the method send returns a true value.
         | 
| 1115 | 
            -
                  #
         | 
| 1116 | 
            -
                  # +send_array+ is composed of:
         | 
| 1117 | 
            -
                  # * A receiver
         | 
| 1118 | 
            -
                  # * A method
         | 
| 1119 | 
            -
                  # * Arguments to the method
         | 
| 1120 | 
            -
                  #
         | 
| 1121 | 
            -
                  # @example
         | 
| 1122 | 
            -
                  #   assert_send([[1, 2], :member?, 1]) # -> pass
         | 
| 1123 | 
            -
                  #   assert_send([[1, 2], :member?, 4]) # -> fail
         | 
| 1124 | 
            -
                  def assert_send(send_array, message=nil)
         | 
| 1125 | 
            -
                    _wrap_assertion do
         | 
| 1126 | 
            -
                      assert_instance_of(Array, send_array,
         | 
| 1127 | 
            -
                                         "assert_send requires an array " +
         | 
| 1128 | 
            -
                                         "of send information")
         | 
| 1129 | 
            -
                      assert_operator(send_array.size, :>=, 2,
         | 
| 1130 | 
            -
                                      "assert_send requires at least a receiver " +
         | 
| 1131 | 
            -
                                      "and a message name")
         | 
| 1132 | 
            -
                      format = <<EOT
         | 
| 1133 | 
            -
            <?> expected to respond to
         | 
| 1134 | 
            -
            <?(*?)> with a true value but was
         | 
| 1135 | 
            -
            <?>.
         | 
| 1136 | 
            -
            EOT
         | 
| 1137 | 
            -
                      receiver, message_name, *arguments = send_array
         | 
| 1138 | 
            -
                      result = nil
         | 
| 1139 | 
            -
                      full_message =
         | 
| 1140 | 
            -
                        build_message(message,
         | 
| 1141 | 
            -
                                      format,
         | 
| 1142 | 
            -
                                      receiver,
         | 
| 1143 | 
            -
                                      AssertionMessage.literal(message_name.to_s),
         | 
| 1144 | 
            -
                                      arguments,
         | 
| 1145 | 
            -
                                      AssertionMessage.delayed_literal {result})
         | 
| 1146 | 
            -
                      assert_block(full_message) do
         | 
| 1147 | 
            -
                        result = receiver.__send__(message_name, *arguments)
         | 
| 1148 | 
            -
                        result
         | 
| 1149 | 
            -
                      end
         | 
| 1150 | 
            -
                    end
         | 
| 1151 | 
            -
                  end
         | 
| 1152 | 
            -
             | 
| 1153 | 
            -
                  ##
         | 
| 1154 | 
            -
                  # Passes if the method send doesn't return a true value.
         | 
| 1155 | 
            -
                  #
         | 
| 1156 | 
            -
                  # +send_array+ is composed of:
         | 
| 1157 | 
            -
                  # * A receiver
         | 
| 1158 | 
            -
                  # * A method
         | 
| 1159 | 
            -
                  # * Arguments to the method
         | 
| 1160 | 
            -
                  #
         | 
| 1161 | 
            -
                  # @example
         | 
| 1162 | 
            -
                  #   assert_not_send([[1, 2], :member?, 1]) # -> fail
         | 
| 1163 | 
            -
                  #   assert_not_send([[1, 2], :member?, 4]) # -> pass
         | 
| 1164 | 
            -
                  def assert_not_send(send_array, message=nil)
         | 
| 1165 | 
            -
                    _wrap_assertion do
         | 
| 1166 | 
            -
                      assert_instance_of(Array, send_array,
         | 
| 1167 | 
            -
                                         "assert_not_send requires an array " +
         | 
| 1168 | 
            -
                                         "of send information")
         | 
| 1169 | 
            -
                      assert_operator(send_array.size, :>=, 2,
         | 
| 1170 | 
            -
                                      "assert_not_send requires at least a receiver " +
         | 
| 1171 | 
            -
                                      "and a message name")
         | 
| 1172 | 
            -
                      format = <<EOT
         | 
| 1173 | 
            -
            <?> expected to respond to
         | 
| 1174 | 
            -
            <?(*?)> with not a true value but was
         | 
| 1175 | 
            -
            <?>.
         | 
| 1176 | 
            -
            EOT
         | 
| 1177 | 
            -
                      receiver, message_name, *arguments = send_array
         | 
| 1178 | 
            -
                      result = nil
         | 
| 1179 | 
            -
                      full_message =
         | 
| 1180 | 
            -
                        build_message(message,
         | 
| 1181 | 
            -
                                      format,
         | 
| 1182 | 
            -
                                      receiver,
         | 
| 1183 | 
            -
                                      AssertionMessage.literal(message_name.to_s),
         | 
| 1184 | 
            -
                                      arguments,
         | 
| 1185 | 
            -
                                      AssertionMessage.delayed_literal {result})
         | 
| 1186 | 
            -
                      assert_block(full_message) do
         | 
| 1187 | 
            -
                        result = receiver.__send__(message_name, *arguments)
         | 
| 1188 | 
            -
                        not result
         | 
| 1189 | 
            -
                      end
         | 
| 1190 | 
            -
                    end
         | 
| 1191 | 
            -
                  end
         | 
| 1192 | 
            -
             | 
| 1193 | 
            -
                  ##
         | 
| 1194 | 
            -
                  # Passes if +actual+ is a boolean value.
         | 
| 1195 | 
            -
                  #
         | 
| 1196 | 
            -
                  # @example
         | 
| 1197 | 
            -
                  #   assert_boolean(true) # -> pass
         | 
| 1198 | 
            -
                  #   assert_boolean(nil)  # -> fail
         | 
| 1199 | 
            -
                  def assert_boolean(actual, message=nil)
         | 
| 1200 | 
            -
                    _wrap_assertion do
         | 
| 1201 | 
            -
                      assert_block(build_message(message,
         | 
| 1202 | 
            -
                                                 "<true> or <false> expected but was\n<?>",
         | 
| 1203 | 
            -
                                                 actual)) do
         | 
| 1204 | 
            -
                        [true, false].include?(actual)
         | 
| 1205 | 
            -
                      end
         | 
| 1206 | 
            -
                    end
         | 
| 1207 | 
            -
                  end
         | 
| 1208 | 
            -
             | 
| 1209 | 
            -
                  ##
         | 
| 1210 | 
            -
                  # Passes if +actual+ is true.
         | 
| 1211 | 
            -
                  #
         | 
| 1212 | 
            -
                  # @example
         | 
| 1213 | 
            -
                  #   assert_true(true)  # -> pass
         | 
| 1214 | 
            -
                  #   assert_true(:true) # -> fail
         | 
| 1215 | 
            -
                  def assert_true(actual, message=nil)
         | 
| 1216 | 
            -
                    _wrap_assertion do
         | 
| 1217 | 
            -
                      assert_block(build_message(message,
         | 
| 1218 | 
            -
                                                 "<true> expected but was\n<?>",
         | 
| 1219 | 
            -
                                                 actual)) do
         | 
| 1220 | 
            -
                        actual == true
         | 
| 1221 | 
            -
                      end
         | 
| 1222 | 
            -
                    end
         | 
| 1223 | 
            -
                  end
         | 
| 1224 | 
            -
             | 
| 1225 | 
            -
                  ##
         | 
| 1226 | 
            -
                  # Passes if +actual+ is false.
         | 
| 1227 | 
            -
                  #
         | 
| 1228 | 
            -
                  # @example
         | 
| 1229 | 
            -
                  #   assert_false(false)  # -> pass
         | 
| 1230 | 
            -
                  #   assert_false(nil)    # -> fail
         | 
| 1231 | 
            -
                  def assert_false(actual, message=nil)
         | 
| 1232 | 
            -
                    _wrap_assertion do
         | 
| 1233 | 
            -
                      assert_block(build_message(message,
         | 
| 1234 | 
            -
                                                 "<false> expected but was\n<?>",
         | 
| 1235 | 
            -
                                                 actual)) do
         | 
| 1236 | 
            -
                        actual == false
         | 
| 1237 | 
            -
                      end
         | 
| 1238 | 
            -
                    end
         | 
| 1239 | 
            -
                  end
         | 
| 1240 | 
            -
             | 
| 1241 | 
            -
                  ##
         | 
| 1242 | 
            -
                  # Passes if expression "+expected+ +operator+
         | 
| 1243 | 
            -
                  # +actual+" is true.
         | 
| 1244 | 
            -
                  #
         | 
| 1245 | 
            -
                  # @example
         | 
| 1246 | 
            -
                  #   assert_compare(1, "<", 10)  # -> pass
         | 
| 1247 | 
            -
                  #   assert_compare(1, ">=", 10) # -> fail
         | 
| 1248 | 
            -
                  def assert_compare(expected, operator, actual, message=nil)
         | 
| 1249 | 
            -
                    _wrap_assertion do
         | 
| 1250 | 
            -
                      assert_send([["<", "<=", ">", ">="], :include?, operator.to_s])
         | 
| 1251 | 
            -
                      case operator.to_s
         | 
| 1252 | 
            -
                      when "<"
         | 
| 1253 | 
            -
                        operator_description = "less than"
         | 
| 1254 | 
            -
                      when "<="
         | 
| 1255 | 
            -
                        operator_description = "less than or equal to"
         | 
| 1256 | 
            -
                      when ">"
         | 
| 1257 | 
            -
                        operator_description = "greater than"
         | 
| 1258 | 
            -
                      when ">="
         | 
| 1259 | 
            -
                        operator_description = "greater than or equal to"
         | 
| 1260 | 
            -
                      end
         | 
| 1261 | 
            -
                      template = <<-EOT
         | 
| 1262 | 
            -
            <?> #{operator} <?> should be true
         | 
| 1263 | 
            -
            <?> expected #{operator_description}
         | 
| 1264 | 
            -
            <?>.
         | 
| 1265 | 
            -
            EOT
         | 
| 1266 | 
            -
                      full_message = build_message(message, template,
         | 
| 1267 | 
            -
                                                   expected, actual,
         | 
| 1268 | 
            -
                                                   expected, actual)
         | 
| 1269 | 
            -
                      assert_block(full_message) do
         | 
| 1270 | 
            -
                        expected.__send__(operator, actual)
         | 
| 1271 | 
            -
                      end
         | 
| 1272 | 
            -
                    end
         | 
| 1273 | 
            -
                  end
         | 
| 1274 | 
            -
             | 
| 1275 | 
            -
                  ##
         | 
| 1276 | 
            -
                  # Passes if assertion is failed in block.
         | 
| 1277 | 
            -
                  #
         | 
| 1278 | 
            -
                  # @example
         | 
| 1279 | 
            -
                  #   assert_fail_assertion {assert_equal("A", "B")}  # -> pass
         | 
| 1280 | 
            -
                  #   assert_fail_assertion {assert_equal("A", "A")}  # -> fail
         | 
| 1281 | 
            -
                  def assert_fail_assertion(message=nil)
         | 
| 1282 | 
            -
                    _wrap_assertion do
         | 
| 1283 | 
            -
                      full_message = build_message(message,
         | 
| 1284 | 
            -
                                                   "Failed assertion was expected.")
         | 
| 1285 | 
            -
                      assert_block(full_message) do
         | 
| 1286 | 
            -
                        begin
         | 
| 1287 | 
            -
                          yield
         | 
| 1288 | 
            -
                          false
         | 
| 1289 | 
            -
                        rescue AssertionFailedError
         | 
| 1290 | 
            -
                          true
         | 
| 1291 | 
            -
                        end
         | 
| 1292 | 
            -
                      end
         | 
| 1293 | 
            -
                    end
         | 
| 1294 | 
            -
                  end
         | 
| 1295 | 
            -
             | 
| 1296 | 
            -
                  ##
         | 
| 1297 | 
            -
                  # Passes if an exception is raised in block and its
         | 
| 1298 | 
            -
                  # message is +expected+.
         | 
| 1299 | 
            -
                  #
         | 
| 1300 | 
            -
                  # @example
         | 
| 1301 | 
            -
                  #   assert_raise_message("exception") {raise "exception"}  # -> pass
         | 
| 1302 | 
            -
                  #   assert_raise_message(/exc/i) {raise "exception"}       # -> pass
         | 
| 1303 | 
            -
                  #   assert_raise_message("exception") {raise "EXCEPTION"}  # -> fail
         | 
| 1304 | 
            -
                  #   assert_raise_message("exception") {}                   # -> fail
         | 
| 1305 | 
            -
                  def assert_raise_message(expected, message=nil)
         | 
| 1306 | 
            -
                    _wrap_assertion do
         | 
| 1307 | 
            -
                      full_message = build_message(message,
         | 
| 1308 | 
            -
                                                   "<?> exception message expected " +
         | 
| 1309 | 
            -
                                                   "but none was thrown.",
         | 
| 1310 | 
            -
                                                   expected)
         | 
| 1311 | 
            -
                      exception = nil
         | 
| 1312 | 
            -
                      assert_block(full_message) do
         | 
| 1313 | 
            -
                        begin
         | 
| 1314 | 
            -
                          yield
         | 
| 1315 | 
            -
                          false
         | 
| 1316 | 
            -
                        rescue Exception => exception
         | 
| 1317 | 
            -
                          true
         | 
| 1318 | 
            -
                        end
         | 
| 1319 | 
            -
                      end
         | 
| 1320 | 
            -
             | 
| 1321 | 
            -
                      actual = exception.message
         | 
| 1322 | 
            -
                      diff = AssertionMessage.delayed_diff(expected, actual)
         | 
| 1323 | 
            -
                      full_message =
         | 
| 1324 | 
            -
                        build_message(message,
         | 
| 1325 | 
            -
                                      "<?> exception message expected but was\n" +
         | 
| 1326 | 
            -
                                      "<?>.?", expected, actual, diff)
         | 
| 1327 | 
            -
                      assert_block(full_message) do
         | 
| 1328 | 
            -
                        if expected.is_a?(Regexp)
         | 
| 1329 | 
            -
                          expected =~ actual
         | 
| 1330 | 
            -
                        else
         | 
| 1331 | 
            -
                          expected == actual
         | 
| 1332 | 
            -
                        end
         | 
| 1333 | 
            -
                      end
         | 
| 1334 | 
            -
                    end
         | 
| 1335 | 
            -
                  end
         | 
| 1336 | 
            -
             | 
| 1337 | 
            -
                  ##
         | 
| 1338 | 
            -
                  # Passes if +object+.const_defined?(+constant_name+)
         | 
| 1339 | 
            -
                  #
         | 
| 1340 | 
            -
                  # @example
         | 
| 1341 | 
            -
                  #   assert_const_defined(Test, :Unit)          # -> pass
         | 
| 1342 | 
            -
                  #   assert_const_defined(Object, :Nonexistent) # -> fail
         | 
| 1343 | 
            -
                  def assert_const_defined(object, constant_name, message=nil)
         | 
| 1344 | 
            -
                    _wrap_assertion do
         | 
| 1345 | 
            -
                      full_message = build_message(message,
         | 
| 1346 | 
            -
                                                   "<?>.const_defined\\?(<?>) expected.",
         | 
| 1347 | 
            -
                                                   object, constant_name)
         | 
| 1348 | 
            -
                      assert_block(full_message) do
         | 
| 1349 | 
            -
                        object.const_defined?(constant_name)
         | 
| 1350 | 
            -
                      end
         | 
| 1351 | 
            -
                    end
         | 
| 1352 | 
            -
                  end
         | 
| 1353 | 
            -
             | 
| 1354 | 
            -
                  ##
         | 
| 1355 | 
            -
                  # Passes if !+object+.const_defined?(+constant_name+)
         | 
| 1356 | 
            -
                  #
         | 
| 1357 | 
            -
                  # @example
         | 
| 1358 | 
            -
                  #   assert_not_const_defined(Object, :Nonexistent) # -> pass
         | 
| 1359 | 
            -
                  #   assert_not_const_defined(Test, :Unit)          # -> fail
         | 
| 1360 | 
            -
                  def assert_not_const_defined(object, constant_name, message=nil)
         | 
| 1361 | 
            -
                    _wrap_assertion do
         | 
| 1362 | 
            -
                      full_message = build_message(message,
         | 
| 1363 | 
            -
                                                   "!<?>.const_defined\\?(<?>) expected.",
         | 
| 1364 | 
            -
                                                   object, constant_name)
         | 
| 1365 | 
            -
                      assert_block(full_message) do
         | 
| 1366 | 
            -
                        !object.const_defined?(constant_name)
         | 
| 1367 | 
            -
                      end
         | 
| 1368 | 
            -
                    end
         | 
| 1369 | 
            -
                  end
         | 
| 1370 | 
            -
             | 
| 1371 | 
            -
                  ##
         | 
| 1372 | 
            -
                  # Passes if +object+.+predicate+ is _true_.
         | 
| 1373 | 
            -
                  #
         | 
| 1374 | 
            -
                  # @example
         | 
| 1375 | 
            -
                  #   assert_predicate([], :empty?)  # -> pass
         | 
| 1376 | 
            -
                  #   assert_predicate([1], :empty?) # -> fail
         | 
| 1377 | 
            -
                  def assert_predicate(object, predicate, message=nil)
         | 
| 1378 | 
            -
                    _wrap_assertion do
         | 
| 1379 | 
            -
                      assert_respond_to(object, predicate, message)
         | 
| 1380 | 
            -
                      actual = object.__send__(predicate)
         | 
| 1381 | 
            -
                      full_message = build_message(message,
         | 
| 1382 | 
            -
                                                   "<?>.? is true value expected but was\n" +
         | 
| 1383 | 
            -
                                                   "<?>",
         | 
| 1384 | 
            -
                                                   object,
         | 
| 1385 | 
            -
                                                   AssertionMessage.literal(predicate),
         | 
| 1386 | 
            -
                                                   actual)
         | 
| 1387 | 
            -
                      assert_block(full_message) do
         | 
| 1388 | 
            -
                        actual
         | 
| 1389 | 
            -
                      end
         | 
| 1390 | 
            -
                    end
         | 
| 1391 | 
            -
                  end
         | 
| 1392 | 
            -
             | 
| 1393 | 
            -
                  ##
         | 
| 1394 | 
            -
                  # Passes if +object+.+predicate+ is not _true_.
         | 
| 1395 | 
            -
                  #
         | 
| 1396 | 
            -
                  # @example
         | 
| 1397 | 
            -
                  #   assert_not_predicate([1], :empty?) # -> pass
         | 
| 1398 | 
            -
                  #   assert_not_predicate([], :empty?)  # -> fail
         | 
| 1399 | 
            -
                  def assert_not_predicate(object, predicate, message=nil)
         | 
| 1400 | 
            -
                    _wrap_assertion do
         | 
| 1401 | 
            -
                      assert_respond_to(object, predicate, message)
         | 
| 1402 | 
            -
                      actual = object.__send__(predicate)
         | 
| 1403 | 
            -
                      full_message = build_message(message,
         | 
| 1404 | 
            -
                                                   "<?>.? is false value expected but was\n" +
         | 
| 1405 | 
            -
                                                   "<?>",
         | 
| 1406 | 
            -
                                                   object,
         | 
| 1407 | 
            -
                                                   AssertionMessage.literal(predicate),
         | 
| 1408 | 
            -
                                                   actual)
         | 
| 1409 | 
            -
                      assert_block(full_message) do
         | 
| 1410 | 
            -
                        not actual
         | 
| 1411 | 
            -
                      end
         | 
| 1412 | 
            -
                    end
         | 
| 1413 | 
            -
                  end
         | 
| 1414 | 
            -
             | 
| 1415 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 1416 | 
            -
                  #
         | 
| 1417 | 
            -
                  # @since 3.0.0
         | 
| 1418 | 
            -
                  alias_method :refute_predicate, :assert_not_predicate
         | 
| 1419 | 
            -
             | 
| 1420 | 
            -
                  ##
         | 
| 1421 | 
            -
                  # Passes if +object+#+alias_name+ is an alias method of
         | 
| 1422 | 
            -
                  # +object+#+original_name+.
         | 
| 1423 | 
            -
                  #
         | 
| 1424 | 
            -
                  # @example
         | 
| 1425 | 
            -
                  #   assert_alias_method([], :length, :size)  # -> pass
         | 
| 1426 | 
            -
                  #   assert_alias_method([], :size, :length)  # -> pass
         | 
| 1427 | 
            -
                  #   assert_alias_method([], :each, :size)    # -> fail
         | 
| 1428 | 
            -
                  def assert_alias_method(object, alias_name, original_name, message=nil)
         | 
| 1429 | 
            -
                    _wrap_assertion do
         | 
| 1430 | 
            -
                      find_method_failure_message = Proc.new do |method_name|
         | 
| 1431 | 
            -
                        build_message(message,
         | 
| 1432 | 
            -
                                      "<?>.? doesn't exist\n" +
         | 
| 1433 | 
            -
                                      "(Class: <?>)",
         | 
| 1434 | 
            -
                                      object,
         | 
| 1435 | 
            -
                                      AssertionMessage.literal(method_name),
         | 
| 1436 | 
            -
                                      object.class)
         | 
| 1437 | 
            -
                      end
         | 
| 1438 | 
            -
             | 
| 1439 | 
            -
                      alias_method = original_method = nil
         | 
| 1440 | 
            -
                      assert_block(find_method_failure_message.call(alias_name)) do
         | 
| 1441 | 
            -
                        begin
         | 
| 1442 | 
            -
                          alias_method = object.method(alias_name)
         | 
| 1443 | 
            -
                          true
         | 
| 1444 | 
            -
                        rescue NameError
         | 
| 1445 | 
            -
                          false
         | 
| 1446 | 
            -
                        end
         | 
| 1447 | 
            -
                      end
         | 
| 1448 | 
            -
                      assert_block(find_method_failure_message.call(original_name)) do
         | 
| 1449 | 
            -
                        begin
         | 
| 1450 | 
            -
                          original_method = object.method(original_name)
         | 
| 1451 | 
            -
                          true
         | 
| 1452 | 
            -
                        rescue NameError
         | 
| 1453 | 
            -
                          false
         | 
| 1454 | 
            -
                        end
         | 
| 1455 | 
            -
                      end
         | 
| 1456 | 
            -
             | 
| 1457 | 
            -
                      full_message = build_message(message,
         | 
| 1458 | 
            -
                                                   "<?> is alias of\n" +
         | 
| 1459 | 
            -
                                                   "<?> expected",
         | 
| 1460 | 
            -
                                                   alias_method,
         | 
| 1461 | 
            -
                                                   original_method)
         | 
| 1462 | 
            -
                      assert_block(full_message) do
         | 
| 1463 | 
            -
                        alias_method == original_method
         | 
| 1464 | 
            -
                      end
         | 
| 1465 | 
            -
                    end
         | 
| 1466 | 
            -
                  end
         | 
| 1467 | 
            -
             | 
| 1468 | 
            -
                  ##
         | 
| 1469 | 
            -
                  # Passes if +path+ exists.
         | 
| 1470 | 
            -
                  #
         | 
| 1471 | 
            -
                  # @example
         | 
| 1472 | 
            -
                  #   assert_path_exist("/tmp")          # -> pass
         | 
| 1473 | 
            -
                  #   assert_path_exist("/bin/sh")       # -> pass
         | 
| 1474 | 
            -
                  #   assert_path_exist("/nonexistent")  # -> fail
         | 
| 1475 | 
            -
                  def assert_path_exist(path, message=nil)
         | 
| 1476 | 
            -
                    _wrap_assertion do
         | 
| 1477 | 
            -
                      failure_message = build_message(message,
         | 
| 1478 | 
            -
                                                      "<?> expected to exist",
         | 
| 1479 | 
            -
                                                      path)
         | 
| 1480 | 
            -
                      assert_block(failure_message) do
         | 
| 1481 | 
            -
                        File.exist?(path)
         | 
| 1482 | 
            -
                      end
         | 
| 1483 | 
            -
                    end
         | 
| 1484 | 
            -
                  end
         | 
| 1485 | 
            -
             | 
| 1486 | 
            -
                  ##
         | 
| 1487 | 
            -
                  # Passes if +path+ doesn't exist.
         | 
| 1488 | 
            -
                  #
         | 
| 1489 | 
            -
                  # @example
         | 
| 1490 | 
            -
                  #   assert_path_not_exist("/nonexistent")  # -> pass
         | 
| 1491 | 
            -
                  #   assert_path_not_exist("/tmp")          # -> fail
         | 
| 1492 | 
            -
                  #   assert_path_not_exist("/bin/sh")       # -> fail
         | 
| 1493 | 
            -
                  def assert_path_not_exist(path, message=nil)
         | 
| 1494 | 
            -
                    _wrap_assertion do
         | 
| 1495 | 
            -
                      failure_message = build_message(message,
         | 
| 1496 | 
            -
                                                      "<?> expected to not exist",
         | 
| 1497 | 
            -
                                                      path)
         | 
| 1498 | 
            -
                      assert_block(failure_message) do
         | 
| 1499 | 
            -
                        not File.exist?(path)
         | 
| 1500 | 
            -
                      end
         | 
| 1501 | 
            -
                    end
         | 
| 1502 | 
            -
                  end
         | 
| 1503 | 
            -
             | 
| 1504 | 
            -
                  ##
         | 
| 1505 | 
            -
                  # Passes if +collection+ includes +object+.
         | 
| 1506 | 
            -
                  #
         | 
| 1507 | 
            -
                  # @example
         | 
| 1508 | 
            -
                  #   assert_include([1, 10], 1)            # -> pass
         | 
| 1509 | 
            -
                  #   assert_include(1..10, 5)              # -> pass
         | 
| 1510 | 
            -
                  #   assert_include([1, 10], 5)            # -> fail
         | 
| 1511 | 
            -
                  #   assert_include(1..10, 20)             # -> fail
         | 
| 1512 | 
            -
                  def assert_include(collection, object, message=nil)
         | 
| 1513 | 
            -
                    _wrap_assertion do
         | 
| 1514 | 
            -
                      assert_respond_to(collection, :include?,
         | 
| 1515 | 
            -
                                        "The collection must respond to :include?.")
         | 
| 1516 | 
            -
                      full_message = build_message(message,
         | 
| 1517 | 
            -
                                                   "<?> expected to include\n<?>.",
         | 
| 1518 | 
            -
                                                   collection,
         | 
| 1519 | 
            -
                                                   object)
         | 
| 1520 | 
            -
                      assert_block(full_message) do
         | 
| 1521 | 
            -
                        collection.include?(object)
         | 
| 1522 | 
            -
                      end
         | 
| 1523 | 
            -
                    end
         | 
| 1524 | 
            -
                  end
         | 
| 1525 | 
            -
             | 
| 1526 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 1527 | 
            -
                  #
         | 
| 1528 | 
            -
                  # @since 2.5.3
         | 
| 1529 | 
            -
                  alias_method :assert_includes, :assert_include
         | 
| 1530 | 
            -
             | 
| 1531 | 
            -
                  ##
         | 
| 1532 | 
            -
                  # Passes if +collection+ doesn't include +object+.
         | 
| 1533 | 
            -
                  #
         | 
| 1534 | 
            -
                  # @example
         | 
| 1535 | 
            -
                  #   assert_not_include([1, 10], 5)            # -> pass
         | 
| 1536 | 
            -
                  #   assert_not_include(1..10, 20)             # -> pass
         | 
| 1537 | 
            -
                  #   assert_not_include([1, 10], 1)            # -> fail
         | 
| 1538 | 
            -
                  #   assert_not_include(1..10, 5)              # -> fail
         | 
| 1539 | 
            -
                  def assert_not_include(collection, object, message=nil)
         | 
| 1540 | 
            -
                    _wrap_assertion do
         | 
| 1541 | 
            -
                      assert_respond_to(collection, :include?,
         | 
| 1542 | 
            -
                                        "The collection must respond to :include?.")
         | 
| 1543 | 
            -
                      full_message = build_message(message,
         | 
| 1544 | 
            -
                                                   "<?> expected to not include\n<?>.",
         | 
| 1545 | 
            -
                                                   collection,
         | 
| 1546 | 
            -
                                                   object)
         | 
| 1547 | 
            -
                      assert_block(full_message) do
         | 
| 1548 | 
            -
                        not collection.include?(object)
         | 
| 1549 | 
            -
                      end
         | 
| 1550 | 
            -
                    end
         | 
| 1551 | 
            -
                  end
         | 
| 1552 | 
            -
             | 
| 1553 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 1554 | 
            -
                  #
         | 
| 1555 | 
            -
                  # @since 3.0.0
         | 
| 1556 | 
            -
                  alias_method :assert_not_includes, :assert_not_include
         | 
| 1557 | 
            -
             | 
| 1558 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 1559 | 
            -
                  #
         | 
| 1560 | 
            -
                  # @since 3.0.0
         | 
| 1561 | 
            -
                  alias_method :refute_includes, :assert_not_include
         | 
| 1562 | 
            -
             | 
| 1563 | 
            -
                  ##
         | 
| 1564 | 
            -
                  # Passes if +object+ is empty.
         | 
| 1565 | 
            -
                  #
         | 
| 1566 | 
            -
                  # @example
         | 
| 1567 | 
            -
                  #   assert_empty("")                       # -> pass
         | 
| 1568 | 
            -
                  #   assert_empty([])                       # -> pass
         | 
| 1569 | 
            -
                  #   assert_empty({})                       # -> pass
         | 
| 1570 | 
            -
                  #   assert_empty(" ")                      # -> fail
         | 
| 1571 | 
            -
                  #   assert_empty([nil])                    # -> fail
         | 
| 1572 | 
            -
                  #   assert_empty({1 => 2})                 # -> fail
         | 
| 1573 | 
            -
                  def assert_empty(object, message=nil)
         | 
| 1574 | 
            -
                    _wrap_assertion do
         | 
| 1575 | 
            -
                      assert_respond_to(object, :empty?,
         | 
| 1576 | 
            -
                                        "The object must respond to :empty?.")
         | 
| 1577 | 
            -
                      full_message = build_message(message,
         | 
| 1578 | 
            -
                                                   "<?> expected to be empty.",
         | 
| 1579 | 
            -
                                                   object)
         | 
| 1580 | 
            -
                      assert_block(full_message) do
         | 
| 1581 | 
            -
                        object.empty?
         | 
| 1582 | 
            -
                      end
         | 
| 1583 | 
            -
                    end
         | 
| 1584 | 
            -
                  end
         | 
| 1585 | 
            -
             | 
| 1586 | 
            -
                  ##
         | 
| 1587 | 
            -
                  # Passes if +object+ is not empty.
         | 
| 1588 | 
            -
                  #
         | 
| 1589 | 
            -
                  # @example
         | 
| 1590 | 
            -
                  #   assert_not_empty(" ")                      # -> pass
         | 
| 1591 | 
            -
                  #   assert_not_empty([nil])                    # -> pass
         | 
| 1592 | 
            -
                  #   assert_not_empty({1 => 2})                 # -> pass
         | 
| 1593 | 
            -
                  #   assert_not_empty("")                       # -> fail
         | 
| 1594 | 
            -
                  #   assert_not_empty([])                       # -> fail
         | 
| 1595 | 
            -
                  #   assert_not_empty({})                       # -> fail
         | 
| 1596 | 
            -
                  def assert_not_empty(object, message=nil)
         | 
| 1597 | 
            -
                    _wrap_assertion do
         | 
| 1598 | 
            -
                      assert_respond_to(object, :empty?,
         | 
| 1599 | 
            -
                                        "The object must respond to :empty?.")
         | 
| 1600 | 
            -
                      full_message = build_message(message,
         | 
| 1601 | 
            -
                                                   "<?> expected to not be empty.",
         | 
| 1602 | 
            -
                                                   object)
         | 
| 1603 | 
            -
                      assert_block(full_message) do
         | 
| 1604 | 
            -
                        not object.empty?
         | 
| 1605 | 
            -
                      end
         | 
| 1606 | 
            -
                    end
         | 
| 1607 | 
            -
                  end
         | 
| 1608 | 
            -
             | 
| 1609 | 
            -
                  # Just for minitest compatibility. :<
         | 
| 1610 | 
            -
                  #
         | 
| 1611 | 
            -
                  # @since 3.0.0
         | 
| 1612 | 
            -
                  alias_method :refute_empty, :assert_not_empty
         | 
| 1613 | 
            -
             | 
| 1614 | 
            -
                  ##
         | 
| 1615 | 
            -
                  # Builds a failure message.  +head+ is added before the +template+ and
         | 
| 1616 | 
            -
                  # +arguments+ replaces the '?'s positionally in the template.
         | 
| 1617 | 
            -
                  def build_message(head, template=nil, *arguments)
         | 
| 1618 | 
            -
                    template &&= template.chomp
         | 
| 1619 | 
            -
                    return AssertionMessage.new(head, template, arguments)
         | 
| 1620 | 
            -
                  end
         | 
| 1621 | 
            -
             | 
| 1622 | 
            -
                  private
         | 
| 1623 | 
            -
                  def _wrap_assertion(&block)
         | 
| 1624 | 
            -
                    @_assertion_wrapped ||= false
         | 
| 1625 | 
            -
                    if @_assertion_wrapped
         | 
| 1626 | 
            -
                      block.call
         | 
| 1627 | 
            -
                    else
         | 
| 1628 | 
            -
                      @_assertion_wrapped = true
         | 
| 1629 | 
            -
                      begin
         | 
| 1630 | 
            -
                        add_assertion
         | 
| 1631 | 
            -
                        block.call
         | 
| 1632 | 
            -
                      ensure
         | 
| 1633 | 
            -
                        @_assertion_wrapped = false
         | 
| 1634 | 
            -
                      end
         | 
| 1635 | 
            -
                    end
         | 
| 1636 | 
            -
                  end
         | 
| 1637 | 
            -
             | 
| 1638 | 
            -
                  public
         | 
| 1639 | 
            -
                  # Called whenever an assertion is made. Define this in classes
         | 
| 1640 | 
            -
                  # that include Test::Unit::Assertions to record assertion
         | 
| 1641 | 
            -
                  # counts.
         | 
| 1642 | 
            -
                  #
         | 
| 1643 | 
            -
                  # This is a public API for developers who extend test-unit.
         | 
| 1644 | 
            -
                  #
         | 
| 1645 | 
            -
                  # @return [void]
         | 
| 1646 | 
            -
                  def add_assertion
         | 
| 1647 | 
            -
                  end
         | 
| 1648 | 
            -
             | 
| 1649 | 
            -
                  ##
         | 
| 1650 | 
            -
                  # Select whether or not to use the pretty-printer. If this option is set
         | 
| 1651 | 
            -
                  # to false before any assertions are made, pp.rb will not be required.
         | 
| 1652 | 
            -
                  def self.use_pp=(value)
         | 
| 1653 | 
            -
                    AssertionMessage.use_pp = value
         | 
| 1654 | 
            -
                  end
         | 
| 1655 | 
            -
             | 
| 1656 | 
            -
                  private
         | 
| 1657 | 
            -
                  def _assert_raise(assert_expected_exception, *args, &block)
         | 
| 1658 | 
            -
                    _wrap_assertion do
         | 
| 1659 | 
            -
                      if args.last.is_a?(String)
         | 
| 1660 | 
            -
                        message = args.pop
         | 
| 1661 | 
            -
                      else
         | 
| 1662 | 
            -
                        message = ""
         | 
| 1663 | 
            -
                      end
         | 
| 1664 | 
            -
             | 
| 1665 | 
            -
                      assert_exception_helper = AssertExceptionHelper.new(self, args)
         | 
| 1666 | 
            -
                      expected = assert_exception_helper.expected_exceptions
         | 
| 1667 | 
            -
                      actual_exception = nil
         | 
| 1668 | 
            -
                      full_message = build_message(message,
         | 
| 1669 | 
            -
                                                   "<?> exception expected " +
         | 
| 1670 | 
            -
                                                   "but none was thrown.",
         | 
| 1671 | 
            -
                                                   expected)
         | 
| 1672 | 
            -
                      assert_block(full_message) do
         | 
| 1673 | 
            -
                        begin
         | 
| 1674 | 
            -
                          yield
         | 
| 1675 | 
            -
                          false
         | 
| 1676 | 
            -
                        rescue Exception => actual_exception
         | 
| 1677 | 
            -
                          true
         | 
| 1678 | 
            -
                        end
         | 
| 1679 | 
            -
                      end
         | 
| 1680 | 
            -
                      assert_expected_exception.call(message, assert_exception_helper,
         | 
| 1681 | 
            -
                                                     actual_exception)
         | 
| 1682 | 
            -
                      actual_exception
         | 
| 1683 | 
            -
                    end
         | 
| 1684 | 
            -
                  end
         | 
| 1685 | 
            -
             | 
| 1686 | 
            -
                  def _set_failed_information(failure, expected, actual, user_message)
         | 
| 1687 | 
            -
                    failure.expected = expected
         | 
| 1688 | 
            -
                    failure.actual = actual
         | 
| 1689 | 
            -
                    failure.inspected_expected = AssertionMessage.convert(expected)
         | 
| 1690 | 
            -
                    failure.inspected_actual = AssertionMessage.convert(actual)
         | 
| 1691 | 
            -
                    failure.user_message = user_message
         | 
| 1692 | 
            -
                  end
         | 
| 1693 | 
            -
             | 
| 1694 | 
            -
                  class AssertionMessage
         | 
| 1695 | 
            -
                    @use_pp = true
         | 
| 1696 | 
            -
                    class << self
         | 
| 1697 | 
            -
                      attr_accessor :use_pp
         | 
| 1698 | 
            -
             | 
| 1699 | 
            -
                      def literal(value)
         | 
| 1700 | 
            -
                        Literal.new(value)
         | 
| 1701 | 
            -
                      end
         | 
| 1702 | 
            -
             | 
| 1703 | 
            -
                      def delayed_literal(&block)
         | 
| 1704 | 
            -
                        DelayedLiteral.new(block)
         | 
| 1705 | 
            -
                      end
         | 
| 1706 | 
            -
             | 
| 1707 | 
            -
                      def maybe_container(value, &formatter)
         | 
| 1708 | 
            -
                        MaybeContainer.new(value, &formatter)
         | 
| 1709 | 
            -
                      end
         | 
| 1710 | 
            -
             | 
| 1711 | 
            -
                      MAX_DIFF_TARGET_STRING_SIZE = 1000
         | 
| 1712 | 
            -
                      def max_diff_target_string_size
         | 
| 1713 | 
            -
                        return @@max_diff_target_string_size if @@max_diff_target_string_size
         | 
| 1714 | 
            -
             | 
| 1715 | 
            -
                        size = ENV["TEST_UNIT_MAX_DIFF_TARGET_STRING_SIZE"]
         | 
| 1716 | 
            -
                        if size
         | 
| 1717 | 
            -
                          begin
         | 
| 1718 | 
            -
                            size = Integer(size)
         | 
| 1719 | 
            -
                          rescue ArgumentError
         | 
| 1720 | 
            -
                            size = nil
         | 
| 1721 | 
            -
                          end
         | 
| 1722 | 
            -
                        end
         | 
| 1723 | 
            -
                        size || MAX_DIFF_TARGET_STRING_SIZE
         | 
| 1724 | 
            -
                      end
         | 
| 1725 | 
            -
             | 
| 1726 | 
            -
                      @@max_diff_target_string_size = nil
         | 
| 1727 | 
            -
                      def max_diff_target_string_size=(size)
         | 
| 1728 | 
            -
                        @@max_diff_target_string_size = size
         | 
| 1729 | 
            -
                      end
         | 
| 1730 | 
            -
             | 
| 1731 | 
            -
                      def diff_target_string?(string)
         | 
| 1732 | 
            -
                        if string.respond_to?(:bytesize)
         | 
| 1733 | 
            -
                          string.bytesize < max_diff_target_string_size
         | 
| 1734 | 
            -
                        else
         | 
| 1735 | 
            -
                          string.size < max_diff_target_string_size
         | 
| 1736 | 
            -
                        end
         | 
| 1737 | 
            -
                      end
         | 
| 1738 | 
            -
             | 
| 1739 | 
            -
                      def ensure_diffable_string(string)
         | 
| 1740 | 
            -
                        if string.respond_to?(:encoding) and
         | 
| 1741 | 
            -
                            !string.encoding.ascii_compatible?
         | 
| 1742 | 
            -
                          string = string.dup.force_encoding("ASCII-8BIT")
         | 
| 1743 | 
            -
                        end
         | 
| 1744 | 
            -
                        string
         | 
| 1745 | 
            -
                      end
         | 
| 1746 | 
            -
             | 
| 1747 | 
            -
                      def prepare_for_diff(from, to)
         | 
| 1748 | 
            -
                        if !from.is_a?(String) or !to.is_a?(String)
         | 
| 1749 | 
            -
                          from = convert(from)
         | 
| 1750 | 
            -
                          to = convert(to)
         | 
| 1751 | 
            -
                        end
         | 
| 1752 | 
            -
             | 
| 1753 | 
            -
                        if diff_target_string?(from) and diff_target_string?(to)
         | 
| 1754 | 
            -
                          from = ensure_diffable_string(from)
         | 
| 1755 | 
            -
                          to = ensure_diffable_string(to)
         | 
| 1756 | 
            -
                          [from, to]
         | 
| 1757 | 
            -
                        else
         | 
| 1758 | 
            -
                          [nil, nil]
         | 
| 1759 | 
            -
                        end
         | 
| 1760 | 
            -
                      end
         | 
| 1761 | 
            -
             | 
| 1762 | 
            -
                      def delayed_diff(from, to)
         | 
| 1763 | 
            -
                        delayed_literal do
         | 
| 1764 | 
            -
                          from, to = prepare_for_diff(from, to)
         | 
| 1765 | 
            -
             | 
| 1766 | 
            -
                          diff = "" if from.nil? or to.nil?
         | 
| 1767 | 
            -
                          diff ||= Diff.readable(from, to)
         | 
| 1768 | 
            -
                          if /^[-+]/ !~ diff
         | 
| 1769 | 
            -
                            diff = ""
         | 
| 1770 | 
            -
                          elsif /^[ ?]/ =~ diff or /(?:.*\n){2,}/ =~ diff
         | 
| 1771 | 
            -
                            diff = "\n\ndiff:\n#{diff}"
         | 
| 1772 | 
            -
                          else
         | 
| 1773 | 
            -
                            diff = ""
         | 
| 1774 | 
            -
                          end
         | 
| 1775 | 
            -
             | 
| 1776 | 
            -
                          if Diff.need_fold?(diff)
         | 
| 1777 | 
            -
                            folded_diff = Diff.folded_readable(from, to)
         | 
| 1778 | 
            -
                            diff << "\n\nfolded diff:\n#{folded_diff}"
         | 
| 1779 | 
            -
                          end
         | 
| 1780 | 
            -
             | 
| 1781 | 
            -
                          diff
         | 
| 1782 | 
            -
                        end
         | 
| 1783 | 
            -
                      end
         | 
| 1784 | 
            -
             | 
| 1785 | 
            -
                      def convert(object)
         | 
| 1786 | 
            -
                        if object.is_a?(Exception)
         | 
| 1787 | 
            -
                          object = AssertExceptionHelper::WrappedException.new(object)
         | 
| 1788 | 
            -
                        end
         | 
| 1789 | 
            -
                        inspector = Inspector.new(object)
         | 
| 1790 | 
            -
                        if use_pp
         | 
| 1791 | 
            -
                          begin
         | 
| 1792 | 
            -
                            require 'pp' unless defined?(PP)
         | 
| 1793 | 
            -
                            begin
         | 
| 1794 | 
            -
                              return PP.pp(inspector, '').chomp
         | 
| 1795 | 
            -
                            rescue NameError
         | 
| 1796 | 
            -
                            end
         | 
| 1797 | 
            -
                          rescue LoadError
         | 
| 1798 | 
            -
                            self.use_pp = false
         | 
| 1799 | 
            -
                          end
         | 
| 1800 | 
            -
                        end
         | 
| 1801 | 
            -
                        inspector.inspect
         | 
| 1802 | 
            -
                      end
         | 
| 1803 | 
            -
                    end
         | 
| 1804 | 
            -
             | 
| 1805 | 
            -
                    class Inspector
         | 
| 1806 | 
            -
                      include Comparable
         | 
| 1807 | 
            -
             | 
| 1808 | 
            -
                      class << self
         | 
| 1809 | 
            -
                        def cached_new(object, inspected_objects)
         | 
| 1810 | 
            -
                          inspected_objects[object.object_id] ||=
         | 
| 1811 | 
            -
                            new(object, inspected_objects)
         | 
| 1812 | 
            -
                        end
         | 
| 1813 | 
            -
             | 
| 1814 | 
            -
                        @@inspector_classes = []
         | 
| 1815 | 
            -
                        def inspector_classes
         | 
| 1816 | 
            -
                          @@inspector_classes
         | 
| 1817 | 
            -
                        end
         | 
| 1818 | 
            -
             | 
| 1819 | 
            -
                        def register_inspector_class(inspector_class)
         | 
| 1820 | 
            -
                          @@inspector_classes << inspector_class
         | 
| 1821 | 
            -
                        end
         | 
| 1822 | 
            -
             | 
| 1823 | 
            -
                        def unregister_inspector_class(inspector_class)
         | 
| 1824 | 
            -
                          @@inspector_classes.delete(inspector_class)
         | 
| 1825 | 
            -
                        end
         | 
| 1826 | 
            -
                      end
         | 
| 1827 | 
            -
             | 
| 1828 | 
            -
                      attr_reader :object
         | 
| 1829 | 
            -
                      def initialize(object, inspected_objects={})
         | 
| 1830 | 
            -
                        @inspected_objects = inspected_objects
         | 
| 1831 | 
            -
                        @object = object
         | 
| 1832 | 
            -
                        @inspected_objects[@object.object_id] = self
         | 
| 1833 | 
            -
                        @inspect_target = inspect_target
         | 
| 1834 | 
            -
                      end
         | 
| 1835 | 
            -
             | 
| 1836 | 
            -
                      alias_method :native_inspect, :inspect
         | 
| 1837 | 
            -
                      def inspect
         | 
| 1838 | 
            -
                        @inspect_target.inspect
         | 
| 1839 | 
            -
                      end
         | 
| 1840 | 
            -
             | 
| 1841 | 
            -
                      def pretty_print(q)
         | 
| 1842 | 
            -
                        @inspect_target.pretty_print(q)
         | 
| 1843 | 
            -
                      end
         | 
| 1844 | 
            -
             | 
| 1845 | 
            -
                      def pretty_print_cycle(q)
         | 
| 1846 | 
            -
                        @inspect_target.pretty_print_cycle(q)
         | 
| 1847 | 
            -
                      end
         | 
| 1848 | 
            -
             | 
| 1849 | 
            -
                      def <=>(other)
         | 
| 1850 | 
            -
                        if other.is_a?(self.class)
         | 
| 1851 | 
            -
                          @object <=> other.object
         | 
| 1852 | 
            -
                        else
         | 
| 1853 | 
            -
                          @object <=> other
         | 
| 1854 | 
            -
                        end
         | 
| 1855 | 
            -
                      end
         | 
| 1856 | 
            -
             | 
| 1857 | 
            -
                      private
         | 
| 1858 | 
            -
                      def inspect_target
         | 
| 1859 | 
            -
                        self.class.inspector_classes.each do |inspector_class|
         | 
| 1860 | 
            -
                          if inspector_class.target?(@object)
         | 
| 1861 | 
            -
                            return inspector_class.new(@object, @inspected_objects)
         | 
| 1862 | 
            -
                          end
         | 
| 1863 | 
            -
                        end
         | 
| 1864 | 
            -
                        @object
         | 
| 1865 | 
            -
                      end
         | 
| 1866 | 
            -
                    end
         | 
| 1867 | 
            -
             | 
| 1868 | 
            -
                    class NumericInspector
         | 
| 1869 | 
            -
                      Inspector.register_inspector_class(self)
         | 
| 1870 | 
            -
             | 
| 1871 | 
            -
                      class << self
         | 
| 1872 | 
            -
                        def target?(object)
         | 
| 1873 | 
            -
                          object.is_a?(Numeric)
         | 
| 1874 | 
            -
                        end
         | 
| 1875 | 
            -
                      end
         | 
| 1876 | 
            -
             | 
| 1877 | 
            -
                      def initialize(numeric, inspected_objects)
         | 
| 1878 | 
            -
                        @inspected_objects = inspected_objects
         | 
| 1879 | 
            -
                        @numeric = numeric
         | 
| 1880 | 
            -
                      end
         | 
| 1881 | 
            -
             | 
| 1882 | 
            -
                      def inspect
         | 
| 1883 | 
            -
                        @numeric.to_s
         | 
| 1884 | 
            -
                      end
         | 
| 1885 | 
            -
             | 
| 1886 | 
            -
                      def pretty_print(q)
         | 
| 1887 | 
            -
                        q.text(@numeric.to_s)
         | 
| 1888 | 
            -
                      end
         | 
| 1889 | 
            -
             | 
| 1890 | 
            -
                      def pretty_print_cycle(q)
         | 
| 1891 | 
            -
                        q.text(@numeric.to_s)
         | 
| 1892 | 
            -
                      end
         | 
| 1893 | 
            -
                    end
         | 
| 1894 | 
            -
             | 
| 1895 | 
            -
                    class HashInspector
         | 
| 1896 | 
            -
                      Inspector.register_inspector_class(self)
         | 
| 1897 | 
            -
             | 
| 1898 | 
            -
                      class << self
         | 
| 1899 | 
            -
                        def target?(object)
         | 
| 1900 | 
            -
                          object.is_a?(Hash) or ENV.equal?(object)
         | 
| 1901 | 
            -
                        end
         | 
| 1902 | 
            -
                      end
         | 
| 1903 | 
            -
             | 
| 1904 | 
            -
                      def initialize(hash, inspected_objects)
         | 
| 1905 | 
            -
                        @inspected_objects = inspected_objects
         | 
| 1906 | 
            -
                        @hash = {}
         | 
| 1907 | 
            -
                        hash.each do |key, value|
         | 
| 1908 | 
            -
                          key = Inspector.cached_new(key, @inspected_objects)
         | 
| 1909 | 
            -
                          value = Inspector.cached_new(value, @inspected_objects)
         | 
| 1910 | 
            -
                          @hash[key] = value
         | 
| 1911 | 
            -
                        end
         | 
| 1912 | 
            -
                      end
         | 
| 1913 | 
            -
             | 
| 1914 | 
            -
                      def inspect
         | 
| 1915 | 
            -
                        @hash.inspect
         | 
| 1916 | 
            -
                      end
         | 
| 1917 | 
            -
             | 
| 1918 | 
            -
                      def pretty_print(q)
         | 
| 1919 | 
            -
                        q.group(1, '{', '}') do
         | 
| 1920 | 
            -
                          q.seplist(self, nil, :each_pair) do |k, v|
         | 
| 1921 | 
            -
                            q.group do
         | 
| 1922 | 
            -
                              q.pp(k)
         | 
| 1923 | 
            -
                              q.text('=>')
         | 
| 1924 | 
            -
                              q.group(1) do
         | 
| 1925 | 
            -
                                q.breakable('')
         | 
| 1926 | 
            -
                                q.pp(v)
         | 
| 1927 | 
            -
                              end
         | 
| 1928 | 
            -
                            end
         | 
| 1929 | 
            -
                          end
         | 
| 1930 | 
            -
                        end
         | 
| 1931 | 
            -
                      end
         | 
| 1932 | 
            -
             | 
| 1933 | 
            -
                      def pretty_print_cycle(q)
         | 
| 1934 | 
            -
                        @hash.pretty_print_cycle(q)
         | 
| 1935 | 
            -
                      end
         | 
| 1936 | 
            -
             | 
| 1937 | 
            -
                      def each_pair
         | 
| 1938 | 
            -
                        keys = @hash.keys
         | 
| 1939 | 
            -
                        begin
         | 
| 1940 | 
            -
                          keys = keys.sort # FIXME: more cleverly
         | 
| 1941 | 
            -
                        rescue ArgumentError
         | 
| 1942 | 
            -
                        end
         | 
| 1943 | 
            -
                        keys.each do |key|
         | 
| 1944 | 
            -
                          yield(key, @hash[key])
         | 
| 1945 | 
            -
                        end
         | 
| 1946 | 
            -
                      end
         | 
| 1947 | 
            -
                    end
         | 
| 1948 | 
            -
             | 
| 1949 | 
            -
                    class ArrayInspector
         | 
| 1950 | 
            -
                      Inspector.register_inspector_class(self)
         | 
| 1951 | 
            -
             | 
| 1952 | 
            -
                      class << self
         | 
| 1953 | 
            -
                        def target?(object)
         | 
| 1954 | 
            -
                          object.is_a?(Array)
         | 
| 1955 | 
            -
                        end
         | 
| 1956 | 
            -
                      end
         | 
| 1957 | 
            -
             | 
| 1958 | 
            -
                      def initialize(array, inspected_objects)
         | 
| 1959 | 
            -
                        @inspected_objects = inspected_objects
         | 
| 1960 | 
            -
                        @array = array.collect do |element|
         | 
| 1961 | 
            -
                          Inspector.cached_new(element, @inspected_objects)
         | 
| 1962 | 
            -
                        end
         | 
| 1963 | 
            -
                      end
         | 
| 1964 | 
            -
             | 
| 1965 | 
            -
                      def inspect
         | 
| 1966 | 
            -
                        @array.inspect
         | 
| 1967 | 
            -
                      end
         | 
| 1968 | 
            -
             | 
| 1969 | 
            -
                      def pretty_print(q)
         | 
| 1970 | 
            -
                        q.group(1, '[', ']') do
         | 
| 1971 | 
            -
                          q.seplist(self) do |v|
         | 
| 1972 | 
            -
                            q.pp(v)
         | 
| 1973 | 
            -
                          end
         | 
| 1974 | 
            -
                        end
         | 
| 1975 | 
            -
                      end
         | 
| 1976 | 
            -
             | 
| 1977 | 
            -
                      def pretty_print_cycle(q)
         | 
| 1978 | 
            -
                        @array.pretty_print_cycle(q)
         | 
| 1979 | 
            -
                      end
         | 
| 1980 | 
            -
             | 
| 1981 | 
            -
                      def each(&block)
         | 
| 1982 | 
            -
                        @array.each(&block)
         | 
| 1983 | 
            -
                      end
         | 
| 1984 | 
            -
                    end
         | 
| 1985 | 
            -
             | 
| 1986 | 
            -
                    class Literal
         | 
| 1987 | 
            -
                      def initialize(value)
         | 
| 1988 | 
            -
                        @value = value
         | 
| 1989 | 
            -
                      end
         | 
| 1990 | 
            -
             | 
| 1991 | 
            -
                      def inspect
         | 
| 1992 | 
            -
                        @value.to_s
         | 
| 1993 | 
            -
                      end
         | 
| 1994 | 
            -
                    end
         | 
| 1995 | 
            -
             | 
| 1996 | 
            -
                    class DelayedLiteral
         | 
| 1997 | 
            -
                      def initialize(value)
         | 
| 1998 | 
            -
                        @value = value
         | 
| 1999 | 
            -
                      end
         | 
| 2000 | 
            -
             | 
| 2001 | 
            -
                      def inspect
         | 
| 2002 | 
            -
                        @value.call.to_s
         | 
| 2003 | 
            -
                      end
         | 
| 2004 | 
            -
                    end
         | 
| 2005 | 
            -
             | 
| 2006 | 
            -
                    class MaybeContainer
         | 
| 2007 | 
            -
                      def initialize(value, &formatter)
         | 
| 2008 | 
            -
                        @value = value
         | 
| 2009 | 
            -
                        @formatter = formatter
         | 
| 2010 | 
            -
                      end
         | 
| 2011 | 
            -
             | 
| 2012 | 
            -
                      def inspect
         | 
| 2013 | 
            -
                        if @value.is_a?(Array)
         | 
| 2014 | 
            -
                          values = @value.collect do |value|
         | 
| 2015 | 
            -
                            @formatter.call(AssertionMessage.convert(value))
         | 
| 2016 | 
            -
                          end
         | 
| 2017 | 
            -
                          "[#{values.join(', ')}]"
         | 
| 2018 | 
            -
                        else
         | 
| 2019 | 
            -
                          @formatter.call(AssertionMessage.convert(@value))
         | 
| 2020 | 
            -
                        end
         | 
| 2021 | 
            -
                      end
         | 
| 2022 | 
            -
                    end
         | 
| 2023 | 
            -
             | 
| 2024 | 
            -
                    class Template
         | 
| 2025 | 
            -
                      def self.create(string)
         | 
| 2026 | 
            -
                        parts = (string ? string.scan(/(?=[^\\])\?|(?:\\\?|[^\?])+/m) : [])
         | 
| 2027 | 
            -
                        self.new(parts)
         | 
| 2028 | 
            -
                      end
         | 
| 2029 | 
            -
             | 
| 2030 | 
            -
                      attr_reader :count
         | 
| 2031 | 
            -
             | 
| 2032 | 
            -
                      def initialize(parts)
         | 
| 2033 | 
            -
                        @parts = parts
         | 
| 2034 | 
            -
                        @count = parts.find_all{|e| e == '?'}.size
         | 
| 2035 | 
            -
                      end
         | 
| 2036 | 
            -
             | 
| 2037 | 
            -
                      def result(parameters)
         | 
| 2038 | 
            -
                        raise "The number of parameters does not match the number of substitutions." if(parameters.size != count)
         | 
| 2039 | 
            -
                        params = parameters.dup
         | 
| 2040 | 
            -
                        expanded_template = ""
         | 
| 2041 | 
            -
                        @parts.each do |part|
         | 
| 2042 | 
            -
                          if part == '?'
         | 
| 2043 | 
            -
                            encoding_safe_concat(expanded_template, params.shift)
         | 
| 2044 | 
            -
                          else
         | 
| 2045 | 
            -
                            expanded_template << part.gsub(/\\\?/m, '?')
         | 
| 2046 | 
            -
                          end
         | 
| 2047 | 
            -
                        end
         | 
| 2048 | 
            -
                        expanded_template
         | 
| 2049 | 
            -
                      end
         | 
| 2050 | 
            -
             | 
| 2051 | 
            -
                      private
         | 
| 2052 | 
            -
                      if Object.const_defined?(:Encoding)
         | 
| 2053 | 
            -
                        def encoding_safe_concat(buffer, parameter)
         | 
| 2054 | 
            -
                          if Encoding.compatible?(buffer, parameter)
         | 
| 2055 | 
            -
                            buffer << parameter
         | 
| 2056 | 
            -
                          else
         | 
| 2057 | 
            -
                            buffer << parameter.dup.force_encoding(buffer.encoding)
         | 
| 2058 | 
            -
                          end
         | 
| 2059 | 
            -
                        end
         | 
| 2060 | 
            -
                      else
         | 
| 2061 | 
            -
                        def encoding_safe_concat(buffer, parameter)
         | 
| 2062 | 
            -
                          buffer << parameter
         | 
| 2063 | 
            -
                        end
         | 
| 2064 | 
            -
                      end
         | 
| 2065 | 
            -
                    end
         | 
| 2066 | 
            -
             | 
| 2067 | 
            -
                    include Util::BacktraceFilter
         | 
| 2068 | 
            -
             | 
| 2069 | 
            -
                    def initialize(head, template_string, parameters)
         | 
| 2070 | 
            -
                      @head = head
         | 
| 2071 | 
            -
                      @template_string = template_string
         | 
| 2072 | 
            -
                      @parameters = parameters
         | 
| 2073 | 
            -
                    end
         | 
| 2074 | 
            -
             | 
| 2075 | 
            -
                    def convert(object)
         | 
| 2076 | 
            -
                      self.class.convert(object)
         | 
| 2077 | 
            -
                    end
         | 
| 2078 | 
            -
             | 
| 2079 | 
            -
                    def template
         | 
| 2080 | 
            -
                      @template ||= Template.create(@template_string)
         | 
| 2081 | 
            -
                    end
         | 
| 2082 | 
            -
             | 
| 2083 | 
            -
                    def add_period(string)
         | 
| 2084 | 
            -
                      (string =~ /\.\Z/ ? string : string + '.')
         | 
| 2085 | 
            -
                    end
         | 
| 2086 | 
            -
             | 
| 2087 | 
            -
                    def to_s
         | 
| 2088 | 
            -
                      message_parts = []
         | 
| 2089 | 
            -
                      if (@head)
         | 
| 2090 | 
            -
                        head = @head
         | 
| 2091 | 
            -
                        head = head.call if head.respond_to?(:call)
         | 
| 2092 | 
            -
                        head = head.to_s
         | 
| 2093 | 
            -
                        unless(head.empty?)
         | 
| 2094 | 
            -
                          message_parts << add_period(head)
         | 
| 2095 | 
            -
                        end
         | 
| 2096 | 
            -
                      end
         | 
| 2097 | 
            -
                      tail = template.result(@parameters.collect{|e| convert(e)})
         | 
| 2098 | 
            -
                      message_parts << tail unless(tail.empty?)
         | 
| 2099 | 
            -
                      message_parts.join("\n")
         | 
| 2100 | 
            -
                    end
         | 
| 2101 | 
            -
                  end
         | 
| 2102 | 
            -
             | 
| 2103 | 
            -
                  class AssertExceptionHelper
         | 
| 2104 | 
            -
                    class WrappedException
         | 
| 2105 | 
            -
                      attr_reader :exception
         | 
| 2106 | 
            -
                      def initialize(exception)
         | 
| 2107 | 
            -
                        @exception = exception
         | 
| 2108 | 
            -
                      end
         | 
| 2109 | 
            -
             | 
| 2110 | 
            -
                      def inspect
         | 
| 2111 | 
            -
                        if default_inspect?
         | 
| 2112 | 
            -
                          "#{@exception.class.inspect}(<#{@exception.message}>)"
         | 
| 2113 | 
            -
                        else
         | 
| 2114 | 
            -
                          @exception.inspect
         | 
| 2115 | 
            -
                        end
         | 
| 2116 | 
            -
                      end
         | 
| 2117 | 
            -
             | 
| 2118 | 
            -
                      def method_missing(name, *args, &block)
         | 
| 2119 | 
            -
                        @exception.__send__(name, *args, &block)
         | 
| 2120 | 
            -
                      end
         | 
| 2121 | 
            -
             | 
| 2122 | 
            -
                      private
         | 
| 2123 | 
            -
                      def default_inspect?
         | 
| 2124 | 
            -
                        inspect_method = @exception.method(:inspect)
         | 
| 2125 | 
            -
                        if inspect_method.respond_to?(:owner) and
         | 
| 2126 | 
            -
                            inspect_method.owner == Exception
         | 
| 2127 | 
            -
                          true
         | 
| 2128 | 
            -
                        else
         | 
| 2129 | 
            -
                          default_inspect_method = Exception.instance_method(:inspect)
         | 
| 2130 | 
            -
                          default_inspect_method.bind(@exception).call == @exception.inspect
         | 
| 2131 | 
            -
                        end
         | 
| 2132 | 
            -
                      end
         | 
| 2133 | 
            -
                    end
         | 
| 2134 | 
            -
             | 
| 2135 | 
            -
                    def initialize(test_case, expected_exceptions)
         | 
| 2136 | 
            -
                      @test_case = test_case
         | 
| 2137 | 
            -
                      @expected_exceptions = expected_exceptions
         | 
| 2138 | 
            -
                      @expected_classes, @expected_modules, @expected_objects =
         | 
| 2139 | 
            -
                        split_expected_exceptions(expected_exceptions)
         | 
| 2140 | 
            -
                    end
         | 
| 2141 | 
            -
             | 
| 2142 | 
            -
                    def expected_exceptions
         | 
| 2143 | 
            -
                      exceptions = @expected_exceptions.collect do |exception|
         | 
| 2144 | 
            -
                        if exception.is_a?(Exception)
         | 
| 2145 | 
            -
                          WrappedException.new(exception)
         | 
| 2146 | 
            -
                        else
         | 
| 2147 | 
            -
                          exception
         | 
| 2148 | 
            -
                        end
         | 
| 2149 | 
            -
                      end
         | 
| 2150 | 
            -
                      if exceptions.size == 1
         | 
| 2151 | 
            -
                        exceptions[0]
         | 
| 2152 | 
            -
                      else
         | 
| 2153 | 
            -
                        exceptions
         | 
| 2154 | 
            -
                      end
         | 
| 2155 | 
            -
                    end
         | 
| 2156 | 
            -
             | 
| 2157 | 
            -
                    def expected?(actual_exception, equality=nil)
         | 
| 2158 | 
            -
                      equality ||= :instance_of?
         | 
| 2159 | 
            -
                      expected_class?(actual_exception, equality) or
         | 
| 2160 | 
            -
                        expected_module?(actual_exception) or
         | 
| 2161 | 
            -
                        expected_object?(actual_exception)
         | 
| 2162 | 
            -
                    end
         | 
| 2163 | 
            -
             | 
| 2164 | 
            -
                    private
         | 
| 2165 | 
            -
                    def split_expected_exceptions(expected_exceptions)
         | 
| 2166 | 
            -
                      exception_modules = []
         | 
| 2167 | 
            -
                      exception_objects = []
         | 
| 2168 | 
            -
                      exception_classes = []
         | 
| 2169 | 
            -
                      expected_exceptions.each do |exception_type|
         | 
| 2170 | 
            -
                        if exception_type.instance_of?(Module)
         | 
| 2171 | 
            -
                          exception_modules << exception_type
         | 
| 2172 | 
            -
                        elsif exception_type.is_a?(Exception)
         | 
| 2173 | 
            -
                          exception_objects << exception_type
         | 
| 2174 | 
            -
                        else
         | 
| 2175 | 
            -
                          @test_case.__send__(:assert,
         | 
| 2176 | 
            -
                                              Exception >= exception_type,
         | 
| 2177 | 
            -
                                              "Should expect a class of exception, " +
         | 
| 2178 | 
            -
                                              "#{exception_type}")
         | 
| 2179 | 
            -
                          exception_classes << exception_type
         | 
| 2180 | 
            -
                        end
         | 
| 2181 | 
            -
                      end
         | 
| 2182 | 
            -
                      [exception_classes, exception_modules, exception_objects]
         | 
| 2183 | 
            -
                    end
         | 
| 2184 | 
            -
             | 
| 2185 | 
            -
                    def expected_class?(actual_exception, equality)
         | 
| 2186 | 
            -
                      @expected_classes.any? do |expected_class|
         | 
| 2187 | 
            -
                        actual_exception.__send__(equality, expected_class)
         | 
| 2188 | 
            -
                      end
         | 
| 2189 | 
            -
                    end
         | 
| 2190 | 
            -
             | 
| 2191 | 
            -
                    def expected_module?(actual_exception)
         | 
| 2192 | 
            -
                      @expected_modules.any? do |expected_module|
         | 
| 2193 | 
            -
                        actual_exception.is_a?(expected_module)
         | 
| 2194 | 
            -
                      end
         | 
| 2195 | 
            -
                    end
         | 
| 2196 | 
            -
             | 
| 2197 | 
            -
                    def expected_object?(actual_exception)
         | 
| 2198 | 
            -
                      @expected_objects.any? do |expected_object|
         | 
| 2199 | 
            -
                        expected_object == actual_exception or
         | 
| 2200 | 
            -
                          fallback_exception_object_equal(expected_object, actual_exception)
         | 
| 2201 | 
            -
                      end
         | 
| 2202 | 
            -
                    end
         | 
| 2203 | 
            -
             | 
| 2204 | 
            -
                    def fallback_exception_object_equal(expected_object, actual_exception)
         | 
| 2205 | 
            -
                      owner = Util::MethodOwnerFinder.find(expected_object, :==)
         | 
| 2206 | 
            -
                      if owner == Kernel or owner == Exception
         | 
| 2207 | 
            -
                        expected_object.class == actual_exception.class and
         | 
| 2208 | 
            -
                          expected_object.message == actual_exception.message
         | 
| 2209 | 
            -
                      else
         | 
| 2210 | 
            -
                        false
         | 
| 2211 | 
            -
                      end
         | 
| 2212 | 
            -
                    end
         | 
| 2213 | 
            -
                  end
         | 
| 2214 | 
            -
             | 
| 2215 | 
            -
                  # :startdoc:
         | 
| 2216 | 
            -
                end
         | 
| 2217 | 
            -
              end
         | 
| 2218 | 
            -
            end
         |