es_cli 0.1.0
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 +7 -0
- data/.bundle/config +2 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +12 -0
- data/exe/es +8 -0
- data/lib/es_cli/cli.rb +247 -0
- data/lib/es_cli/version.rb +5 -0
- data/lib/es_cli.rb +11 -0
- data/readme.org +78 -0
- data/sig/es_cli.rbs +4 -0
- data/vendor/bundle/ruby/3.1.0/bin/rake +29 -0
- data/vendor/bundle/ruby/3.1.0/bin/thor +29 -0
- data/vendor/bundle/ruby/3.1.0/cache/event_stream_parser-1.0.0.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/faraday-2.12.2.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/faraday-multipart-1.1.0.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/faraday-net_http-3.4.0.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/json-2.9.1.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/logger-1.6.5.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/multipart-post-2.4.1.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/net-http-0.6.0.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/power_assert-2.0.5.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/rake-13.2.1.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/ruby-openai-7.3.1.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/test-unit-3.6.7.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/thor-1.3.2.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/cache/uri-1.0.2.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/extensions/arm64-darwin-23/3.1.0/json-2.9.1/gem.build_complete +0 -0
- data/vendor/bundle/ruby/3.1.0/extensions/arm64-darwin-23/3.1.0/json-2.9.1/gem_make.out +22 -0
- data/vendor/bundle/ruby/3.1.0/extensions/arm64-darwin-23/3.1.0/json-2.9.1/json/ext/generator.bundle +0 -0
- data/vendor/bundle/ruby/3.1.0/extensions/arm64-darwin-23/3.1.0/json-2.9.1/json/ext/parser.bundle +0 -0
- data/vendor/bundle/ruby/3.1.0/extensions/arm64-darwin-23/3.1.0/json-2.9.1/mkmf.log +208 -0
- data/vendor/bundle/ruby/3.1.0/gems/event_stream_parser-1.0.0/LICENSE.md +21 -0
- data/vendor/bundle/ruby/3.1.0/gems/event_stream_parser-1.0.0/README.md +99 -0
- data/vendor/bundle/ruby/3.1.0/gems/event_stream_parser-1.0.0/lib/event_stream_parser/version.rb +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/event_stream_parser-1.0.0/lib/event_stream_parser.rb +222 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/CHANGELOG.md +574 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/README.md +67 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/Rakefile +12 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/examples/client_spec.rb +119 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/examples/client_test.rb +144 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/adapter/test.rb +311 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/adapter.rb +101 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/adapter_registry.rb +30 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/connection.rb +564 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/encoders/flat_params_encoder.rb +105 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/encoders/nested_params_encoder.rb +183 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/error.rb +165 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/logging/formatter.rb +118 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/methods.rb +6 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/middleware.rb +72 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/middleware_registry.rb +83 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/options/connection_options.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/options/env.rb +204 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/options/proxy_options.rb +36 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/options/request_options.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/options/ssl_options.rb +73 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/options.rb +219 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/parameters.rb +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/rack_builder.rb +251 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/request/authorization.rb +54 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/request/instrumentation.rb +58 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/request/json.rb +70 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/request/url_encoded.rb +60 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/request.rb +139 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/response/json.rb +74 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/response/logger.rb +37 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/response/raise_error.rb +83 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/response.rb +91 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/utils/headers.rb +150 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/utils/params_hash.rb +61 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/utils.rb +121 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday/version.rb +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/lib/faraday.rb +157 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/external_adapters/faraday_specs_setup.rb +14 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/adapter/test_spec.rb +442 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/adapter_registry_spec.rb +28 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/adapter_spec.rb +55 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/connection_spec.rb +808 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/error_spec.rb +93 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/middleware_registry_spec.rb +31 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/middleware_spec.rb +213 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/options/env_spec.rb +76 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/options/options_spec.rb +297 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/options/proxy_options_spec.rb +52 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/options/request_options_spec.rb +19 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/params_encoders/flat_spec.rb +42 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/params_encoders/nested_spec.rb +151 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/rack_builder_spec.rb +317 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/request/authorization_spec.rb +118 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/request/instrumentation_spec.rb +74 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/request/json_spec.rb +199 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/request/url_encoded_spec.rb +93 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/request_spec.rb +110 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/response/json_spec.rb +206 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/response/logger_spec.rb +278 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/response/raise_error_spec.rb +275 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/response_spec.rb +77 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/utils/headers_spec.rb +109 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/utils_spec.rb +119 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday_spec.rb +43 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/spec_helper.rb +133 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/support/disabling_stub.rb +14 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/support/fake_safe_buffer.rb +15 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/support/faraday_middleware_subclasses.rb +18 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/support/helper_methods.rb +96 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/support/shared_examples/adapter.rb +105 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/support/shared_examples/params_encoder.rb +18 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/support/shared_examples/request_method.rb +263 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/support/streaming_response_checker.rb +35 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-multipart-1.1.0/CHANGELOG.md +54 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-multipart-1.1.0/LICENSE.md +21 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-multipart-1.1.0/README.md +170 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-multipart-1.1.0/lib/faraday/multipart/file_part.rb +130 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-multipart-1.1.0/lib/faraday/multipart/middleware.rb +134 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-multipart-1.1.0/lib/faraday/multipart/param_part.rb +55 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-multipart-1.1.0/lib/faraday/multipart/version.rb +16 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-multipart-1.1.0/lib/faraday/multipart.rb +26 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-net_http-3.4.0/LICENSE.md +21 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-net_http-3.4.0/README.md +57 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-net_http-3.4.0/lib/faraday/adapter/net_http.rb +206 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-net_http-3.4.0/lib/faraday/net_http/version.rb +7 -0
- data/vendor/bundle/ruby/3.1.0/gems/faraday-net_http-3.4.0/lib/faraday/net_http.rb +10 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/BSDL +22 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/CHANGES.md +572 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/COPYING +56 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/LEGAL +60 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/README.md +195 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/fbuffer/fbuffer.h +214 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/generator/.sitearchdir.-.json.-.ext.time +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/generator/Makefile +269 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/generator/extconf.rb +10 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/generator/generator.bundle +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/generator/generator.c +1691 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/generator/generator.o +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/parser/.sitearchdir.-.json.-.ext.time +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/parser/Makefile +269 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/parser/extconf.rb +12 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/parser/parser.bundle +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/parser/parser.c +3238 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/parser/parser.o +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/ext/json/ext/parser/parser.rl +1465 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/json.gemspec +64 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/bigdecimal.rb +58 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/complex.rb +51 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/core.rb +12 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/date.rb +54 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/date_time.rb +67 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/exception.rb +49 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/ostruct.rb +54 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/range.rb +54 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/rational.rb +49 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/regexp.rb +48 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/set.rb +48 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/struct.rb +52 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/symbol.rb +47 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/add/time.rb +52 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/common.rb +896 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/ext/generator/state.rb +116 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/ext/generator.bundle +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/ext/parser.bundle +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/ext.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/generic_object.rb +75 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/truffle_ruby/generator.rb +629 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json/version.rb +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/json-2.9.1/lib/json.rb +587 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/.github/dependabot.yml +6 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/.github/workflows/push_gem.yml +46 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/.github/workflows/test.yml +32 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/.gitignore +11 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/BSDL +22 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/COPYING +56 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/Gemfile +10 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/README.md +104 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/Rakefile +30 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/bin/console +14 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/bin/setup +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/lib/logger/errors.rb +9 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/lib/logger/formatter.rb +36 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/lib/logger/log_device.rb +241 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/lib/logger/period.rb +47 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/lib/logger/severity.rb +38 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/lib/logger/version.rb +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/lib/logger.rb +761 -0
- data/vendor/bundle/ruby/3.1.0/gems/logger-1.6.5/logger.gemspec +28 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/changelog.md +14 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/composite_io.rb +17 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/multipart/post/composite_read_io.rb +91 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/multipart/post/multipartable.rb +70 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/multipart/post/parts.rb +148 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/multipart/post/upload_io.rb +64 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/multipart/post/version.rb +11 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/multipart/post.rb +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/multipart_post.rb +11 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/multipartable.rb +19 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/net/http/post/multipart.rb +28 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/lib/parts.rb +25 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/license.md +58 -0
- data/vendor/bundle/ruby/3.1.0/gems/multipart-post-2.4.1/readme.md +170 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/BSDL +22 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/COPYING +56 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/Gemfile +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/README.md +93 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/Rakefile +10 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/bin/console +14 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/bin/setup +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/doc/net-http/examples.rdoc +31 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/doc/net-http/included_getters.rdoc +3 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http/exceptions.rb +34 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http/generic_request.rb +414 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http/header.rb +981 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http/proxy_delta.rb +17 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http/request.rb +88 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http/requests.rb +430 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http/response.rb +738 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http/responses.rb +1174 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http/status.rb +84 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/http.rb +2580 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/lib/net/https.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/net-http.gemspec +39 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/.github/dependabot.yml +6 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/.github/workflows/ci.yml +46 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/.gitignore +9 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/BSDL +22 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/COPYING +57 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/Gemfile +19 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/LEGAL +4 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/README.md +98 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/Rakefile +59 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/lib/power_assert/colorize.rb +7 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/lib/power_assert/configuration.rb +46 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/lib/power_assert/context.rb +233 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/lib/power_assert/enable_tracepoint_events.rb +62 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/lib/power_assert/inspector.rb +66 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/lib/power_assert/parser.rb +251 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/lib/power_assert/version.rb +3 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/lib/power_assert.rb +93 -0
- data/vendor/bundle/ruby/3.1.0/gems/power_assert-2.0.5/power_assert.gemspec +24 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/History.rdoc +2403 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/README.rdoc +155 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/command_line_usage.rdoc +158 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/example/a.c +6 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/example/b.c +6 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/example/main.c +11 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/glossary.rdoc +42 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/jamis.rb +592 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/rake.1 +156 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/rakefile.rdoc +622 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/doc/rational.rdoc +151 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/exe/rake +27 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/application.rb +861 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/backtrace.rb +25 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/clean.rb +78 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/cloneable.rb +17 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/cpu_counter.rb +107 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/default_loader.rb +15 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/dsl_definition.rb +196 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/early_time.rb +22 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/ext/core.rb +26 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/ext/string.rb +176 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/file_creation_task.rb +25 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/file_list.rb +435 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/file_task.rb +58 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/file_utils.rb +132 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/file_utils_ext.rb +134 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/invocation_chain.rb +57 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/invocation_exception_mixin.rb +17 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/late_time.rb +18 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/linked_list.rb +112 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/loaders/makefile.rb +54 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/multi_task.rb +14 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/name_space.rb +38 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/packagetask.rb +222 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/phony.rb +16 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/private_reader.rb +21 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/promise.rb +100 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/pseudo_status.rb +30 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/rake_module.rb +67 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/rake_test_loader.rb +27 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/scope.rb +43 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/task.rb +434 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/task_argument_error.rb +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/task_arguments.rb +109 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/task_manager.rb +331 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/tasklib.rb +12 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/testtask.rb +189 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/thread_history_display.rb +49 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/thread_pool.rb +163 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/trace_output.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/version.rb +10 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake/win32.rb +51 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/lib/rake.rb +70 -0
- data/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/rake.gemspec +101 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.circleci/config.yml +46 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.devcontainer/Dockerfile +16 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.devcontainer/devcontainer.json +36 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.devcontainer/docker-compose.yml +19 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.github/FUNDING.yml +13 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.github/dependabot.yml +15 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.gitignore +69 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.rspec +3 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/.rubocop.yml +31 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/CHANGELOG.md +467 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/CODE_OF_CONDUCT.md +74 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/CONTRIBUTING.md +3 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/Gemfile +12 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/Gemfile.lock +92 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/README.md +1381 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/Rakefile +19 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/bin/console +14 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/bin/setup +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/assistants.rb +29 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/audio.rb +19 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/batches.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/client.rb +122 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/compatibility.rb +10 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/files.rb +75 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/finetunes.rb +27 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/http.rb +134 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/http_headers.rb +36 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/images.rb +27 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/messages.rb +27 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/models.rb +15 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/run_steps.rb +15 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/runs.rb +37 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/threads.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/vector_store_file_batches.rb +29 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/vector_store_files.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/vector_stores.rb +27 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai/version.rb +3 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/openai.rb +92 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/lib/ruby/openai.rb +2 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/pull_request_template.md +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/ruby-openai-7.3.1/ruby-openai.gemspec +32 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/BSDL +24 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/COPYING +64 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/PSFL +271 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/README.md +108 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/Rakefile +74 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/doc/text/getting-started.md +246 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/doc/text/how-to.md +90 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/doc/text/news.md +1853 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/assertion-failed-error.rb +60 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/assertions.rb +2541 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/attribute-matcher.rb +26 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/attribute.rb +228 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/auto-runner-loader.rb +17 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/autorunner.rb +629 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/code-snippet-fetcher.rb +58 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/collector/descendant.rb +20 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/collector/dir.rb +110 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/collector/load.rb +201 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/collector/objectspace.rb +35 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/collector/xml.rb +249 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/collector.rb +104 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/color-scheme.rb +225 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/color.rb +134 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/data-sets.rb +127 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/data.rb +371 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/diff.rb +745 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/error.rb +158 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/exception-handler.rb +82 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/failure.rb +169 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/fault-location-detector.rb +104 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/fixture.rb +304 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/notification.rb +138 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/omission.rb +198 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/pending.rb +155 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/priority.rb +194 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/runner/console.rb +86 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/runner/emacs.rb +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/runner/xml.rb +15 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/sub-test-result.rb +59 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/test-suite-creator.rb +103 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/test-suite-runner.rb +128 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/test-suite-thread-runner.rb +69 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/testcase.rb +963 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/testresult.rb +132 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/testsuite.rb +108 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/ui/console/outputlevel.rb +15 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/ui/console/testrunner.rb +891 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/ui/testrunner.rb +53 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/ui/testrunnermediator.rb +119 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/ui/xml/testrunner.rb +224 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/util/backtracefilter.rb +59 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/util/memory-usage.rb +47 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/util/observable.rb +86 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/util/output.rb +32 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/util/procwrapper.rb +48 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/version.rb +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit/warning.rb +3 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test/unit.rb +521 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/lib/test-unit.rb +19 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/sample/adder.rb +13 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/sample/subtracter.rb +12 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/sample/test_adder.rb +20 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/sample/test_subtracter.rb +20 -0
- data/vendor/bundle/ruby/3.1.0/gems/test-unit-3.6.7/sample/test_user.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/.document +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/CONTRIBUTING.md +15 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/README.md +45 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/bin/thor +6 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/actions/create_file.rb +105 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/actions/create_link.rb +61 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/actions/directory.rb +108 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/actions/empty_directory.rb +143 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/actions/file_manipulation.rb +371 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/actions/inject_into_file.rb +130 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/actions.rb +340 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/base.rb +825 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/command.rb +151 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/core_ext/hash_with_indifferent_access.rb +107 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/error.rb +106 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/group.rb +292 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/invocation.rb +178 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/line_editor/basic.rb +37 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/line_editor/readline.rb +88 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/line_editor.rb +17 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/nested_context.rb +29 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/parser/argument.rb +86 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/parser/arguments.rb +195 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/parser/option.rb +178 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/parser/options.rb +294 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/parser.rb +4 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/rake_compat.rb +72 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/runner.rb +335 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/shell/basic.rb +388 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/shell/color.rb +115 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/shell/column_printer.rb +29 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/shell/html.rb +84 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/shell/lcs_diff.rb +49 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/shell/table_printer.rb +118 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/shell/terminal.rb +42 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/shell/wrapped_printer.rb +38 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/shell.rb +81 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/util.rb +285 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor/version.rb +3 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/lib/thor.rb +674 -0
- data/vendor/bundle/ruby/3.1.0/gems/thor-1.3.2/thor.gemspec +33 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/BSDL +22 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/COPYING +56 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/README.md +55 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/common.rb +876 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/file.rb +100 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/ftp.rb +267 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/generic.rb +1578 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/http.rb +125 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/https.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/ldap.rb +261 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/ldaps.rb +22 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/mailto.rb +293 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/rfc2396_parser.rb +546 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/rfc3986_parser.rb +206 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/version.rb +6 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/ws.rb +83 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri/wss.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/uri-1.0.2/lib/uri.rb +104 -0
- data/vendor/bundle/ruby/3.1.0/specifications/event_stream_parser-1.0.0.gemspec +23 -0
- data/vendor/bundle/ruby/3.1.0/specifications/faraday-2.12.2.gemspec +0 -0
- data/vendor/bundle/ruby/3.1.0/specifications/faraday-multipart-1.1.0.gemspec +32 -0
- data/vendor/bundle/ruby/3.1.0/specifications/faraday-net_http-3.4.0.gemspec +32 -0
- data/vendor/bundle/ruby/3.1.0/specifications/json-2.9.1.gemspec +0 -0
- data/vendor/bundle/ruby/3.1.0/specifications/logger-1.6.5.gemspec +22 -0
- data/vendor/bundle/ruby/3.1.0/specifications/multipart-post-2.4.1.gemspec +21 -0
- data/vendor/bundle/ruby/3.1.0/specifications/net-http-0.6.0.gemspec +33 -0
- data/vendor/bundle/ruby/3.1.0/specifications/power_assert-2.0.5.gemspec +24 -0
- data/vendor/bundle/ruby/3.1.0/specifications/rake-13.2.1.gemspec +26 -0
- data/vendor/bundle/ruby/3.1.0/specifications/ruby-openai-7.3.1.gemspec +36 -0
- data/vendor/bundle/ruby/3.1.0/specifications/test-unit-3.6.7.gemspec +31 -0
- data/vendor/bundle/ruby/3.1.0/specifications/thor-1.3.2.gemspec +34 -0
- data/vendor/bundle/ruby/3.1.0/specifications/uri-1.0.2.gemspec +23 -0
- metadata +560 -0
@@ -0,0 +1,2541 @@
|
|
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/memory-usage'
|
9
|
+
require 'test/unit/util/method-owner-finder'
|
10
|
+
require 'test/unit/diff'
|
11
|
+
|
12
|
+
begin
|
13
|
+
require 'power_assert'
|
14
|
+
rescue LoadError, SyntaxError
|
15
|
+
end
|
16
|
+
|
17
|
+
module Test
|
18
|
+
module Unit
|
19
|
+
|
20
|
+
##
|
21
|
+
# Test::Unit::Assertions contains the standard Test::Unit assertions.
|
22
|
+
# Assertions is included in Test::Unit::TestCase.
|
23
|
+
#
|
24
|
+
# To include it in your own code and use its functionality, you simply
|
25
|
+
# need to rescue Test::Unit::AssertionFailedError. Additionally you may
|
26
|
+
# override add_assertion to get notified whenever an assertion is made.
|
27
|
+
#
|
28
|
+
# Notes:
|
29
|
+
#
|
30
|
+
# * The message to each assertion, if given, will be propagated with the
|
31
|
+
# failure.
|
32
|
+
# * It is easy to add your own assertions based on assert_block().
|
33
|
+
#
|
34
|
+
# @example Example Custom Assertion
|
35
|
+
#
|
36
|
+
# def deny(boolean, message=nil)
|
37
|
+
# message = build_message(message, '<?> is not false or nil.', boolean)
|
38
|
+
# assert_block(message) do
|
39
|
+
# not boolean
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
|
43
|
+
module Assertions
|
44
|
+
|
45
|
+
##
|
46
|
+
# The assertion upon which all other assertions are based. Passes if the
|
47
|
+
# block yields not false nor nil.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# assert_block "Couldn't do the thing" do
|
51
|
+
# do_the_thing
|
52
|
+
# end
|
53
|
+
def assert_block(message="assert_block failed.")
|
54
|
+
_wrap_assertion do
|
55
|
+
if (! yield)
|
56
|
+
options = {}
|
57
|
+
if message.respond_to?(:user_message)
|
58
|
+
options[:user_message] = message.user_message
|
59
|
+
end
|
60
|
+
raise AssertionFailedError.new(message.to_s, options)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# @private
|
66
|
+
NOT_SPECIFIED = Object.new
|
67
|
+
|
68
|
+
# @overload assert(object, message=nil)
|
69
|
+
#
|
70
|
+
# Asserts that `object` is not false nor nil.
|
71
|
+
#
|
72
|
+
# Normally, you don't need to use this assertion. Use more
|
73
|
+
# specific assertions such as #assert_equal and
|
74
|
+
# #assert_include.
|
75
|
+
#
|
76
|
+
# @example Pass patterns
|
77
|
+
# assert(true) # => pass
|
78
|
+
# assert([1, 2].include?(1)) # => pass
|
79
|
+
#
|
80
|
+
# @example Failure patterns
|
81
|
+
# assert(nil) # => failure
|
82
|
+
# assert(false) # => failure
|
83
|
+
# assert([1, 2].include?(5)) # => failure
|
84
|
+
#
|
85
|
+
# @param [Object] object The check target.
|
86
|
+
# @param [String] message The additional user message. It is
|
87
|
+
# showed when the assertion is failed.
|
88
|
+
# @return [void]
|
89
|
+
#
|
90
|
+
# @overload assert(message=nil) {}
|
91
|
+
#
|
92
|
+
# Asserts that the givens block returns not false nor nil.
|
93
|
+
#
|
94
|
+
# This style uses Power Assert. It means that you can see each
|
95
|
+
# object values in method chains on failure. See the following
|
96
|
+
# example about Power Assert.
|
97
|
+
#
|
98
|
+
# @example Power Assert
|
99
|
+
# coins = [1, 5, 50]
|
100
|
+
# target_coin = 10
|
101
|
+
# assert do
|
102
|
+
# coins.include?(target_coin)
|
103
|
+
# end
|
104
|
+
# # =>
|
105
|
+
# # coins.include?(target_coin)
|
106
|
+
# # | | |
|
107
|
+
# # | | 10
|
108
|
+
# # | false
|
109
|
+
# # [1, 5, 50]
|
110
|
+
#
|
111
|
+
# We recommend you to use Power Assert for predicate method
|
112
|
+
# checks rather than existing assertions such as
|
113
|
+
# #assert_include and #assert_predicate. Power Assert shows
|
114
|
+
# useful message for debugging.
|
115
|
+
#
|
116
|
+
# We don't recommend you use Power Assert for equality
|
117
|
+
# check. You should use #assert_equal for the case. Because
|
118
|
+
# #assert_equal shows more useful message for debugging.
|
119
|
+
#
|
120
|
+
# @example Pass patterns
|
121
|
+
# assert {true} # => pass
|
122
|
+
# assert {[1, 2].include?(1)} # => pass
|
123
|
+
#
|
124
|
+
# @example Failure patterns
|
125
|
+
# assert {nil} # => failure
|
126
|
+
# assert {false} # => failure
|
127
|
+
# assert {[1, 2].include?(5)} # => failure
|
128
|
+
#
|
129
|
+
# @param [String] message The additional user message. It is
|
130
|
+
# showed when the assertion is failed.
|
131
|
+
# @yield [] Given no parameters to the block.
|
132
|
+
# @yieldreturn [Object] The checked object.
|
133
|
+
# @return [void]
|
134
|
+
def assert(object=NOT_SPECIFIED, message=nil, &block)
|
135
|
+
_wrap_assertion do
|
136
|
+
have_object = !NOT_SPECIFIED.equal?(object)
|
137
|
+
if block
|
138
|
+
message = object if have_object
|
139
|
+
if defined?(PowerAssert)
|
140
|
+
PowerAssert.start(block, :assertion_method => __callee__) do |pa|
|
141
|
+
pa_message = AssertionMessage.delayed_literal(&pa.message_proc)
|
142
|
+
assertion_message = build_message(message, "?", pa_message)
|
143
|
+
assert_block(assertion_message) do
|
144
|
+
pa.yield
|
145
|
+
end
|
146
|
+
end
|
147
|
+
else
|
148
|
+
assert(yield, message)
|
149
|
+
end
|
150
|
+
else
|
151
|
+
unless have_object
|
152
|
+
raise ArgumentError, "wrong number of arguments (0 for 1..2)"
|
153
|
+
end
|
154
|
+
assertion_message = nil
|
155
|
+
case message
|
156
|
+
when nil, String, Proc
|
157
|
+
when AssertionMessage
|
158
|
+
assertion_message = message
|
159
|
+
else
|
160
|
+
error_message = "assertion message must be String, Proc or "
|
161
|
+
error_message += "#{AssertionMessage}: "
|
162
|
+
error_message += "<#{message.inspect}>(<#{message.class}>)"
|
163
|
+
raise ArgumentError, error_message, filter_backtrace(caller)
|
164
|
+
end
|
165
|
+
assertion_message ||= build_message(message,
|
166
|
+
"<?> is not true.",
|
167
|
+
object)
|
168
|
+
assert_block(assertion_message) do
|
169
|
+
object
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Asserts that `object` is false or nil.
|
176
|
+
#
|
177
|
+
# @note Just for minitest compatibility. :<
|
178
|
+
#
|
179
|
+
# @param [Object] object The object to be asserted.
|
180
|
+
# @return [void]
|
181
|
+
#
|
182
|
+
# @example Pass patterns
|
183
|
+
# refute(false) # => pass
|
184
|
+
# refute(nil) # => pass
|
185
|
+
#
|
186
|
+
# @example Failure patterns
|
187
|
+
# refute(true) # => failure
|
188
|
+
# refute("string") # => failure
|
189
|
+
#
|
190
|
+
# @since 2.5.3
|
191
|
+
def refute(object, message=nil)
|
192
|
+
_wrap_assertion do
|
193
|
+
assertion_message = nil
|
194
|
+
case message
|
195
|
+
when nil, String, Proc
|
196
|
+
when AssertionMessage
|
197
|
+
assertion_message = message
|
198
|
+
else
|
199
|
+
error_message = "assertion message must be String, Proc or "
|
200
|
+
error_message += "#{AssertionMessage}: "
|
201
|
+
error_message += "<#{message.inspect}>(<#{message.class}>)"
|
202
|
+
raise ArgumentError, error_message, filter_backtrace(caller)
|
203
|
+
end
|
204
|
+
assert_block("refute should not be called with a block.") do
|
205
|
+
!block_given?
|
206
|
+
end
|
207
|
+
assertion_message ||= build_message(message,
|
208
|
+
"<?> is neither nil or false.",
|
209
|
+
object)
|
210
|
+
assert_block(assertion_message) do
|
211
|
+
not object
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Passes if `expected` == `actual`.
|
218
|
+
#
|
219
|
+
# Note that the ordering of arguments is important, since a helpful
|
220
|
+
# error message is generated when this one fails that tells you the
|
221
|
+
# values of expected and actual.
|
222
|
+
#
|
223
|
+
# @example
|
224
|
+
# assert_equal 'MY STRING', 'my string'.upcase
|
225
|
+
def assert_equal(expected, actual, message=nil)
|
226
|
+
diff = AssertionMessage.delayed_diff(expected, actual)
|
227
|
+
if expected.respond_to?(:encoding) and
|
228
|
+
actual.respond_to?(:encoding) and
|
229
|
+
expected.encoding != actual.encoding
|
230
|
+
format = <<EOT
|
231
|
+
<?>(?) expected but was
|
232
|
+
<?>(?).?
|
233
|
+
EOT
|
234
|
+
full_message = build_message(message, format,
|
235
|
+
expected, expected.encoding.name,
|
236
|
+
actual, actual.encoding.name,
|
237
|
+
diff)
|
238
|
+
else
|
239
|
+
full_message = build_message(message, <<EOT, expected, actual, diff)
|
240
|
+
<?> expected but was
|
241
|
+
<?>.?
|
242
|
+
EOT
|
243
|
+
end
|
244
|
+
begin
|
245
|
+
assert_block(full_message) { expected == actual }
|
246
|
+
rescue AssertionFailedError => failure
|
247
|
+
_set_failed_information(failure, expected, actual)
|
248
|
+
raise failure # For JRuby. :<
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
##
|
253
|
+
# Passes if the block raises one of the expected
|
254
|
+
# exceptions. When an expected exception is an Exception
|
255
|
+
# object, passes if expected_exception == actual_exception.
|
256
|
+
#
|
257
|
+
# @example
|
258
|
+
# assert_raise(RuntimeError, LoadError) do
|
259
|
+
# raise 'Boom!!!'
|
260
|
+
# end # -> pass
|
261
|
+
#
|
262
|
+
# assert_raise do
|
263
|
+
# raise Exception, 'Any exception should be raised!!!'
|
264
|
+
# end # -> pass
|
265
|
+
#
|
266
|
+
# assert_raise(RuntimeError.new("XXX")) {raise "XXX"} # -> pass
|
267
|
+
# assert_raise(MyError.new("XXX")) {raise "XXX"} # -> fail
|
268
|
+
# assert_raise(RuntimeError.new("ZZZ")) {raise "XXX"} # -> fail
|
269
|
+
def assert_raise(*args, &block)
|
270
|
+
assert_expected_exception = Proc.new do |*_args|
|
271
|
+
message, assert_exception_helper, actual_exception = _args
|
272
|
+
expected = assert_exception_helper.expected_exceptions
|
273
|
+
diff = AssertionMessage.delayed_diff(expected, actual_exception)
|
274
|
+
full_message = build_message(message,
|
275
|
+
"<?> exception expected but was\n<?>.?",
|
276
|
+
expected, actual_exception, diff)
|
277
|
+
begin
|
278
|
+
assert_block(full_message) do
|
279
|
+
expected == [] or
|
280
|
+
assert_exception_helper.expected?(actual_exception)
|
281
|
+
end
|
282
|
+
rescue AssertionFailedError => failure
|
283
|
+
_set_failed_information(failure, expected, actual_exception)
|
284
|
+
raise failure # For JRuby. :<
|
285
|
+
end
|
286
|
+
end
|
287
|
+
_assert_raise(assert_expected_exception, *args, &block)
|
288
|
+
end
|
289
|
+
|
290
|
+
# Just for minitest compatibility. :<
|
291
|
+
alias_method :assert_raises, :assert_raise
|
292
|
+
|
293
|
+
# Passes if the block raises `expected_exception` with
|
294
|
+
# `expected_message`. `expected_message` can be a `String` or
|
295
|
+
# `Regexp`.
|
296
|
+
#
|
297
|
+
# @example Pass pattern: String
|
298
|
+
# assert_raise_with_message(RuntimeError, "Boom!!!") do
|
299
|
+
# raise "Boom!!!"
|
300
|
+
# end # -> pass
|
301
|
+
#
|
302
|
+
# @example Pass pattern: Regexp
|
303
|
+
# assert_raise_with_message(RuntimeError, /!!!/) do
|
304
|
+
# raise "Boom!!!"
|
305
|
+
# end # -> pass
|
306
|
+
#
|
307
|
+
# @example Failure pattern: Exception class isn't matched
|
308
|
+
# assert_raise_with_message(RuntimeError, "Boom!!!") do
|
309
|
+
# raise ArgumentError, "Boom!!!"
|
310
|
+
# end # -> failure
|
311
|
+
#
|
312
|
+
# @example Failure pattern: Exception message isn't matched
|
313
|
+
# assert_raise_with_message(RuntimeError, "Boom!!!") do
|
314
|
+
# raise "Hello"
|
315
|
+
# end # -> failure
|
316
|
+
#
|
317
|
+
# @since 3.4.3
|
318
|
+
def assert_raise_with_message(expected_exception_class,
|
319
|
+
expected_message,
|
320
|
+
message=nil,
|
321
|
+
&block)
|
322
|
+
assert_expected_exception = Proc.new do |*_args|
|
323
|
+
_message, assert_exception_helper, actual_exception = _args
|
324
|
+
diff = AssertionMessage.delayed_diff([
|
325
|
+
expected_exception_class,
|
326
|
+
expected_message,
|
327
|
+
],
|
328
|
+
[
|
329
|
+
actual_exception.class,
|
330
|
+
actual_exception.message,
|
331
|
+
])
|
332
|
+
full_message = build_message(message,
|
333
|
+
"<?>(<?>) exception expected but was\n" +
|
334
|
+
"<?>(<?>).?",
|
335
|
+
expected_exception_class,
|
336
|
+
expected_message,
|
337
|
+
actual_exception.class,
|
338
|
+
actual_exception.message,
|
339
|
+
diff)
|
340
|
+
begin
|
341
|
+
assert_block(full_message) do
|
342
|
+
assert_exception_helper.expected?(actual_exception) and
|
343
|
+
expected_message === actual_exception.message
|
344
|
+
end
|
345
|
+
rescue AssertionFailedError => failure
|
346
|
+
_set_failed_information(failure,
|
347
|
+
expected_exception_class,
|
348
|
+
actual_exception)
|
349
|
+
raise failure # For JRuby. :<
|
350
|
+
end
|
351
|
+
actual_exception
|
352
|
+
end
|
353
|
+
args = [expected_exception_class]
|
354
|
+
args << message if message
|
355
|
+
_assert_raise(assert_expected_exception, *args, &block)
|
356
|
+
end
|
357
|
+
|
358
|
+
##
|
359
|
+
# Passes if the block raises one of the given
|
360
|
+
# exceptions or sub exceptions of the given exceptions.
|
361
|
+
#
|
362
|
+
# @example
|
363
|
+
# assert_raise_kind_of(SystemCallError) do
|
364
|
+
# raise Errno::EACCES
|
365
|
+
# end
|
366
|
+
def assert_raise_kind_of(*args, &block)
|
367
|
+
assert_expected_exception = Proc.new do |*_args|
|
368
|
+
message, assert_exception_helper, actual_exception = _args
|
369
|
+
expected = assert_exception_helper.expected_exceptions
|
370
|
+
full_message = build_message(message,
|
371
|
+
"<?> family exception expected " +
|
372
|
+
"but was\n<?>.",
|
373
|
+
expected, actual_exception)
|
374
|
+
assert_block(full_message) do
|
375
|
+
assert_exception_helper.expected?(actual_exception, :kind_of?)
|
376
|
+
end
|
377
|
+
end
|
378
|
+
_assert_raise(assert_expected_exception, *args, &block)
|
379
|
+
end
|
380
|
+
|
381
|
+
|
382
|
+
##
|
383
|
+
# Passes if `object`.instance_of?(`klass`). When `klass` is
|
384
|
+
# an array of classes, it passes if any class
|
385
|
+
# satisfies +object.instance_of?(class).
|
386
|
+
#
|
387
|
+
# @example
|
388
|
+
# assert_instance_of(String, 'foo') # -> pass
|
389
|
+
# assert_instance_of([Fixnum, NilClass], 100) # -> pass
|
390
|
+
# assert_instance_of([Numeric, NilClass], 100) # -> fail
|
391
|
+
def assert_instance_of(klass, object, message=nil)
|
392
|
+
_wrap_assertion do
|
393
|
+
if klass.is_a?(Array)
|
394
|
+
klasses = klass
|
395
|
+
else
|
396
|
+
klasses = [klass]
|
397
|
+
end
|
398
|
+
assert_block("The first parameter to assert_instance_of should be " +
|
399
|
+
"a Class or an Array of Class.") do
|
400
|
+
klasses.all? {|k| k.is_a?(Class)}
|
401
|
+
end
|
402
|
+
klass_message = AssertionMessage.maybe_container(klass) do |value|
|
403
|
+
"<#{value}>"
|
404
|
+
end
|
405
|
+
full_message = build_message(message, <<EOT, object, klass_message, object.class)
|
406
|
+
<?> was expected to be instance_of\\?
|
407
|
+
? but was
|
408
|
+
<?>.
|
409
|
+
EOT
|
410
|
+
assert_block(full_message) do
|
411
|
+
klasses.any? {|k| object.instance_of?(k)}
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
##
|
417
|
+
# Passes if `object`.instance_of?(`klass`) does not hold.
|
418
|
+
# When `klass` is an array of classes, it passes if no class
|
419
|
+
# satisfies +object.instance_of?(class).
|
420
|
+
#
|
421
|
+
# @example
|
422
|
+
# assert_not_instance_of(String, 100) # -> pass
|
423
|
+
# assert_not_instance_of([Fixnum, NilClass], '100') # -> pass
|
424
|
+
# assert_not_instance_of([Numeric, NilClass], 100) # -> fail
|
425
|
+
#
|
426
|
+
# @since 3.0.0
|
427
|
+
def assert_not_instance_of(klass, object, message=nil)
|
428
|
+
_wrap_assertion do
|
429
|
+
if klass.is_a?(Array)
|
430
|
+
klasses = klass
|
431
|
+
else
|
432
|
+
klasses = [klass]
|
433
|
+
end
|
434
|
+
assert_block("The first parameter to assert_not_instance_of should be " +
|
435
|
+
"a Class or an Array of Class.") do
|
436
|
+
klasses.all? {|k| k.is_a?(Class)}
|
437
|
+
end
|
438
|
+
klass_message = AssertionMessage.maybe_container(klass) do |value|
|
439
|
+
"<#{value}>"
|
440
|
+
end
|
441
|
+
full_message = build_message(message,
|
442
|
+
"<?> was expected to not be instance_of\\?\n" +
|
443
|
+
"? but was.",
|
444
|
+
object,
|
445
|
+
klass_message)
|
446
|
+
assert_block(full_message) do
|
447
|
+
klasses.none? {|k| object.instance_of?(k)}
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
# Just for minitest compatibility. :<
|
453
|
+
#
|
454
|
+
# @since 3.0.0
|
455
|
+
alias_method :refute_instance_of, :assert_not_instance_of
|
456
|
+
|
457
|
+
##
|
458
|
+
# Passes if `object`.nil?.
|
459
|
+
#
|
460
|
+
# @example
|
461
|
+
# assert_nil [1, 2].uniq!
|
462
|
+
def assert_nil(object, message=nil)
|
463
|
+
full_message = build_message(message, <<EOT, object)
|
464
|
+
<?> was expected to be nil.
|
465
|
+
EOT
|
466
|
+
assert_block(full_message) { object.nil? }
|
467
|
+
end
|
468
|
+
|
469
|
+
##
|
470
|
+
# Passes if `object`.kind_of?(`klass`). When `klass` is
|
471
|
+
# an array of classes or modules, it passes if any
|
472
|
+
# class or module satisfies +object.kind_of?(class_or_module).
|
473
|
+
#
|
474
|
+
# @example
|
475
|
+
# assert_kind_of(Object, 'foo') # -> pass
|
476
|
+
# assert_kind_of([Fixnum, NilClass], 100) # -> pass
|
477
|
+
# assert_kind_of([Fixnum, NilClass], "string") # -> fail
|
478
|
+
def assert_kind_of(klass, object, message=nil)
|
479
|
+
_wrap_assertion do
|
480
|
+
if klass.is_a?(Array)
|
481
|
+
klasses = klass
|
482
|
+
else
|
483
|
+
klasses = [klass]
|
484
|
+
end
|
485
|
+
assert_block("The first parameter to assert_kind_of should be " +
|
486
|
+
"a kind_of Module or an Array of a kind_of Module.") do
|
487
|
+
klasses.all? {|k| k.kind_of?(Module)}
|
488
|
+
end
|
489
|
+
klass_message = AssertionMessage.maybe_container(klass) do |value|
|
490
|
+
"<#{value}>"
|
491
|
+
end
|
492
|
+
full_message = build_message(message,
|
493
|
+
"<?> was expected to be kind_of\\?\n" +
|
494
|
+
"? but was\n" +
|
495
|
+
"<?>.",
|
496
|
+
object,
|
497
|
+
klass_message,
|
498
|
+
object.class)
|
499
|
+
assert_block(full_message) do
|
500
|
+
klasses.any? {|k| object.kind_of?(k)}
|
501
|
+
end
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
##
|
506
|
+
# Passes if `object`.kind_of?(`klass`) does not hold.
|
507
|
+
# When `klass` is an array of classes or modules, it passes only if all
|
508
|
+
# classes (and modules) do not satisfy +object.kind_of?(class_or_module).
|
509
|
+
#
|
510
|
+
# @example
|
511
|
+
# assert_not_kind_of(Fixnum, 'foo') # -> pass
|
512
|
+
# assert_not_kind_of([Fixnum, NilClass], '0') # -> pass
|
513
|
+
# assert_not_kind_of([Fixnum, NilClass], 100) # -> fail
|
514
|
+
#
|
515
|
+
# @since 3.0.0
|
516
|
+
def assert_not_kind_of(klass, object, message=nil)
|
517
|
+
_wrap_assertion do
|
518
|
+
if klass.is_a?(Array)
|
519
|
+
klasses = klass
|
520
|
+
else
|
521
|
+
klasses = [klass]
|
522
|
+
end
|
523
|
+
assert_block("The first parameter to assert_not_kind_of should be " +
|
524
|
+
"a kind_of Module or an Array of a kind_of Module.") do
|
525
|
+
klasses.all? {|k| k.kind_of?(Module)}
|
526
|
+
end
|
527
|
+
klass_message = AssertionMessage.maybe_container(klass) do |value|
|
528
|
+
"<#{value}>"
|
529
|
+
end
|
530
|
+
full_message = build_message(message,
|
531
|
+
"<?> was expected to not be kind_of\\?\n" +
|
532
|
+
"? but was.",
|
533
|
+
object,
|
534
|
+
klass_message)
|
535
|
+
assert_block(full_message) do
|
536
|
+
klasses.none? {|k| object.kind_of?(k)}
|
537
|
+
end
|
538
|
+
end
|
539
|
+
end
|
540
|
+
|
541
|
+
# Just for minitest compatibility. :<
|
542
|
+
#
|
543
|
+
# @since 3.0.0
|
544
|
+
alias_method :refute_kind_of, :assert_not_kind_of
|
545
|
+
|
546
|
+
##
|
547
|
+
# Passes if `object` .respond_to? `method`
|
548
|
+
#
|
549
|
+
# @example
|
550
|
+
# assert_respond_to 'bugbear', :slice
|
551
|
+
def assert_respond_to(object, method, message=nil)
|
552
|
+
_wrap_assertion do
|
553
|
+
full_message = build_message(message,
|
554
|
+
"<?>.kind_of\\?(Symbol) or\n" +
|
555
|
+
"<?>.respond_to\\?(:to_str) expected",
|
556
|
+
method, method)
|
557
|
+
assert_block(full_message) do
|
558
|
+
method.kind_of?(Symbol) or method.respond_to?(:to_str)
|
559
|
+
end
|
560
|
+
full_message = build_message(message,
|
561
|
+
"<?>.respond_to\\?(?) expected\n" +
|
562
|
+
"(Class: <?>)",
|
563
|
+
object, method, object.class)
|
564
|
+
assert_block(full_message) {object.respond_to?(method)}
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
568
|
+
##
|
569
|
+
# Passes if `object` does not .respond_to? `method`.
|
570
|
+
#
|
571
|
+
# @example
|
572
|
+
# assert_not_respond_to('bugbear', :nonexistence) # -> pass
|
573
|
+
# assert_not_respond_to('bugbear', :size) # -> fail
|
574
|
+
def assert_not_respond_to(object, method, message=nil)
|
575
|
+
_wrap_assertion do
|
576
|
+
full_message = build_message(message,
|
577
|
+
"<?>.kind_of\\?(Symbol) or\n" +
|
578
|
+
"<?>.respond_to\\?(:to_str) expected",
|
579
|
+
method, method)
|
580
|
+
assert_block(full_message) do
|
581
|
+
method.kind_of?(Symbol) or method.respond_to?(:to_str)
|
582
|
+
end
|
583
|
+
full_message = build_message(message,
|
584
|
+
"!<?>.respond_to\\?(?) expected\n" +
|
585
|
+
"(Class: <?>)",
|
586
|
+
object, method, object.class)
|
587
|
+
assert_block(full_message) {!object.respond_to?(method)}
|
588
|
+
end
|
589
|
+
end
|
590
|
+
|
591
|
+
# Just for minitest compatibility. :<
|
592
|
+
#
|
593
|
+
# @since 2.5.3
|
594
|
+
alias_method :refute_respond_to, :assert_not_respond_to
|
595
|
+
|
596
|
+
##
|
597
|
+
# Passes if `pattern` =~ `string`.
|
598
|
+
#
|
599
|
+
# @example
|
600
|
+
# assert_match(/\d+/, 'five, 6, seven')
|
601
|
+
def assert_match(pattern, string, message=nil)
|
602
|
+
_wrap_assertion do
|
603
|
+
pattern = Regexp.new(Regexp.escape(pattern)) if pattern.is_a?(String)
|
604
|
+
full_message = build_message(message,
|
605
|
+
"<?> was expected to be =~\n<?>.",
|
606
|
+
pattern, string)
|
607
|
+
assert_block(full_message) { pattern =~ string }
|
608
|
+
end
|
609
|
+
end
|
610
|
+
|
611
|
+
##
|
612
|
+
# Passes if `actual` .equal? `expected` (i.e. they are the same
|
613
|
+
# instance).
|
614
|
+
#
|
615
|
+
# @example
|
616
|
+
# o = Object.new
|
617
|
+
# assert_same o, o
|
618
|
+
def assert_same(expected, actual, message=nil)
|
619
|
+
full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
|
620
|
+
<?>
|
621
|
+
with id <?> was expected to be equal\\? to
|
622
|
+
<?>
|
623
|
+
with id <?>.
|
624
|
+
EOT
|
625
|
+
assert_block(full_message) { actual.equal?(expected) }
|
626
|
+
end
|
627
|
+
|
628
|
+
##
|
629
|
+
# Compares the `object1` with `object2` using `operator`.
|
630
|
+
#
|
631
|
+
# Passes if object1.__send__(operator, object2) is not false nor nil.
|
632
|
+
#
|
633
|
+
# @example
|
634
|
+
# assert_operator 5, :>=, 4
|
635
|
+
def assert_operator(object1, operator, object2, message=nil)
|
636
|
+
_wrap_assertion do
|
637
|
+
full_message = build_message(nil, "<?>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
|
638
|
+
assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
|
639
|
+
full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
|
640
|
+
<?> was expected to be
|
641
|
+
?
|
642
|
+
<?>.
|
643
|
+
EOT
|
644
|
+
assert_block(full_message) { object1.__send__(operator, object2) }
|
645
|
+
end
|
646
|
+
end
|
647
|
+
|
648
|
+
##
|
649
|
+
# Compares the `object1` with `object2` using `operator`.
|
650
|
+
#
|
651
|
+
# Passes if object1.__send__(operator, object2) is false or nil.
|
652
|
+
#
|
653
|
+
# @example
|
654
|
+
# assert_not_operator(5, :<, 4) # => pass
|
655
|
+
# assert_not_operator(5, :>, 4) # => fail
|
656
|
+
#
|
657
|
+
# @since 3.0.0
|
658
|
+
def assert_not_operator(object1, operator, object2, message=nil)
|
659
|
+
_wrap_assertion do
|
660
|
+
full_message = build_message(nil, "<?>\ngiven as the operator for #assert_not_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
|
661
|
+
assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
|
662
|
+
full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
|
663
|
+
<?> was expected to not be
|
664
|
+
?
|
665
|
+
<?>.
|
666
|
+
EOT
|
667
|
+
assert_block(full_message) { ! object1.__send__(operator, object2) }
|
668
|
+
end
|
669
|
+
end
|
670
|
+
|
671
|
+
# Just for minitest compatibility. :<
|
672
|
+
#
|
673
|
+
# @since 3.0.0
|
674
|
+
alias_method :refute_operator, :assert_not_operator
|
675
|
+
|
676
|
+
##
|
677
|
+
# Passes if block does not raise an exception.
|
678
|
+
#
|
679
|
+
# @example
|
680
|
+
# assert_nothing_raised do
|
681
|
+
# [1, 2].uniq
|
682
|
+
# end
|
683
|
+
def assert_nothing_raised(*args)
|
684
|
+
_wrap_assertion do
|
685
|
+
if args.last.is_a?(String)
|
686
|
+
message = args.pop
|
687
|
+
else
|
688
|
+
message = ""
|
689
|
+
end
|
690
|
+
|
691
|
+
assert_exception_helper = AssertExceptionHelper.new(self, args)
|
692
|
+
begin
|
693
|
+
yield
|
694
|
+
rescue Exception => e
|
695
|
+
if ((args.empty? && !e.instance_of?(AssertionFailedError)) ||
|
696
|
+
assert_exception_helper.expected?(e))
|
697
|
+
failure_message = build_message(message, "Exception raised:\n?", e)
|
698
|
+
assert_block(failure_message) {false}
|
699
|
+
else
|
700
|
+
raise
|
701
|
+
end
|
702
|
+
end
|
703
|
+
end
|
704
|
+
end
|
705
|
+
|
706
|
+
##
|
707
|
+
# Flunk always fails.
|
708
|
+
#
|
709
|
+
# @example
|
710
|
+
# flunk 'Not done testing yet.'
|
711
|
+
def flunk(message="Flunked")
|
712
|
+
assert_block(build_message(message)){false}
|
713
|
+
end
|
714
|
+
|
715
|
+
##
|
716
|
+
# Passes if ! `actual` .equal? `expected`
|
717
|
+
#
|
718
|
+
# @example
|
719
|
+
# assert_not_same Object.new, Object.new
|
720
|
+
def assert_not_same(expected, actual, message=nil)
|
721
|
+
full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
|
722
|
+
<?>
|
723
|
+
with id <?> was expected to not be equal\\? to
|
724
|
+
<?>
|
725
|
+
with id <?>.
|
726
|
+
EOT
|
727
|
+
assert_block(full_message) { !actual.equal?(expected) }
|
728
|
+
end
|
729
|
+
|
730
|
+
# Just for minitest compatibility. :<
|
731
|
+
#
|
732
|
+
# @since 2.5.3
|
733
|
+
alias_method :refute_same, :assert_not_same
|
734
|
+
|
735
|
+
##
|
736
|
+
# Passes if `expected` != `actual`
|
737
|
+
#
|
738
|
+
# @example
|
739
|
+
# assert_not_equal 'some string', 5
|
740
|
+
def assert_not_equal(expected, actual, message=nil)
|
741
|
+
full_message = build_message(message,
|
742
|
+
"<?> was expected to be != to\n<?>.",
|
743
|
+
expected, actual)
|
744
|
+
assert_block(full_message) { expected != actual }
|
745
|
+
end
|
746
|
+
|
747
|
+
# Just for minitest compatibility. :<
|
748
|
+
#
|
749
|
+
# @since 2.5.3
|
750
|
+
alias_method :refute_equal, :assert_not_equal
|
751
|
+
|
752
|
+
##
|
753
|
+
# Passes if ! `object` .nil?
|
754
|
+
#
|
755
|
+
# @example
|
756
|
+
# assert_not_nil '1 two 3'.sub!(/two/, '2')
|
757
|
+
def assert_not_nil(object, message=nil)
|
758
|
+
full_message = build_message(message,
|
759
|
+
"<?> was expected to not be nil.",
|
760
|
+
object)
|
761
|
+
assert_block(full_message){!object.nil?}
|
762
|
+
end
|
763
|
+
|
764
|
+
# Just for minitest compatibility. :<
|
765
|
+
#
|
766
|
+
# @since 2.5.3
|
767
|
+
alias_method :refute_nil, :assert_not_nil
|
768
|
+
|
769
|
+
##
|
770
|
+
# Passes if `regexp` !~ `string`
|
771
|
+
#
|
772
|
+
# @example
|
773
|
+
# assert_not_match(/two/, 'one 2 three') # -> pass
|
774
|
+
# assert_not_match(/three/, 'one 2 three') # -> fail
|
775
|
+
def assert_not_match(pattern, string, message=nil)
|
776
|
+
_wrap_assertion do
|
777
|
+
pattern = Regexp.new(Regexp.escape(pattern)) if pattern.is_a?(String)
|
778
|
+
full_message = build_message(message,
|
779
|
+
"<?> was expected to not match\n<?>.",
|
780
|
+
pattern, string)
|
781
|
+
assert_block(full_message) { pattern !~ string }
|
782
|
+
end
|
783
|
+
end
|
784
|
+
|
785
|
+
# Just for minitest compatibility. :<
|
786
|
+
#
|
787
|
+
# @since 2.5.3
|
788
|
+
alias_method :refute_match, :assert_not_match
|
789
|
+
|
790
|
+
##
|
791
|
+
# @deprecated Use {#assert_not_match} instead.
|
792
|
+
#
|
793
|
+
# Passes if `regexp` !~ `string`
|
794
|
+
#
|
795
|
+
# @example
|
796
|
+
# assert_no_match(/two/, 'one 2 three') # -> pass
|
797
|
+
# assert_no_match(/three/, 'one 2 three') # -> fail
|
798
|
+
def assert_no_match(regexp, string, message="")
|
799
|
+
_wrap_assertion do
|
800
|
+
assert_instance_of(Regexp, regexp,
|
801
|
+
"The first argument to assert_no_match " +
|
802
|
+
"should be a Regexp.")
|
803
|
+
assert_not_match(regexp, string, message)
|
804
|
+
end
|
805
|
+
end
|
806
|
+
|
807
|
+
# @private
|
808
|
+
class ThrowTagExtractor
|
809
|
+
@@have_uncaught_throw_error = const_defined?(:UncaughtThrowError)
|
810
|
+
|
811
|
+
UncaughtThrowPatterns = {
|
812
|
+
NameError => /^uncaught throw `(.+)'$/,
|
813
|
+
ArgumentError => /^uncaught throw (`.+'|.+)$/,
|
814
|
+
ThreadError => /^uncaught throw `(.+)' in thread /,
|
815
|
+
}
|
816
|
+
|
817
|
+
def initialize(error)
|
818
|
+
@error = error
|
819
|
+
end
|
820
|
+
|
821
|
+
def extract_tag
|
822
|
+
tag = nil
|
823
|
+
if @@have_uncaught_throw_error
|
824
|
+
return nil unless @error.is_a?(UncaughtThrowError)
|
825
|
+
tag = @error.tag
|
826
|
+
else
|
827
|
+
pattern = UncaughtThrowPatterns[@error.class]
|
828
|
+
return nil if pattern.nil?
|
829
|
+
return nil unless pattern =~ @error.message
|
830
|
+
tag = $1
|
831
|
+
end
|
832
|
+
normalize_tag(tag)
|
833
|
+
end
|
834
|
+
|
835
|
+
private
|
836
|
+
def normalize_tag(tag)
|
837
|
+
case tag
|
838
|
+
when /\A:/
|
839
|
+
tag[1..-1].intern
|
840
|
+
when /\A`(.+)'\z/
|
841
|
+
$1.intern
|
842
|
+
when String
|
843
|
+
tag.intern
|
844
|
+
else
|
845
|
+
tag
|
846
|
+
end
|
847
|
+
end
|
848
|
+
end
|
849
|
+
|
850
|
+
##
|
851
|
+
# Passes if the block throws `expected_object`
|
852
|
+
#
|
853
|
+
# @example
|
854
|
+
# assert_throw(:done) do
|
855
|
+
# throw(:done)
|
856
|
+
# end
|
857
|
+
def assert_throw(expected_object, message=nil, &proc)
|
858
|
+
_wrap_assertion do
|
859
|
+
begin
|
860
|
+
catch([]) {}
|
861
|
+
rescue TypeError
|
862
|
+
assert_instance_of(Symbol, expected_object,
|
863
|
+
"assert_throws expects the symbol that should be thrown for its first argument")
|
864
|
+
end
|
865
|
+
assert_block("Should have passed a block to assert_throw.") do
|
866
|
+
block_given?
|
867
|
+
end
|
868
|
+
caught = true
|
869
|
+
begin
|
870
|
+
catch(expected_object) do
|
871
|
+
proc.call
|
872
|
+
caught = false
|
873
|
+
end
|
874
|
+
full_message = build_message(message,
|
875
|
+
"<?> should have been thrown.",
|
876
|
+
expected_object)
|
877
|
+
assert_block(full_message) {caught}
|
878
|
+
rescue => error
|
879
|
+
extractor = ThrowTagExtractor.new(error)
|
880
|
+
tag = extractor.extract_tag
|
881
|
+
raise if tag.nil?
|
882
|
+
full_message = build_message(message,
|
883
|
+
"<?> was expected to be thrown but\n" +
|
884
|
+
"<?> was thrown.",
|
885
|
+
expected_object, tag)
|
886
|
+
flunk(full_message)
|
887
|
+
end
|
888
|
+
end
|
889
|
+
end
|
890
|
+
|
891
|
+
# Just for minitest compatibility. :<
|
892
|
+
#
|
893
|
+
# @since 2.5.3
|
894
|
+
alias_method :assert_throws, :assert_throw
|
895
|
+
|
896
|
+
##
|
897
|
+
# Passes if block does not throw anything.
|
898
|
+
#
|
899
|
+
# @example
|
900
|
+
# assert_nothing_thrown do
|
901
|
+
# [1, 2].uniq
|
902
|
+
# end
|
903
|
+
def assert_nothing_thrown(message=nil, &proc)
|
904
|
+
_wrap_assertion do
|
905
|
+
assert(block_given?, "Should have passed a block to assert_nothing_thrown")
|
906
|
+
begin
|
907
|
+
proc.call
|
908
|
+
rescue => error
|
909
|
+
extractor = ThrowTagExtractor.new(error)
|
910
|
+
tag = extractor.extract_tag
|
911
|
+
raise if tag.nil?
|
912
|
+
full_message = build_message(message,
|
913
|
+
"<?> was thrown when nothing was expected",
|
914
|
+
tag)
|
915
|
+
flunk(full_message)
|
916
|
+
end
|
917
|
+
assert(true, "Expected nothing to be thrown")
|
918
|
+
end
|
919
|
+
end
|
920
|
+
|
921
|
+
##
|
922
|
+
# Passes if `expected_float` and `actual_float` are equal
|
923
|
+
# within `delta` tolerance.
|
924
|
+
#
|
925
|
+
# @example
|
926
|
+
# assert_in_delta 0.05, (50000.0 / 10**6), 0.00001
|
927
|
+
def assert_in_delta(expected_float, actual_float, delta=0.001, message="")
|
928
|
+
_wrap_assertion do
|
929
|
+
begin
|
930
|
+
pass = delta >= (expected_float - actual_float).abs
|
931
|
+
assert_operator(delta, :>=, 0.0, "The delta should not be negative")
|
932
|
+
full_message = _assert_in_delta_message(expected_float,
|
933
|
+
expected_float,
|
934
|
+
actual_float,
|
935
|
+
actual_float,
|
936
|
+
delta,
|
937
|
+
delta,
|
938
|
+
message)
|
939
|
+
rescue Test::Unit::AssertionFailedError
|
940
|
+
# for the above assert_operator
|
941
|
+
raise
|
942
|
+
rescue
|
943
|
+
_assert_in_delta_validate_arguments(expected_float,
|
944
|
+
actual_float,
|
945
|
+
delta)
|
946
|
+
normalized_expected = expected_float.to_f
|
947
|
+
normalized_actual = actual_float.to_f
|
948
|
+
normalized_delta = delta.to_f
|
949
|
+
pass = (normalized_expected - normalized_actual).abs <= normalized_delta
|
950
|
+
full_message = _assert_in_delta_message(expected_float,
|
951
|
+
normalized_expected,
|
952
|
+
actual_float,
|
953
|
+
normalized_actual,
|
954
|
+
delta,
|
955
|
+
normalized_delta,
|
956
|
+
message)
|
957
|
+
end
|
958
|
+
assert_block(full_message) do
|
959
|
+
pass
|
960
|
+
end
|
961
|
+
end
|
962
|
+
end
|
963
|
+
|
964
|
+
##
|
965
|
+
# Passes if `expected_float` and `actual_float` are
|
966
|
+
# not equal within `delta` tolerance.
|
967
|
+
#
|
968
|
+
# @example
|
969
|
+
# assert_not_in_delta(0.05, (50000.0 / 10**6), 0.00002) # -> pass
|
970
|
+
# assert_not_in_delta(0.05, (50000.0 / 10**6), 0.00001) # -> fail
|
971
|
+
def assert_not_in_delta(expected_float, actual_float, delta=0.001, message="")
|
972
|
+
_wrap_assertion do
|
973
|
+
_assert_in_delta_validate_arguments(expected_float,
|
974
|
+
actual_float,
|
975
|
+
delta)
|
976
|
+
begin
|
977
|
+
pass = (expected_float - actual_float).abs > delta
|
978
|
+
full_message = _assert_in_delta_message(expected_float,
|
979
|
+
expected_float,
|
980
|
+
actual_float,
|
981
|
+
actual_float,
|
982
|
+
delta,
|
983
|
+
delta,
|
984
|
+
message,
|
985
|
+
:negative_assertion => true)
|
986
|
+
rescue
|
987
|
+
normalized_expected = expected_float.to_f
|
988
|
+
normalized_actual = actual_float.to_f
|
989
|
+
normalized_delta = delta.to_f
|
990
|
+
pass = (normalized_expected - normalized_actual).abs > normalized_delta
|
991
|
+
full_message = _assert_in_delta_message(expected_float,
|
992
|
+
normalized_expected,
|
993
|
+
actual_float,
|
994
|
+
normalized_actual,
|
995
|
+
delta,
|
996
|
+
normalized_delta,
|
997
|
+
message,
|
998
|
+
:negative_assertion => true)
|
999
|
+
end
|
1000
|
+
assert_block(full_message) do
|
1001
|
+
pass
|
1002
|
+
end
|
1003
|
+
end
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
# Just for minitest compatibility. :<
|
1007
|
+
#
|
1008
|
+
# @since 2.5.3
|
1009
|
+
alias_method :refute_in_delta, :assert_not_in_delta
|
1010
|
+
|
1011
|
+
private
|
1012
|
+
def _assert_in_delta_validate_arguments(expected_float,
|
1013
|
+
actual_float,
|
1014
|
+
delta)
|
1015
|
+
{
|
1016
|
+
expected_float => "first float",
|
1017
|
+
actual_float => "second float",
|
1018
|
+
delta => "delta"
|
1019
|
+
}.each do |float, name|
|
1020
|
+
assert_respond_to(float, :to_f,
|
1021
|
+
"The arguments must respond to to_f; " +
|
1022
|
+
"the #{name} did not")
|
1023
|
+
end
|
1024
|
+
delta = delta.to_f
|
1025
|
+
assert_operator(delta, :>=, 0.0, "The delta should not be negative")
|
1026
|
+
end
|
1027
|
+
|
1028
|
+
def _assert_in_delta_message(expected_float, normalized_expected,
|
1029
|
+
actual_float, normalized_actual,
|
1030
|
+
delta, normalized_delta,
|
1031
|
+
message, options={})
|
1032
|
+
if options[:negative_assertion]
|
1033
|
+
format = <<-EOT
|
1034
|
+
<?> -/+ <?> was expected to not include
|
1035
|
+
<?>.
|
1036
|
+
EOT
|
1037
|
+
else
|
1038
|
+
format = <<-EOT
|
1039
|
+
<?> -/+ <?> was expected to include
|
1040
|
+
<?>.
|
1041
|
+
EOT
|
1042
|
+
end
|
1043
|
+
arguments = [expected_float, delta, actual_float]
|
1044
|
+
relation_format = nil
|
1045
|
+
relation_arguments = nil
|
1046
|
+
if normalized_actual < normalized_expected - normalized_delta
|
1047
|
+
relation_format = "<<?> < <?>-<?>[?] <= <?>+<?>[?]>"
|
1048
|
+
relation_arguments = [actual_float,
|
1049
|
+
expected_float, delta,
|
1050
|
+
normalized_expected - normalized_delta,
|
1051
|
+
expected_float, delta,
|
1052
|
+
normalized_expected + normalized_delta]
|
1053
|
+
elsif normalized_actual <= normalized_expected + normalized_delta
|
1054
|
+
relation_format = "<<?>-<?>[?] <= <?> <= <?>+<?>[?]>"
|
1055
|
+
relation_arguments = [expected_float, delta,
|
1056
|
+
normalized_expected - normalized_delta,
|
1057
|
+
actual_float,
|
1058
|
+
expected_float, delta,
|
1059
|
+
normalized_expected + normalized_delta]
|
1060
|
+
else
|
1061
|
+
relation_format = "<<?>-<?>[?] <= <?>+<?>[?] < <?>>"
|
1062
|
+
relation_arguments = [expected_float, delta,
|
1063
|
+
normalized_expected - normalized_delta,
|
1064
|
+
expected_float, delta,
|
1065
|
+
normalized_expected + normalized_delta,
|
1066
|
+
actual_float]
|
1067
|
+
end
|
1068
|
+
|
1069
|
+
if relation_format
|
1070
|
+
format += <<-EOT
|
1071
|
+
|
1072
|
+
Relation:
|
1073
|
+
#{relation_format}
|
1074
|
+
EOT
|
1075
|
+
arguments.concat(relation_arguments)
|
1076
|
+
end
|
1077
|
+
|
1078
|
+
build_message(message, format, *arguments)
|
1079
|
+
end
|
1080
|
+
|
1081
|
+
public
|
1082
|
+
##
|
1083
|
+
# Passes if `expected_float` and `actual_float` are equal
|
1084
|
+
# within `epsilon` relative error of `expected_float`.
|
1085
|
+
#
|
1086
|
+
# @example
|
1087
|
+
# assert_in_epsilon(10000.0, 9900.0, 0.1) # -> pass
|
1088
|
+
# assert_in_epsilon(10000.0, 9899.0, 0.1) # -> fail
|
1089
|
+
def assert_in_epsilon(expected_float, actual_float, epsilon=0.001,
|
1090
|
+
message="")
|
1091
|
+
_wrap_assertion do
|
1092
|
+
begin
|
1093
|
+
zero_p = expected_float.zero? rescue expected_float == 0
|
1094
|
+
if zero_p
|
1095
|
+
delta = epsilon ** 2
|
1096
|
+
else
|
1097
|
+
delta = expected_float * epsilon
|
1098
|
+
end
|
1099
|
+
delta = delta.abs
|
1100
|
+
pass = (expected_float - actual_float).abs <= delta
|
1101
|
+
assert_operator(epsilon, :>=, 0.0, "The epsilon should not be negative")
|
1102
|
+
full_message = _assert_in_epsilon_message(expected_float,
|
1103
|
+
expected_float,
|
1104
|
+
actual_float,
|
1105
|
+
actual_float,
|
1106
|
+
epsilon,
|
1107
|
+
epsilon,
|
1108
|
+
delta,
|
1109
|
+
message)
|
1110
|
+
rescue Test::Unit::AssertionFailedError
|
1111
|
+
# for the above assert_operator
|
1112
|
+
raise
|
1113
|
+
rescue
|
1114
|
+
_assert_in_epsilon_validate_arguments(expected_float,
|
1115
|
+
actual_float,
|
1116
|
+
epsilon)
|
1117
|
+
normalized_expected = expected_float.to_f
|
1118
|
+
normalized_actual = actual_float.to_f
|
1119
|
+
normalized_epsilon = epsilon.to_f
|
1120
|
+
if normalized_expected.zero?
|
1121
|
+
delta = normalized_epsilon ** 2
|
1122
|
+
else
|
1123
|
+
delta = normalized_expected * normalized_epsilon
|
1124
|
+
end
|
1125
|
+
delta = delta.abs
|
1126
|
+
full_message = _assert_in_epsilon_message(expected_float,
|
1127
|
+
normalized_expected,
|
1128
|
+
actual_float,
|
1129
|
+
normalized_actual,
|
1130
|
+
epsilon,
|
1131
|
+
normalized_epsilon,
|
1132
|
+
delta,
|
1133
|
+
message)
|
1134
|
+
pass = (normalized_expected - normalized_actual).abs <= delta
|
1135
|
+
end
|
1136
|
+
assert_block(full_message) do
|
1137
|
+
pass
|
1138
|
+
end
|
1139
|
+
end
|
1140
|
+
end
|
1141
|
+
|
1142
|
+
##
|
1143
|
+
# Passes if `expected_float` and `actual_float` are
|
1144
|
+
# not equal within `epsilon` relative error of
|
1145
|
+
# `expected_float`.
|
1146
|
+
#
|
1147
|
+
# @example
|
1148
|
+
# assert_not_in_epsilon(10000.0, 9900.0, 0.1) # -> fail
|
1149
|
+
# assert_not_in_epsilon(10000.0, 9899.0, 0.1) # -> pass
|
1150
|
+
def assert_not_in_epsilon(expected_float, actual_float, epsilon=0.001,
|
1151
|
+
message="")
|
1152
|
+
_wrap_assertion do
|
1153
|
+
begin
|
1154
|
+
delta = expected_float * epsilon
|
1155
|
+
pass = (expected_float - actual_float).abs > delta
|
1156
|
+
assert_operator(epsilon, :>=, 0.0, "The epsilon should not be negative")
|
1157
|
+
full_message = _assert_in_epsilon_message(expected_float,
|
1158
|
+
expected_float,
|
1159
|
+
actual_float,
|
1160
|
+
actual_float,
|
1161
|
+
epsilon,
|
1162
|
+
epsilon,
|
1163
|
+
delta,
|
1164
|
+
message,
|
1165
|
+
:negative_assertion => true)
|
1166
|
+
rescue Test::Unit::AssertionFailedError
|
1167
|
+
# for the above assert_operator
|
1168
|
+
raise
|
1169
|
+
rescue
|
1170
|
+
_assert_in_epsilon_validate_arguments(expected_float,
|
1171
|
+
actual_float,
|
1172
|
+
epsilon)
|
1173
|
+
normalized_expected = expected_float.to_f
|
1174
|
+
normalized_actual = actual_float.to_f
|
1175
|
+
normalized_epsilon = epsilon.to_f
|
1176
|
+
delta = normalized_expected * normalized_epsilon
|
1177
|
+
pass = (normalized_expected - normalized_actual).abs > delta
|
1178
|
+
full_message = _assert_in_epsilon_message(expected_float,
|
1179
|
+
normalized_expected,
|
1180
|
+
actual_float,
|
1181
|
+
normalized_actual,
|
1182
|
+
epsilon,
|
1183
|
+
normalized_epsilon,
|
1184
|
+
delta,
|
1185
|
+
message,
|
1186
|
+
:negative_assertion => true)
|
1187
|
+
end
|
1188
|
+
assert_block(full_message) do
|
1189
|
+
pass
|
1190
|
+
end
|
1191
|
+
end
|
1192
|
+
end
|
1193
|
+
|
1194
|
+
# Just for minitest compatibility. :<
|
1195
|
+
#
|
1196
|
+
# @since 3.0.0
|
1197
|
+
alias_method :refute_in_epsilon, :assert_not_in_epsilon
|
1198
|
+
|
1199
|
+
private
|
1200
|
+
def _assert_in_epsilon_validate_arguments(expected_float,
|
1201
|
+
actual_float,
|
1202
|
+
epsilon)
|
1203
|
+
{
|
1204
|
+
expected_float => "first float",
|
1205
|
+
actual_float => "second float",
|
1206
|
+
epsilon => "epsilon"
|
1207
|
+
}.each do |float, name|
|
1208
|
+
assert_respond_to(float, :to_f,
|
1209
|
+
"The arguments must respond to to_f; " +
|
1210
|
+
"the #{name} did not")
|
1211
|
+
end
|
1212
|
+
epsilon = epsilon.to_f
|
1213
|
+
assert_operator(epsilon, :>=, 0.0, "The epsilon should not be negative")
|
1214
|
+
end
|
1215
|
+
|
1216
|
+
def _assert_in_epsilon_message(expected_float, normalized_expected,
|
1217
|
+
actual_float, normalized_actual,
|
1218
|
+
epsilon, normalized_epsilon,
|
1219
|
+
delta, message, options={})
|
1220
|
+
if options[:negative_assertion]
|
1221
|
+
format = <<-EOT
|
1222
|
+
<?> -/+ (<?> * <?>)[?] was expected to not include
|
1223
|
+
<?>.
|
1224
|
+
EOT
|
1225
|
+
else
|
1226
|
+
format = <<-EOT
|
1227
|
+
<?> -/+ (<?> * <?>)[?] was expected to include
|
1228
|
+
<?>.
|
1229
|
+
EOT
|
1230
|
+
end
|
1231
|
+
arguments = [expected_float, expected_float, epsilon, delta,
|
1232
|
+
actual_float]
|
1233
|
+
|
1234
|
+
relation_format = nil
|
1235
|
+
relation_arguments = nil
|
1236
|
+
if normalized_actual < normalized_expected - delta
|
1237
|
+
relation_format = "<<?> < <?>-(<?>*<?>)[?] <= <?>+(<?>*<?>)[?]>"
|
1238
|
+
relation_arguments = [actual_float,
|
1239
|
+
expected_float, expected_float, epsilon,
|
1240
|
+
normalized_expected - delta,
|
1241
|
+
expected_float, expected_float, epsilon,
|
1242
|
+
normalized_expected + delta]
|
1243
|
+
elsif normalized_actual <= normalized_expected + delta
|
1244
|
+
relation_format = "<<?>-(<?>*<?>)[?] <= <?> <= <?>+(<?>*<?>)[?]>"
|
1245
|
+
relation_arguments = [expected_float, expected_float, epsilon,
|
1246
|
+
normalized_expected - delta,
|
1247
|
+
actual_float,
|
1248
|
+
expected_float, expected_float, epsilon,
|
1249
|
+
normalized_expected + delta]
|
1250
|
+
else
|
1251
|
+
relation_format = "<<?>-(<?>*<?>)[?] <= <?>+(<?>*<?>)[?] < <?>>"
|
1252
|
+
relation_arguments = [expected_float, expected_float, epsilon,
|
1253
|
+
normalized_expected - delta,
|
1254
|
+
expected_float, expected_float, epsilon,
|
1255
|
+
normalized_expected + delta,
|
1256
|
+
actual_float]
|
1257
|
+
end
|
1258
|
+
|
1259
|
+
if relation_format
|
1260
|
+
format += <<-EOT
|
1261
|
+
|
1262
|
+
Relation:
|
1263
|
+
#{relation_format}
|
1264
|
+
EOT
|
1265
|
+
arguments.concat(relation_arguments)
|
1266
|
+
end
|
1267
|
+
|
1268
|
+
build_message(message, format, *arguments)
|
1269
|
+
end
|
1270
|
+
|
1271
|
+
public
|
1272
|
+
##
|
1273
|
+
# Passes if the method `__send__` returns not false nor nil.
|
1274
|
+
#
|
1275
|
+
# `send_array` is composed of:
|
1276
|
+
# * A receiver
|
1277
|
+
# * A method
|
1278
|
+
# * Arguments to the method
|
1279
|
+
#
|
1280
|
+
# @example
|
1281
|
+
# assert_send([[1, 2], :member?, 1]) # -> pass
|
1282
|
+
# assert_send([[1, 2], :member?, 4]) # -> fail
|
1283
|
+
def assert_send(send_array, message=nil)
|
1284
|
+
_wrap_assertion do
|
1285
|
+
assert_instance_of(Array, send_array,
|
1286
|
+
"assert_send requires an array " +
|
1287
|
+
"of send information")
|
1288
|
+
assert_operator(send_array.size, :>=, 2,
|
1289
|
+
"assert_send requires at least a receiver " +
|
1290
|
+
"and a message name")
|
1291
|
+
format = <<EOT
|
1292
|
+
<?> was expected to respond to
|
1293
|
+
<?(*?)> with a true value but was
|
1294
|
+
<?>.
|
1295
|
+
EOT
|
1296
|
+
receiver, message_name, *arguments = send_array
|
1297
|
+
result = nil
|
1298
|
+
full_message =
|
1299
|
+
build_message(message,
|
1300
|
+
format,
|
1301
|
+
receiver,
|
1302
|
+
AssertionMessage.literal(message_name.to_s),
|
1303
|
+
arguments,
|
1304
|
+
AssertionMessage.delayed_literal {result})
|
1305
|
+
assert_block(full_message) do
|
1306
|
+
result = receiver.__send__(message_name, *arguments)
|
1307
|
+
result
|
1308
|
+
end
|
1309
|
+
end
|
1310
|
+
end
|
1311
|
+
|
1312
|
+
##
|
1313
|
+
# Passes if the method `__send__` returns false or nil.
|
1314
|
+
#
|
1315
|
+
# `send_array` is composed of:
|
1316
|
+
# * A receiver
|
1317
|
+
# * A method
|
1318
|
+
# * Arguments to the method
|
1319
|
+
#
|
1320
|
+
# @example
|
1321
|
+
# assert_not_send([[1, 2], :member?, 1]) # -> fail
|
1322
|
+
# assert_not_send([[1, 2], :member?, 4]) # -> pass
|
1323
|
+
def assert_not_send(send_array, message=nil)
|
1324
|
+
_wrap_assertion do
|
1325
|
+
assert_instance_of(Array, send_array,
|
1326
|
+
"assert_not_send requires an array " +
|
1327
|
+
"of send information")
|
1328
|
+
assert_operator(send_array.size, :>=, 2,
|
1329
|
+
"assert_not_send requires at least a receiver " +
|
1330
|
+
"and a message name")
|
1331
|
+
format = <<EOT
|
1332
|
+
<?> was expected to respond to
|
1333
|
+
<?(*?)> with not a true value but was
|
1334
|
+
<?>.
|
1335
|
+
EOT
|
1336
|
+
receiver, message_name, *arguments = send_array
|
1337
|
+
result = nil
|
1338
|
+
full_message =
|
1339
|
+
build_message(message,
|
1340
|
+
format,
|
1341
|
+
receiver,
|
1342
|
+
AssertionMessage.literal(message_name.to_s),
|
1343
|
+
arguments,
|
1344
|
+
AssertionMessage.delayed_literal {result})
|
1345
|
+
assert_block(full_message) do
|
1346
|
+
result = receiver.__send__(message_name, *arguments)
|
1347
|
+
not result
|
1348
|
+
end
|
1349
|
+
end
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
##
|
1353
|
+
# Passes if `actual` is a boolean value.
|
1354
|
+
#
|
1355
|
+
# @example
|
1356
|
+
# assert_boolean(true) # -> pass
|
1357
|
+
# assert_boolean(nil) # -> fail
|
1358
|
+
def assert_boolean(actual, message=nil)
|
1359
|
+
_wrap_assertion do
|
1360
|
+
assert_block(build_message(message,
|
1361
|
+
"<true> or <false> expected but was\n<?>",
|
1362
|
+
actual)) do
|
1363
|
+
true == actual || false == actual
|
1364
|
+
end
|
1365
|
+
end
|
1366
|
+
end
|
1367
|
+
|
1368
|
+
##
|
1369
|
+
# Passes if `actual` is true.
|
1370
|
+
#
|
1371
|
+
# @example
|
1372
|
+
# assert_true(true) # -> pass
|
1373
|
+
# assert_true(:true) # -> fail
|
1374
|
+
def assert_true(actual, message=nil)
|
1375
|
+
_wrap_assertion do
|
1376
|
+
assert_block(build_message(message,
|
1377
|
+
"<true> expected but was\n<?>",
|
1378
|
+
actual)) do
|
1379
|
+
true == actual
|
1380
|
+
end
|
1381
|
+
end
|
1382
|
+
end
|
1383
|
+
|
1384
|
+
##
|
1385
|
+
# Passes if `actual` is false.
|
1386
|
+
#
|
1387
|
+
# @example
|
1388
|
+
# assert_false(false) # -> pass
|
1389
|
+
# assert_false(nil) # -> fail
|
1390
|
+
def assert_false(actual, message=nil)
|
1391
|
+
_wrap_assertion do
|
1392
|
+
assert_block(build_message(message,
|
1393
|
+
"<false> expected but was\n<?>",
|
1394
|
+
actual)) do
|
1395
|
+
false == actual
|
1396
|
+
end
|
1397
|
+
end
|
1398
|
+
end
|
1399
|
+
|
1400
|
+
##
|
1401
|
+
# Passes if expression "`expected` `operator`
|
1402
|
+
# `actual`" is not false nor nil.
|
1403
|
+
#
|
1404
|
+
# @example
|
1405
|
+
# assert_compare(1, "<", 10) # -> pass
|
1406
|
+
# assert_compare(1, ">=", 10) # -> fail
|
1407
|
+
def assert_compare(expected, operator, actual, message=nil)
|
1408
|
+
_wrap_assertion do
|
1409
|
+
assert_send([["<", "<=", ">", ">="], :include?, operator.to_s])
|
1410
|
+
case operator.to_s
|
1411
|
+
when "<"
|
1412
|
+
operator_description = "less than"
|
1413
|
+
when "<="
|
1414
|
+
operator_description = "less than or equal to"
|
1415
|
+
when ">"
|
1416
|
+
operator_description = "greater than"
|
1417
|
+
when ">="
|
1418
|
+
operator_description = "greater than or equal to"
|
1419
|
+
end
|
1420
|
+
template = <<-EOT
|
1421
|
+
<?> #{operator} <?> should be true
|
1422
|
+
<?> was expected to be #{operator_description}
|
1423
|
+
<?>.
|
1424
|
+
EOT
|
1425
|
+
full_message = build_message(message, template,
|
1426
|
+
expected, actual,
|
1427
|
+
expected, actual)
|
1428
|
+
assert_block(full_message) do
|
1429
|
+
expected.__send__(operator, actual)
|
1430
|
+
end
|
1431
|
+
end
|
1432
|
+
end
|
1433
|
+
|
1434
|
+
##
|
1435
|
+
# Passes if assertion is failed in block.
|
1436
|
+
#
|
1437
|
+
# @example
|
1438
|
+
# assert_fail_assertion {assert_equal("A", "B")} # -> pass
|
1439
|
+
# assert_fail_assertion {assert_equal("A", "A")} # -> fail
|
1440
|
+
def assert_fail_assertion(message=nil)
|
1441
|
+
_wrap_assertion do
|
1442
|
+
full_message = build_message(message,
|
1443
|
+
"Failed assertion was expected.")
|
1444
|
+
assert_block(full_message) do
|
1445
|
+
begin
|
1446
|
+
yield
|
1447
|
+
false
|
1448
|
+
rescue AssertionFailedError
|
1449
|
+
true
|
1450
|
+
end
|
1451
|
+
end
|
1452
|
+
end
|
1453
|
+
end
|
1454
|
+
|
1455
|
+
##
|
1456
|
+
# Passes if an exception is raised in block and its
|
1457
|
+
# message is `expected`.
|
1458
|
+
#
|
1459
|
+
# @example
|
1460
|
+
# assert_raise_message("exception") {raise "exception"} # -> pass
|
1461
|
+
# assert_raise_message(/exc/i) {raise "exception"} # -> pass
|
1462
|
+
# assert_raise_message("exception") {raise "EXCEPTION"} # -> fail
|
1463
|
+
# assert_raise_message("exception") {} # -> fail
|
1464
|
+
def assert_raise_message(expected, message=nil)
|
1465
|
+
_wrap_assertion do
|
1466
|
+
full_message = build_message(message,
|
1467
|
+
"<?> exception message was expected " +
|
1468
|
+
"but none was thrown.",
|
1469
|
+
expected)
|
1470
|
+
exception = nil
|
1471
|
+
assert_block(full_message) do
|
1472
|
+
begin
|
1473
|
+
yield
|
1474
|
+
false
|
1475
|
+
rescue Exception => exception
|
1476
|
+
true
|
1477
|
+
end
|
1478
|
+
end
|
1479
|
+
|
1480
|
+
actual = exception.message
|
1481
|
+
diff = AssertionMessage.delayed_diff(expected, actual)
|
1482
|
+
full_message =
|
1483
|
+
build_message(message,
|
1484
|
+
"<?> exception message expected but was\n" +
|
1485
|
+
"<?>.?", expected, actual, diff)
|
1486
|
+
assert_block(full_message) do
|
1487
|
+
if expected.is_a?(Regexp)
|
1488
|
+
expected =~ actual
|
1489
|
+
else
|
1490
|
+
expected == actual
|
1491
|
+
end
|
1492
|
+
end
|
1493
|
+
end
|
1494
|
+
end
|
1495
|
+
|
1496
|
+
##
|
1497
|
+
# Passes if `object`.const_defined?(`constant_name`)
|
1498
|
+
#
|
1499
|
+
# @example
|
1500
|
+
# assert_const_defined(Test, :Unit) # -> pass
|
1501
|
+
# assert_const_defined(Object, :Nonexistent) # -> fail
|
1502
|
+
def assert_const_defined(object, constant_name, message=nil)
|
1503
|
+
_wrap_assertion do
|
1504
|
+
full_message = build_message(message,
|
1505
|
+
"<?>.const_defined\\?(<?>) expected.",
|
1506
|
+
object, constant_name)
|
1507
|
+
assert_block(full_message) do
|
1508
|
+
object.const_defined?(constant_name)
|
1509
|
+
end
|
1510
|
+
end
|
1511
|
+
end
|
1512
|
+
|
1513
|
+
##
|
1514
|
+
# Passes if !`object`.const_defined?(`constant_name`)
|
1515
|
+
#
|
1516
|
+
# @example
|
1517
|
+
# assert_not_const_defined(Object, :Nonexistent) # -> pass
|
1518
|
+
# assert_not_const_defined(Test, :Unit) # -> fail
|
1519
|
+
def assert_not_const_defined(object, constant_name, message=nil)
|
1520
|
+
_wrap_assertion do
|
1521
|
+
full_message = build_message(message,
|
1522
|
+
"!<?>.const_defined\\?(<?>) expected.",
|
1523
|
+
object, constant_name)
|
1524
|
+
assert_block(full_message) do
|
1525
|
+
!object.const_defined?(constant_name)
|
1526
|
+
end
|
1527
|
+
end
|
1528
|
+
end
|
1529
|
+
|
1530
|
+
##
|
1531
|
+
# Passes if `object`.`predicate` is not false nor nil.
|
1532
|
+
#
|
1533
|
+
# @example
|
1534
|
+
# assert_predicate([], :empty?) # -> pass
|
1535
|
+
# assert_predicate([1], :empty?) # -> fail
|
1536
|
+
def assert_predicate(object, predicate, message=nil)
|
1537
|
+
_wrap_assertion do
|
1538
|
+
assert_respond_to(object, predicate, message)
|
1539
|
+
actual = object.__send__(predicate)
|
1540
|
+
full_message = build_message(message,
|
1541
|
+
"<?>.? is true value expected but was\n" +
|
1542
|
+
"<?>",
|
1543
|
+
object,
|
1544
|
+
AssertionMessage.literal(predicate),
|
1545
|
+
actual)
|
1546
|
+
assert_block(full_message) do
|
1547
|
+
actual
|
1548
|
+
end
|
1549
|
+
end
|
1550
|
+
end
|
1551
|
+
|
1552
|
+
##
|
1553
|
+
# Passes if `object`.`predicate` is false or nil.
|
1554
|
+
#
|
1555
|
+
# @example
|
1556
|
+
# assert_not_predicate([1], :empty?) # -> pass
|
1557
|
+
# assert_not_predicate([], :empty?) # -> fail
|
1558
|
+
def assert_not_predicate(object, predicate, message=nil)
|
1559
|
+
_wrap_assertion do
|
1560
|
+
assert_respond_to(object, predicate, message)
|
1561
|
+
actual = object.__send__(predicate)
|
1562
|
+
full_message = build_message(message,
|
1563
|
+
"<?>.? is false value expected but was\n" +
|
1564
|
+
"<?>",
|
1565
|
+
object,
|
1566
|
+
AssertionMessage.literal(predicate),
|
1567
|
+
actual)
|
1568
|
+
assert_block(full_message) do
|
1569
|
+
not actual
|
1570
|
+
end
|
1571
|
+
end
|
1572
|
+
end
|
1573
|
+
|
1574
|
+
# Just for minitest compatibility. :<
|
1575
|
+
#
|
1576
|
+
# @since 3.0.0
|
1577
|
+
alias_method :refute_predicate, :assert_not_predicate
|
1578
|
+
|
1579
|
+
##
|
1580
|
+
# Passes if `object`#`alias_name` is an alias method of
|
1581
|
+
# `object`#`original_name`.
|
1582
|
+
#
|
1583
|
+
# @example
|
1584
|
+
# assert_alias_method([], :length, :size) # -> pass
|
1585
|
+
# assert_alias_method([], :size, :length) # -> pass
|
1586
|
+
# assert_alias_method([], :each, :size) # -> fail
|
1587
|
+
def assert_alias_method(object, alias_name, original_name, message=nil)
|
1588
|
+
_wrap_assertion do
|
1589
|
+
find_method_failure_message = Proc.new do |method_name|
|
1590
|
+
build_message(message,
|
1591
|
+
"<?>.? doesn't exist\n" +
|
1592
|
+
"(Class: <?>)",
|
1593
|
+
object,
|
1594
|
+
AssertionMessage.literal(method_name),
|
1595
|
+
object.class)
|
1596
|
+
end
|
1597
|
+
|
1598
|
+
alias_method = original_method = nil
|
1599
|
+
assert_block(find_method_failure_message.call(alias_name)) do
|
1600
|
+
begin
|
1601
|
+
alias_method = object.method(alias_name)
|
1602
|
+
true
|
1603
|
+
rescue NameError
|
1604
|
+
false
|
1605
|
+
end
|
1606
|
+
end
|
1607
|
+
assert_block(find_method_failure_message.call(original_name)) do
|
1608
|
+
begin
|
1609
|
+
original_method = object.method(original_name)
|
1610
|
+
true
|
1611
|
+
rescue NameError
|
1612
|
+
false
|
1613
|
+
end
|
1614
|
+
end
|
1615
|
+
|
1616
|
+
full_message = build_message(message,
|
1617
|
+
"<?> is alias of\n" +
|
1618
|
+
"<?> expected",
|
1619
|
+
alias_method,
|
1620
|
+
original_method)
|
1621
|
+
assert_block(full_message) do
|
1622
|
+
alias_method == original_method
|
1623
|
+
end
|
1624
|
+
end
|
1625
|
+
end
|
1626
|
+
|
1627
|
+
##
|
1628
|
+
# Passes if `path` exists.
|
1629
|
+
#
|
1630
|
+
# @example
|
1631
|
+
# assert_path_exist("/tmp") # -> pass
|
1632
|
+
# assert_path_exist("/bin/sh") # -> pass
|
1633
|
+
# assert_path_exist("/nonexistent") # -> fail
|
1634
|
+
def assert_path_exist(path, message=nil)
|
1635
|
+
_wrap_assertion do
|
1636
|
+
failure_message = build_message(message,
|
1637
|
+
"<?> was expected to exist",
|
1638
|
+
path)
|
1639
|
+
assert_block(failure_message) do
|
1640
|
+
File.exist?(path)
|
1641
|
+
end
|
1642
|
+
end
|
1643
|
+
end
|
1644
|
+
|
1645
|
+
##
|
1646
|
+
# Passes if `path` doesn't exist.
|
1647
|
+
#
|
1648
|
+
# @example
|
1649
|
+
# assert_path_not_exist("/nonexistent") # -> pass
|
1650
|
+
# assert_path_not_exist("/tmp") # -> fail
|
1651
|
+
# assert_path_not_exist("/bin/sh") # -> fail
|
1652
|
+
def assert_path_not_exist(path, message=nil)
|
1653
|
+
_wrap_assertion do
|
1654
|
+
failure_message = build_message(message,
|
1655
|
+
"<?> was expected to not exist",
|
1656
|
+
path)
|
1657
|
+
assert_block(failure_message) do
|
1658
|
+
not File.exist?(path)
|
1659
|
+
end
|
1660
|
+
end
|
1661
|
+
end
|
1662
|
+
|
1663
|
+
##
|
1664
|
+
# Passes if `collection` includes `object`.
|
1665
|
+
#
|
1666
|
+
# @example
|
1667
|
+
# assert_include([1, 10], 1) # -> pass
|
1668
|
+
# assert_include(1..10, 5) # -> pass
|
1669
|
+
# assert_include([1, 10], 5) # -> fail
|
1670
|
+
# assert_include(1..10, 20) # -> fail
|
1671
|
+
def assert_include(collection, object, message=nil)
|
1672
|
+
_wrap_assertion do
|
1673
|
+
assert_respond_to(collection, :include?,
|
1674
|
+
"The collection must respond to :include?.")
|
1675
|
+
full_message = build_message(message,
|
1676
|
+
"<?> was expected to include\n<?>.",
|
1677
|
+
collection,
|
1678
|
+
object)
|
1679
|
+
assert_block(full_message) do
|
1680
|
+
collection.include?(object)
|
1681
|
+
end
|
1682
|
+
end
|
1683
|
+
end
|
1684
|
+
|
1685
|
+
# Just for minitest compatibility. :<
|
1686
|
+
#
|
1687
|
+
# @since 2.5.3
|
1688
|
+
alias_method :assert_includes, :assert_include
|
1689
|
+
|
1690
|
+
##
|
1691
|
+
# Passes if `collection` doesn't include `object`.
|
1692
|
+
#
|
1693
|
+
# @example
|
1694
|
+
# assert_not_include([1, 10], 5) # -> pass
|
1695
|
+
# assert_not_include(1..10, 20) # -> pass
|
1696
|
+
# assert_not_include([1, 10], 1) # -> fail
|
1697
|
+
# assert_not_include(1..10, 5) # -> fail
|
1698
|
+
def assert_not_include(collection, object, message=nil)
|
1699
|
+
_wrap_assertion do
|
1700
|
+
assert_respond_to(collection, :include?,
|
1701
|
+
"The collection must respond to :include?.")
|
1702
|
+
full_message = build_message(message,
|
1703
|
+
"<?> was expected to not include\n<?>.",
|
1704
|
+
collection,
|
1705
|
+
object)
|
1706
|
+
assert_block(full_message) do
|
1707
|
+
not collection.include?(object)
|
1708
|
+
end
|
1709
|
+
end
|
1710
|
+
end
|
1711
|
+
|
1712
|
+
# Just for minitest compatibility. :<
|
1713
|
+
#
|
1714
|
+
# @since 3.0.0
|
1715
|
+
alias_method :assert_not_includes, :assert_not_include
|
1716
|
+
|
1717
|
+
# Just for minitest compatibility. :<
|
1718
|
+
#
|
1719
|
+
# @since 3.0.0
|
1720
|
+
alias_method :refute_includes, :assert_not_include
|
1721
|
+
|
1722
|
+
##
|
1723
|
+
# Passes if `object` is empty.
|
1724
|
+
#
|
1725
|
+
# @example
|
1726
|
+
# assert_empty("") # -> pass
|
1727
|
+
# assert_empty([]) # -> pass
|
1728
|
+
# assert_empty({}) # -> pass
|
1729
|
+
# assert_empty(" ") # -> fail
|
1730
|
+
# assert_empty([nil]) # -> fail
|
1731
|
+
# assert_empty({1 => 2}) # -> fail
|
1732
|
+
def assert_empty(object, message=nil)
|
1733
|
+
_wrap_assertion do
|
1734
|
+
assert_respond_to(object, :empty?,
|
1735
|
+
"The object must respond to :empty?.")
|
1736
|
+
full_message = build_message(message,
|
1737
|
+
"<?> was expected to be empty.",
|
1738
|
+
object)
|
1739
|
+
assert_block(full_message) do
|
1740
|
+
object.empty?
|
1741
|
+
end
|
1742
|
+
end
|
1743
|
+
end
|
1744
|
+
|
1745
|
+
##
|
1746
|
+
# Passes if `object` is not empty.
|
1747
|
+
#
|
1748
|
+
# @example
|
1749
|
+
# assert_not_empty(" ") # -> pass
|
1750
|
+
# assert_not_empty([nil]) # -> pass
|
1751
|
+
# assert_not_empty({1 => 2}) # -> pass
|
1752
|
+
# assert_not_empty("") # -> fail
|
1753
|
+
# assert_not_empty([]) # -> fail
|
1754
|
+
# assert_not_empty({}) # -> fail
|
1755
|
+
def assert_not_empty(object, message=nil)
|
1756
|
+
_wrap_assertion do
|
1757
|
+
assert_respond_to(object, :empty?,
|
1758
|
+
"The object must respond to :empty?.")
|
1759
|
+
full_message = build_message(message,
|
1760
|
+
"<?> was expected to not be empty.",
|
1761
|
+
object)
|
1762
|
+
assert_block(full_message) do
|
1763
|
+
not object.empty?
|
1764
|
+
end
|
1765
|
+
end
|
1766
|
+
end
|
1767
|
+
|
1768
|
+
# Just for minitest compatibility. :<
|
1769
|
+
#
|
1770
|
+
# @since 3.0.0
|
1771
|
+
alias_method :refute_empty, :assert_not_empty
|
1772
|
+
|
1773
|
+
# @overload assert_all(collection, message=nil, &block)
|
1774
|
+
#
|
1775
|
+
# Asserts that all `block.call(item)` where `item` is each
|
1776
|
+
# item in `collection` are not false nor nil.
|
1777
|
+
#
|
1778
|
+
# If `collection` is empty, this assertion is always passed
|
1779
|
+
# with any `block`.
|
1780
|
+
#
|
1781
|
+
# @example Pass patterns
|
1782
|
+
# assert_all([1, 2, 3]) {|item| item > 0} # => pass
|
1783
|
+
# assert_all([1, 2, 3], &:positive?) # => pass
|
1784
|
+
# assert_all([]) {|item| false} # => pass
|
1785
|
+
#
|
1786
|
+
# @example Failure pattern
|
1787
|
+
# assert_all([0, 1, 2], &:zero?) # => failure
|
1788
|
+
#
|
1789
|
+
# @param [#each] collection The check target.
|
1790
|
+
# @param [String] message The additional user message. It is
|
1791
|
+
# showed when the assertion is failed.
|
1792
|
+
# @yield [Object] Give each item in `collection` to the block.
|
1793
|
+
# @yieldreturn [Object] The checked object.
|
1794
|
+
# @return [void]
|
1795
|
+
#
|
1796
|
+
# @since 3.4.4
|
1797
|
+
def assert_all(collection, message=nil)
|
1798
|
+
_wrap_assertion do
|
1799
|
+
failed = false
|
1800
|
+
result = {}
|
1801
|
+
collection.each do |item|
|
1802
|
+
element_result = yield(item)
|
1803
|
+
failed = true unless element_result
|
1804
|
+
result[item] = element_result
|
1805
|
+
end
|
1806
|
+
format = <<-FORMAT
|
1807
|
+
<?> was expected to be all true values with the given block but was
|
1808
|
+
<?>
|
1809
|
+
FORMAT
|
1810
|
+
full_message = build_message(message,
|
1811
|
+
format,
|
1812
|
+
collection,
|
1813
|
+
result)
|
1814
|
+
assert_block(full_message) do
|
1815
|
+
not failed
|
1816
|
+
end
|
1817
|
+
end
|
1818
|
+
end
|
1819
|
+
|
1820
|
+
# Just for Ruby's tool/lib/test/unit compatibility.
|
1821
|
+
#
|
1822
|
+
# @since 3.4.3
|
1823
|
+
alias_method :assert_all?, :assert_all
|
1824
|
+
|
1825
|
+
# @overload assert_nothing_leaked_memory(max_increasable_size, target=:physical, message=nil, &block)
|
1826
|
+
#
|
1827
|
+
# Asserts that increased memory usage by `block.call` is less
|
1828
|
+
# than `max_increasable_size`. `GC.start` is called before and
|
1829
|
+
# after `block.call`.
|
1830
|
+
#
|
1831
|
+
# This assertion may be fragile. Because memory usage is
|
1832
|
+
# depends on the current Ruby process's memory
|
1833
|
+
# usage. Launching a new Ruby process for this will produce
|
1834
|
+
# more stable result but we need to specify target code as
|
1835
|
+
# `String` instead of block for the approach. We choose easy
|
1836
|
+
# to write API approach rather than more stable result
|
1837
|
+
# approach for this case.
|
1838
|
+
#
|
1839
|
+
# @example Pass pattern
|
1840
|
+
# require "objspace"
|
1841
|
+
# size_per_object = ObjectSpace.memsize_of("Hello")
|
1842
|
+
# # If memory isn't leaked, physical memory of almost created objects
|
1843
|
+
# # (1000 - 10 objects) must be freed.
|
1844
|
+
# assert_nothing_leaked_memory(size_per_object * 10) do
|
1845
|
+
# 1_000.times do
|
1846
|
+
# "Hello".dup
|
1847
|
+
# end
|
1848
|
+
# end # => pass
|
1849
|
+
#
|
1850
|
+
# @example Failure pattern
|
1851
|
+
# require "objspace"
|
1852
|
+
# size_per_object = ObjectSpace.memsize_of("Hello")
|
1853
|
+
# strings = []
|
1854
|
+
# assert_nothing_leaked_memory(size_per_object * 10) do
|
1855
|
+
# 10_000.times do
|
1856
|
+
# # Created objects aren't GC-ed because they are referred.
|
1857
|
+
# strings << "Hello".dup
|
1858
|
+
# end
|
1859
|
+
# end # => failure
|
1860
|
+
#
|
1861
|
+
# @param target [:physical, :virtual] which memory usage is
|
1862
|
+
# used for comparing. `:physical` means physical memory usage
|
1863
|
+
# also known as Resident Set Size (RSS). `:virtual` means
|
1864
|
+
# virtual memory usage.
|
1865
|
+
# @yield [] do anything you want to measure memory usage
|
1866
|
+
# in the block.
|
1867
|
+
# @yieldreturn [void]
|
1868
|
+
# @return [void]
|
1869
|
+
#
|
1870
|
+
# @since 3.4.5
|
1871
|
+
def assert_nothing_leaked_memory(max_increasable_size,
|
1872
|
+
target=:physical,
|
1873
|
+
message=nil)
|
1874
|
+
_wrap_assertion do
|
1875
|
+
GC.start
|
1876
|
+
before = Util::MemoryUsage.new
|
1877
|
+
unless before.collected?
|
1878
|
+
omit("memory usage collection isn't supported on this platform")
|
1879
|
+
end
|
1880
|
+
yield
|
1881
|
+
GC.start
|
1882
|
+
after = Util::MemoryUsage.new
|
1883
|
+
before_value = before.__send__(target)
|
1884
|
+
after_value = after.__send__(target)
|
1885
|
+
actual_increased_size = after_value - before_value
|
1886
|
+
template = <<-TEMPLATE
|
1887
|
+
<?> was expected to be less than
|
1888
|
+
<?>.
|
1889
|
+
TEMPLATE
|
1890
|
+
full_message = build_message(message,
|
1891
|
+
template,
|
1892
|
+
actual_increased_size,
|
1893
|
+
max_increasable_size)
|
1894
|
+
assert_block(full_message) do
|
1895
|
+
actual_increased_size < max_increasable_size
|
1896
|
+
end
|
1897
|
+
end
|
1898
|
+
end
|
1899
|
+
|
1900
|
+
##
|
1901
|
+
# Builds a failure message. `user_message` is added before the
|
1902
|
+
# `template` and `arguments` replaces the '?'s positionally in
|
1903
|
+
# the template.
|
1904
|
+
def build_message(user_message, template=nil, *arguments)
|
1905
|
+
template &&= template.chomp
|
1906
|
+
return AssertionMessage.new(user_message, template, arguments)
|
1907
|
+
end
|
1908
|
+
|
1909
|
+
private
|
1910
|
+
def _wrap_assertion(&block)
|
1911
|
+
@_assertion_wrapped ||= false
|
1912
|
+
if @_assertion_wrapped
|
1913
|
+
block.call
|
1914
|
+
else
|
1915
|
+
@_assertion_wrapped = true
|
1916
|
+
begin
|
1917
|
+
add_assertion
|
1918
|
+
block.call
|
1919
|
+
ensure
|
1920
|
+
@_assertion_wrapped = false
|
1921
|
+
end
|
1922
|
+
end
|
1923
|
+
end
|
1924
|
+
|
1925
|
+
public
|
1926
|
+
# Called whenever an assertion is made. Define this in classes
|
1927
|
+
# that include Test::Unit::Assertions to record assertion
|
1928
|
+
# counts.
|
1929
|
+
#
|
1930
|
+
# This is a public API for developers who extend test-unit.
|
1931
|
+
#
|
1932
|
+
# @return [void]
|
1933
|
+
def add_assertion
|
1934
|
+
end
|
1935
|
+
|
1936
|
+
##
|
1937
|
+
# Select whether or not to use the pretty-printer. If this option is set
|
1938
|
+
# to false before any assertions are made, pp.rb will not be required.
|
1939
|
+
def self.use_pp=(value)
|
1940
|
+
AssertionMessage.use_pp = value
|
1941
|
+
end
|
1942
|
+
|
1943
|
+
private
|
1944
|
+
def _assert_raise(assert_expected_exception, *args, &block)
|
1945
|
+
_wrap_assertion do
|
1946
|
+
if args.last.is_a?(String)
|
1947
|
+
message = args.pop
|
1948
|
+
else
|
1949
|
+
message = ""
|
1950
|
+
end
|
1951
|
+
|
1952
|
+
assert_exception_helper = AssertExceptionHelper.new(self, args)
|
1953
|
+
expected = assert_exception_helper.expected_exceptions
|
1954
|
+
actual_exception = nil
|
1955
|
+
full_message = build_message(message,
|
1956
|
+
"<?> exception was expected " +
|
1957
|
+
"but none was thrown.",
|
1958
|
+
expected)
|
1959
|
+
assert_block(full_message) do
|
1960
|
+
begin
|
1961
|
+
yield
|
1962
|
+
false
|
1963
|
+
rescue Exception => actual_exception
|
1964
|
+
true
|
1965
|
+
end
|
1966
|
+
end
|
1967
|
+
assert_expected_exception.call(message, assert_exception_helper,
|
1968
|
+
actual_exception)
|
1969
|
+
actual_exception
|
1970
|
+
end
|
1971
|
+
end
|
1972
|
+
|
1973
|
+
def _set_failed_information(failure, expected, actual)
|
1974
|
+
failure.expected = expected
|
1975
|
+
failure.actual = actual
|
1976
|
+
failure.inspected_expected = AssertionMessage.convert(expected)
|
1977
|
+
failure.inspected_actual = AssertionMessage.convert(actual)
|
1978
|
+
end
|
1979
|
+
|
1980
|
+
class AssertionMessage
|
1981
|
+
@use_pp = true
|
1982
|
+
class << self
|
1983
|
+
attr_accessor :use_pp
|
1984
|
+
|
1985
|
+
def literal(value)
|
1986
|
+
Literal.new(value)
|
1987
|
+
end
|
1988
|
+
|
1989
|
+
def delayed_literal(&block)
|
1990
|
+
DelayedLiteral.new(block)
|
1991
|
+
end
|
1992
|
+
|
1993
|
+
def maybe_container(value, &formatter)
|
1994
|
+
MaybeContainer.new(value, &formatter)
|
1995
|
+
end
|
1996
|
+
|
1997
|
+
MAX_DIFF_TARGET_STRING_SIZE = 1000
|
1998
|
+
def max_diff_target_string_size
|
1999
|
+
return @@max_diff_target_string_size if @@max_diff_target_string_size
|
2000
|
+
|
2001
|
+
size = ENV["TEST_UNIT_MAX_DIFF_TARGET_STRING_SIZE"]
|
2002
|
+
if size
|
2003
|
+
begin
|
2004
|
+
size = Integer(size)
|
2005
|
+
rescue ArgumentError
|
2006
|
+
size = nil
|
2007
|
+
end
|
2008
|
+
end
|
2009
|
+
size || MAX_DIFF_TARGET_STRING_SIZE
|
2010
|
+
end
|
2011
|
+
|
2012
|
+
@@max_diff_target_string_size = nil
|
2013
|
+
def max_diff_target_string_size=(size)
|
2014
|
+
@@max_diff_target_string_size = size
|
2015
|
+
end
|
2016
|
+
|
2017
|
+
def diff_target_string?(string)
|
2018
|
+
if string.respond_to?(:bytesize)
|
2019
|
+
string.bytesize < max_diff_target_string_size
|
2020
|
+
else
|
2021
|
+
string.size < max_diff_target_string_size
|
2022
|
+
end
|
2023
|
+
end
|
2024
|
+
|
2025
|
+
def ensure_diffable_string(string)
|
2026
|
+
if string.respond_to?(:encoding) and
|
2027
|
+
!string.encoding.ascii_compatible?
|
2028
|
+
string = string.dup.force_encoding("ASCII-8BIT")
|
2029
|
+
end
|
2030
|
+
string
|
2031
|
+
end
|
2032
|
+
|
2033
|
+
def prepare_for_diff(from, to)
|
2034
|
+
if !from.is_a?(String) or !to.is_a?(String)
|
2035
|
+
from = convert(from)
|
2036
|
+
to = convert(to)
|
2037
|
+
end
|
2038
|
+
|
2039
|
+
if diff_target_string?(from) and diff_target_string?(to)
|
2040
|
+
from = ensure_diffable_string(from)
|
2041
|
+
to = ensure_diffable_string(to)
|
2042
|
+
[from, to]
|
2043
|
+
else
|
2044
|
+
[nil, nil]
|
2045
|
+
end
|
2046
|
+
end
|
2047
|
+
|
2048
|
+
def delayed_diff(from, to)
|
2049
|
+
delayed_literal do
|
2050
|
+
from, to = prepare_for_diff(from, to)
|
2051
|
+
|
2052
|
+
diff = "" if from.nil? or to.nil?
|
2053
|
+
diff ||= Diff.readable(from, to)
|
2054
|
+
if /^[-+]/ !~ diff
|
2055
|
+
diff = ""
|
2056
|
+
elsif /^[ ?]/ =~ diff or /(?:.*\n){2,}/ =~ diff
|
2057
|
+
diff = "\n\ndiff:\n#{diff}"
|
2058
|
+
else
|
2059
|
+
diff = ""
|
2060
|
+
end
|
2061
|
+
|
2062
|
+
if Diff.need_fold?(diff)
|
2063
|
+
folded_diff = Diff.folded_readable(from, to)
|
2064
|
+
diff += "\n\nfolded diff:\n#{folded_diff}"
|
2065
|
+
end
|
2066
|
+
|
2067
|
+
diff
|
2068
|
+
end
|
2069
|
+
end
|
2070
|
+
|
2071
|
+
def convert(object)
|
2072
|
+
if object.is_a?(Exception)
|
2073
|
+
object = AssertExceptionHelper::WrappedException.new(object)
|
2074
|
+
end
|
2075
|
+
inspector = Inspector.new(object)
|
2076
|
+
if use_pp
|
2077
|
+
begin
|
2078
|
+
require "pp" unless defined?(PP)
|
2079
|
+
begin
|
2080
|
+
return PP.pp(inspector, String.new).chomp
|
2081
|
+
rescue NameError
|
2082
|
+
end
|
2083
|
+
rescue LoadError
|
2084
|
+
self.use_pp = false
|
2085
|
+
end
|
2086
|
+
end
|
2087
|
+
inspector.inspect
|
2088
|
+
end
|
2089
|
+
end
|
2090
|
+
|
2091
|
+
class Inspector
|
2092
|
+
include Comparable
|
2093
|
+
|
2094
|
+
class << self
|
2095
|
+
def cached_new(object, inspected_objects)
|
2096
|
+
inspected_objects[object.__id__] ||=
|
2097
|
+
new(object, inspected_objects)
|
2098
|
+
end
|
2099
|
+
|
2100
|
+
@@inspector_classes = []
|
2101
|
+
def inspector_classes
|
2102
|
+
@@inspector_classes
|
2103
|
+
end
|
2104
|
+
|
2105
|
+
def register_inspector_class(inspector_class)
|
2106
|
+
@@inspector_classes << inspector_class
|
2107
|
+
end
|
2108
|
+
|
2109
|
+
def unregister_inspector_class(inspector_class)
|
2110
|
+
@@inspector_classes.delete(inspector_class)
|
2111
|
+
end
|
2112
|
+
end
|
2113
|
+
|
2114
|
+
attr_reader :object
|
2115
|
+
def initialize(object, inspected_objects={})
|
2116
|
+
@inspected_objects = inspected_objects
|
2117
|
+
@object = object
|
2118
|
+
@inspected_objects[@object.__id__] = self
|
2119
|
+
@inspect_target = inspect_target
|
2120
|
+
end
|
2121
|
+
|
2122
|
+
alias_method :native_inspect, :inspect
|
2123
|
+
def inspect
|
2124
|
+
@inspect_target.inspect
|
2125
|
+
end
|
2126
|
+
|
2127
|
+
def pretty_print(q)
|
2128
|
+
@inspect_target.pretty_print(q)
|
2129
|
+
end
|
2130
|
+
|
2131
|
+
def pretty_print_cycle(q)
|
2132
|
+
@inspect_target.pretty_print_cycle(q)
|
2133
|
+
end
|
2134
|
+
|
2135
|
+
def <=>(other)
|
2136
|
+
if other.is_a?(self.class)
|
2137
|
+
@object <=> other.object
|
2138
|
+
else
|
2139
|
+
@object <=> other
|
2140
|
+
end
|
2141
|
+
end
|
2142
|
+
|
2143
|
+
private
|
2144
|
+
def inspect_target
|
2145
|
+
self.class.inspector_classes.each do |inspector_class|
|
2146
|
+
if inspector_class.target?(@object)
|
2147
|
+
return inspector_class.new(@object, @inspected_objects)
|
2148
|
+
end
|
2149
|
+
end
|
2150
|
+
@object
|
2151
|
+
end
|
2152
|
+
end
|
2153
|
+
|
2154
|
+
class NumericInspector
|
2155
|
+
Inspector.register_inspector_class(self)
|
2156
|
+
|
2157
|
+
class << self
|
2158
|
+
def target?(object)
|
2159
|
+
object.is_a?(Numeric)
|
2160
|
+
end
|
2161
|
+
end
|
2162
|
+
|
2163
|
+
def initialize(numeric, inspected_objects)
|
2164
|
+
@inspected_objects = inspected_objects
|
2165
|
+
@numeric = numeric
|
2166
|
+
end
|
2167
|
+
|
2168
|
+
def inspect
|
2169
|
+
@numeric.to_s
|
2170
|
+
end
|
2171
|
+
|
2172
|
+
def pretty_print(q)
|
2173
|
+
q.text(@numeric.to_s)
|
2174
|
+
end
|
2175
|
+
|
2176
|
+
def pretty_print_cycle(q)
|
2177
|
+
q.text(@numeric.to_s)
|
2178
|
+
end
|
2179
|
+
end
|
2180
|
+
|
2181
|
+
class HashInspector
|
2182
|
+
Inspector.register_inspector_class(self)
|
2183
|
+
|
2184
|
+
class << self
|
2185
|
+
def target?(object)
|
2186
|
+
object.is_a?(Hash) or ENV.equal?(object)
|
2187
|
+
end
|
2188
|
+
end
|
2189
|
+
|
2190
|
+
def initialize(hash, inspected_objects)
|
2191
|
+
@inspected_objects = inspected_objects
|
2192
|
+
@hash = {}
|
2193
|
+
hash.each do |key, value|
|
2194
|
+
key = Inspector.cached_new(key, @inspected_objects)
|
2195
|
+
value = Inspector.cached_new(value, @inspected_objects)
|
2196
|
+
@hash[key] = value
|
2197
|
+
end
|
2198
|
+
end
|
2199
|
+
|
2200
|
+
def inspect
|
2201
|
+
@hash.inspect
|
2202
|
+
end
|
2203
|
+
|
2204
|
+
def pretty_print(q)
|
2205
|
+
q.group(1, '{', '}') do
|
2206
|
+
q.seplist(self, nil, :each_pair) do |k, v|
|
2207
|
+
q.group do
|
2208
|
+
q.pp(k)
|
2209
|
+
q.text('=>')
|
2210
|
+
q.group(1) do
|
2211
|
+
q.breakable('')
|
2212
|
+
q.pp(v)
|
2213
|
+
end
|
2214
|
+
end
|
2215
|
+
end
|
2216
|
+
end
|
2217
|
+
end
|
2218
|
+
|
2219
|
+
def pretty_print_cycle(q)
|
2220
|
+
@hash.pretty_print_cycle(q)
|
2221
|
+
end
|
2222
|
+
|
2223
|
+
def each_pair
|
2224
|
+
keys = @hash.keys
|
2225
|
+
begin
|
2226
|
+
keys = keys.sort # FIXME: more cleverly
|
2227
|
+
rescue ArgumentError
|
2228
|
+
end
|
2229
|
+
keys.each do |key|
|
2230
|
+
yield(key, @hash[key])
|
2231
|
+
end
|
2232
|
+
end
|
2233
|
+
end
|
2234
|
+
|
2235
|
+
class ArrayInspector
|
2236
|
+
Inspector.register_inspector_class(self)
|
2237
|
+
|
2238
|
+
class << self
|
2239
|
+
def target?(object)
|
2240
|
+
object.is_a?(Array)
|
2241
|
+
end
|
2242
|
+
end
|
2243
|
+
|
2244
|
+
def initialize(array, inspected_objects)
|
2245
|
+
@inspected_objects = inspected_objects
|
2246
|
+
@array = array.collect do |element|
|
2247
|
+
Inspector.cached_new(element, @inspected_objects)
|
2248
|
+
end
|
2249
|
+
end
|
2250
|
+
|
2251
|
+
def inspect
|
2252
|
+
@array.inspect
|
2253
|
+
end
|
2254
|
+
|
2255
|
+
def pretty_print(q)
|
2256
|
+
q.group(1, '[', ']') do
|
2257
|
+
q.seplist(self) do |v|
|
2258
|
+
q.pp(v)
|
2259
|
+
end
|
2260
|
+
end
|
2261
|
+
end
|
2262
|
+
|
2263
|
+
def pretty_print_cycle(q)
|
2264
|
+
@array.pretty_print_cycle(q)
|
2265
|
+
end
|
2266
|
+
|
2267
|
+
def each(&block)
|
2268
|
+
@array.each(&block)
|
2269
|
+
end
|
2270
|
+
end
|
2271
|
+
|
2272
|
+
class Literal
|
2273
|
+
def initialize(value)
|
2274
|
+
@value = value
|
2275
|
+
end
|
2276
|
+
|
2277
|
+
def inspect
|
2278
|
+
@value.to_s
|
2279
|
+
end
|
2280
|
+
end
|
2281
|
+
|
2282
|
+
class DelayedLiteral
|
2283
|
+
def initialize(value)
|
2284
|
+
@value = value
|
2285
|
+
end
|
2286
|
+
|
2287
|
+
def inspect
|
2288
|
+
@value.call.to_s
|
2289
|
+
end
|
2290
|
+
end
|
2291
|
+
|
2292
|
+
class MaybeContainer
|
2293
|
+
def initialize(value, &formatter)
|
2294
|
+
@value = value
|
2295
|
+
@formatter = formatter
|
2296
|
+
end
|
2297
|
+
|
2298
|
+
def inspect
|
2299
|
+
if @value.is_a?(Array)
|
2300
|
+
values = @value.collect do |value|
|
2301
|
+
@formatter.call(AssertionMessage.convert(value))
|
2302
|
+
end
|
2303
|
+
"[#{values.join(', ')}]"
|
2304
|
+
else
|
2305
|
+
@formatter.call(AssertionMessage.convert(@value))
|
2306
|
+
end
|
2307
|
+
end
|
2308
|
+
end
|
2309
|
+
|
2310
|
+
class Template
|
2311
|
+
def self.create(string)
|
2312
|
+
parts = (string ? string.scan(/(?=[^\\])\?|(?:\\\?|[^\?])+/m) : [])
|
2313
|
+
self.new(parts)
|
2314
|
+
end
|
2315
|
+
|
2316
|
+
attr_reader :count
|
2317
|
+
|
2318
|
+
def initialize(parts)
|
2319
|
+
@parts = parts
|
2320
|
+
@count = parts.count('?')
|
2321
|
+
end
|
2322
|
+
|
2323
|
+
def result(parameters)
|
2324
|
+
raise "The number of parameters does not match the number of substitutions." if(parameters.size != count)
|
2325
|
+
params = parameters.dup
|
2326
|
+
expanded_template = ""
|
2327
|
+
@parts.each do |part|
|
2328
|
+
if part == '?'
|
2329
|
+
param = params.shift
|
2330
|
+
if Object.const_defined?(:Encoding)
|
2331
|
+
expanded_template += concatenatable(param,
|
2332
|
+
expanded_template.encoding)
|
2333
|
+
else
|
2334
|
+
expanded_template += param
|
2335
|
+
end
|
2336
|
+
else
|
2337
|
+
expanded_template += part.gsub(/\\\?/m, '?')
|
2338
|
+
end
|
2339
|
+
end
|
2340
|
+
expanded_template
|
2341
|
+
end
|
2342
|
+
|
2343
|
+
private
|
2344
|
+
def concatenatable(text, encoding)
|
2345
|
+
if Encoding.compatible?(text, encoding)
|
2346
|
+
text
|
2347
|
+
else
|
2348
|
+
text.dup.force_encoding(encoding)
|
2349
|
+
end
|
2350
|
+
end
|
2351
|
+
end
|
2352
|
+
|
2353
|
+
include Util::BacktraceFilter
|
2354
|
+
|
2355
|
+
def initialize(user_message, template_string, parameters)
|
2356
|
+
@user_message = user_message
|
2357
|
+
@template_string = template_string
|
2358
|
+
@parameters = parameters
|
2359
|
+
end
|
2360
|
+
|
2361
|
+
def convert(object)
|
2362
|
+
self.class.convert(object)
|
2363
|
+
end
|
2364
|
+
|
2365
|
+
def template
|
2366
|
+
@template ||= Template.create(@template_string)
|
2367
|
+
end
|
2368
|
+
|
2369
|
+
def user_message
|
2370
|
+
return nil unless @user_message
|
2371
|
+
message = @user_message
|
2372
|
+
message = message.call if message.respond_to?(:call)
|
2373
|
+
message.to_s
|
2374
|
+
end
|
2375
|
+
|
2376
|
+
def to_s
|
2377
|
+
message_parts = []
|
2378
|
+
head = user_message
|
2379
|
+
if head and not head.empty?
|
2380
|
+
message_parts << add_period(head)
|
2381
|
+
end
|
2382
|
+
tail = template.result(@parameters.collect{|e| convert(e)})
|
2383
|
+
message_parts << tail unless(tail.empty?)
|
2384
|
+
message_parts.join("\n")
|
2385
|
+
end
|
2386
|
+
|
2387
|
+
private
|
2388
|
+
def add_period(string)
|
2389
|
+
(string =~ /\.\Z/ ? string : string + '.')
|
2390
|
+
end
|
2391
|
+
end
|
2392
|
+
|
2393
|
+
class AssertExceptionHelper
|
2394
|
+
class WrappedException
|
2395
|
+
attr_reader :exception
|
2396
|
+
def initialize(exception)
|
2397
|
+
@exception = exception
|
2398
|
+
end
|
2399
|
+
|
2400
|
+
def inspect
|
2401
|
+
if default_inspect?
|
2402
|
+
inspected = "#{@exception.class.inspect}(<#{@exception.message}>)"
|
2403
|
+
unless (@exception.backtrace || []).empty?
|
2404
|
+
inspected += "\n"
|
2405
|
+
@exception.backtrace.each do |trace|
|
2406
|
+
inspected << "#{trace}\n"
|
2407
|
+
end
|
2408
|
+
end
|
2409
|
+
inspected
|
2410
|
+
else
|
2411
|
+
@exception.inspect
|
2412
|
+
end
|
2413
|
+
end
|
2414
|
+
|
2415
|
+
def method_missing(name, *args, &block)
|
2416
|
+
@exception.__send__(name, *args, &block)
|
2417
|
+
end
|
2418
|
+
|
2419
|
+
private
|
2420
|
+
def default_inspect?
|
2421
|
+
inspect_method = @exception.method(:inspect)
|
2422
|
+
if inspect_method.respond_to?(:owner) and
|
2423
|
+
inspect_method.owner == Exception
|
2424
|
+
true
|
2425
|
+
else
|
2426
|
+
default_inspect_method = Exception.instance_method(:inspect)
|
2427
|
+
default_inspect_method.bind(@exception).call == @exception.inspect
|
2428
|
+
end
|
2429
|
+
end
|
2430
|
+
end
|
2431
|
+
|
2432
|
+
def initialize(test_case, expected_exceptions)
|
2433
|
+
@test_case = test_case
|
2434
|
+
@expected_exceptions = expected_exceptions
|
2435
|
+
@expected_classes, @expected_modules, @expected_objects =
|
2436
|
+
split_expected_exceptions(expected_exceptions)
|
2437
|
+
end
|
2438
|
+
|
2439
|
+
def expected_exceptions
|
2440
|
+
exceptions = @expected_exceptions.collect do |exception|
|
2441
|
+
if exception.is_a?(Exception)
|
2442
|
+
WrappedException.new(exception)
|
2443
|
+
else
|
2444
|
+
exception
|
2445
|
+
end
|
2446
|
+
end
|
2447
|
+
if exceptions.size == 1
|
2448
|
+
exceptions[0]
|
2449
|
+
else
|
2450
|
+
exceptions
|
2451
|
+
end
|
2452
|
+
end
|
2453
|
+
|
2454
|
+
def expected?(actual_exception, equality=nil)
|
2455
|
+
equality ||= :instance_of?
|
2456
|
+
expected_class?(actual_exception, equality) or
|
2457
|
+
expected_module?(actual_exception) or
|
2458
|
+
expected_object?(actual_exception)
|
2459
|
+
end
|
2460
|
+
|
2461
|
+
private
|
2462
|
+
def split_expected_exceptions(expected_exceptions)
|
2463
|
+
exception_modules = []
|
2464
|
+
exception_objects = []
|
2465
|
+
exception_classes = []
|
2466
|
+
expected_exceptions.each do |exception_type|
|
2467
|
+
if exception_type.instance_of?(Module)
|
2468
|
+
exception_modules << exception_type
|
2469
|
+
elsif exception_object?(exception_type)
|
2470
|
+
exception_objects << exception_type
|
2471
|
+
elsif exception_class?(exception_type)
|
2472
|
+
exception_classes << exception_type
|
2473
|
+
else
|
2474
|
+
full_message =
|
2475
|
+
@test_case.__send__(:build_message,
|
2476
|
+
nil,
|
2477
|
+
"<?> must be " +
|
2478
|
+
"a subclass of Exception, " +
|
2479
|
+
"an object of Exception subclasses " +
|
2480
|
+
"or a Module",
|
2481
|
+
exception_type)
|
2482
|
+
@test_case.flunk(full_message)
|
2483
|
+
end
|
2484
|
+
end
|
2485
|
+
[exception_classes, exception_modules, exception_objects]
|
2486
|
+
end
|
2487
|
+
|
2488
|
+
def exception_object?(exception_type)
|
2489
|
+
return true if exception_type.is_a?(Exception)
|
2490
|
+
|
2491
|
+
if Object.const_defined?(:Java)
|
2492
|
+
return true if exception_type.is_a?(Java::JavaLang::Throwable)
|
2493
|
+
end
|
2494
|
+
|
2495
|
+
false
|
2496
|
+
end
|
2497
|
+
|
2498
|
+
def exception_class?(exception_type)
|
2499
|
+
return true if exception_type <= Exception
|
2500
|
+
|
2501
|
+
if Object.const_defined?(:Java)
|
2502
|
+
return true if exception_type <= Java::JavaLang::Throwable
|
2503
|
+
end
|
2504
|
+
|
2505
|
+
false
|
2506
|
+
end
|
2507
|
+
|
2508
|
+
def expected_class?(actual_exception, equality)
|
2509
|
+
@expected_classes.any? do |expected_class|
|
2510
|
+
actual_exception.__send__(equality, expected_class)
|
2511
|
+
end
|
2512
|
+
end
|
2513
|
+
|
2514
|
+
def expected_module?(actual_exception)
|
2515
|
+
@expected_modules.any? do |expected_module|
|
2516
|
+
actual_exception.is_a?(expected_module)
|
2517
|
+
end
|
2518
|
+
end
|
2519
|
+
|
2520
|
+
def expected_object?(actual_exception)
|
2521
|
+
@expected_objects.any? do |expected_object|
|
2522
|
+
expected_object == actual_exception or
|
2523
|
+
fallback_exception_object_equal(expected_object, actual_exception)
|
2524
|
+
end
|
2525
|
+
end
|
2526
|
+
|
2527
|
+
def fallback_exception_object_equal(expected_object, actual_exception)
|
2528
|
+
owner = Util::MethodOwnerFinder.find(expected_object, :==)
|
2529
|
+
if owner == Kernel or owner == Exception
|
2530
|
+
expected_object.class == actual_exception.class and
|
2531
|
+
expected_object.message == actual_exception.message
|
2532
|
+
else
|
2533
|
+
false
|
2534
|
+
end
|
2535
|
+
end
|
2536
|
+
end
|
2537
|
+
|
2538
|
+
# :startdoc:
|
2539
|
+
end
|
2540
|
+
end
|
2541
|
+
end
|