Skip to content

Commit

Permalink
Improve docs for strict keyword argument matching
Browse files Browse the repository at this point in the history
This addresses an ambiguity which was raised in this comment [1].

Since it's a bit subjective whether this should be referring to "false
negatives" or "false positives", I've elected to avoid either phrase
altogether:

    "false negatives" -> "misleading passing tests"

[1]: https://github.com/freerange/mocha/pull/554/files#r999473448
  • Loading branch information
floehopper committed Nov 1, 2022
1 parent a5e07fc commit 1099679
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mocha/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ def display_matching_invocations_on_failure?

# Perform strict keyword argument comparison. Only supported in Ruby >= v2.7.
#
# When this option is set to +false+ a positional +Hash+ and a set of keyword arguments are treated the same during comparison, which can lead to false negatives in Ruby >= v3.0 (see examples below). However, a deprecation warning will be displayed if a positional +Hash+ matches a set of keyword arguments or vice versa. This is because {#strict_keyword_argument_matching=} will default to +true+ in the future.
# When this option is set to +false+ a positional +Hash+ and a set of keyword arguments are treated the same during comparison, which can lead to misleading passing tests in Ruby >= v3.0 (see examples below). However, a deprecation warning will be displayed if a positional +Hash+ matches a set of keyword arguments or vice versa. This is because {#strict_keyword_argument_matching=} will default to +true+ in the future.
#
# For more details on keyword arguments in Ruby v3, refer to {https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0 this article}.
#
# Note that +Hash+-related matchers such as {ParameterMatchers#has_value} or {ParameterMatchers#has_key} will still treat a positional +Hash+ and a set of keyword arguments the same, so false negatives are still possible when they are used.
# Note that +Hash+-related matchers such as {ParameterMatchers#has_value} or {ParameterMatchers#has_key} will still treat a positional +Hash+ and a set of keyword arguments the same, so misleading passing tests are still possible when they are used.
#
# This configuration option is +false+ by default to enable gradual adoption, but will be +true+ by default in the future.
#
Expand Down

0 comments on commit 1099679

Please sign in to comment.