Fix typos and spelling

This commit is contained in:
Michael Miller 2021-11-28 15:45:17 -07:00
parent bc61e0e64f
commit 59ce312341
No known key found for this signature in database
GPG Key ID: AC78B32D30CE34A2
44 changed files with 113 additions and 113 deletions

View File

@ -48,7 +48,7 @@ module Spectator
# Provides a means to configure how Spectator will run and report tests.
# A `ConfigBuilder` is yielded to allow changing the configuration.
# NOTE: The configuration set here can be overriden
# NOTE: The configuration set here can be overridden
# with a `.spectator` file and command-line arguments.
def configure(& : Config::Builder -> _) : Nil
yield @@config_builder
@ -56,7 +56,7 @@ module Spectator
# Random number generator for the test suite.
# All randomly generated values should be pulled from this.
# This provides reproducable results even though random values are used.
# This provides re-producible results even though random values are used.
# The seed for this random generator is controlled by `ConfigBuilder.seed=`.
def random
config.random

View File

@ -8,7 +8,7 @@ module Spectator
# or nil if one isn't available.
#
# This base class is provided so that all generic sub-classes can be stored as this one type.
# The value of the expression can be retrieved by downcasting to the expected type with `#cast`.
# The value of the expression can be retrieved by down-casting to the expected type with `#cast`.
#
# NOTE: This is intentionally a class and not a struct.
# If it were a struct, changes made to the value held by an instance may not be kept when passing it around.

View File

@ -4,7 +4,7 @@ require "./label"
module Spectator
# Represents a block from a test.
# This is typically captured by an `expect` macro.
# It consists of a label and parameterless block.
# It consists of a label and parameter-less block.
# The label should be a string recognizable by the user,
# or nil if one isn't available.
class Block(T) < Expression(T)

View File

@ -3,7 +3,7 @@ require "./dsl/*"
module Spectator
# Namespace containing methods representing the spec domain specific language.
#
# Note: Documentation inside macros is kept to a minimuum to reduce generated code.
# Note: Documentation inside macros is kept to a minimum to reduce generated code.
# This also helps keep error traces small.
# Documentation only useful for debugging is included in generated code.
module DSL

View File

@ -31,7 +31,7 @@ module Spectator::DSL
end
# Completes a previously defined example group and pops it off the group stack.
# Be sure to call `#start_group` and `#end_group` symmetically.
# Be sure to call `#start_group` and `#end_group` symmetrically.
#
# See `Spec::Builder#end_group` for usage details.
def end_group(*args)

View File

@ -7,7 +7,7 @@ module Spectator::DSL
module Concise
# Defines an example and input values in a shorter syntax.
# The only arguments given to this macro are one or more assignments.
# The names in the assigments will be available in the example code.
# The names in the assignments will be available in the example code.
#
# If the code block is omitted, then the example is skipped (marked as not implemented).
#

View File

@ -239,7 +239,7 @@ module Spectator::DSL
# expect("foo").to match(/foo|bar/)
# expect("BAR").to match(/foo|bar/i)
# expect(1 + 2).to match(3)
# expect(5).to match(Int32) # Using `#be_a` instead is recommened here.
# expect(5).to match(Int32) # Using `#be_a` instead is recommended here.
# expect({:foo, 5}).to match({Symbol, Int32})
# ```
macro match(expected)
@ -368,7 +368,7 @@ module Spectator::DSL
# expect(pi).to be_close(3.14159265359, 0.0000001)
# ```
#
# This is functionly equivalent to:
# This is functionally equivalent to:
# ```
# be_within(expected).of(delta)
# ```
@ -400,7 +400,7 @@ module Spectator::DSL
# Indicates that some value or set should start with another value.
# This is typically used on a `String` or `Array` (any `Enumerable` works).
# The *expected* argument can be a `String`, `Char`, or `Regex`
# when the actual type (being comapred against) is a `String`.
# when the actual type (being compared against) is a `String`.
# For `Enumerable` types, only the first item is inspected.
# It is compared with the === operator,
# so that values, types, regular expressions, and others can be tested.
@ -423,7 +423,7 @@ module Spectator::DSL
# Indicates that some value or set should end with another value.
# This is typically used on a `String` or `Array` (any `Indexable` works).
# The *expected* argument can be a `String`, `Char`, or `Regex`
# when the actual type (being comapred against) is a `String`.
# when the actual type (being compared against) is a `String`.
# For `Indexable` types, only the last item is inspected.
# It is compared with the === operator,
# so that values, types, regular expressions, and others can be tested.
@ -446,8 +446,8 @@ module Spectator::DSL
# Indicates that some value or set should contain another value.
# This is typically used on a `String` or `Array` (any `Enumerable` works).
# The *expected* argument can be a `String` or `Char`
# when the actual type (being comapred against) is a `String`.
# For `Enumerable` types, items are compared using the underying implementation.
# when the actual type (being compared against) is a `String`.
# For `Enumerable` types, items are compared using the underlying implementation.
# In both cases, the `includes?` method is used.
#
# Examples:
@ -475,8 +475,8 @@ module Spectator::DSL
# Indicates that some value or set should contain specific items.
# This is typically used on a `String` or `Array` (any `Enumerable` works).
# The *expected* argument can be a `String` or `Char`
# when the actual type (being comapred against) is a `String`.
# For `Enumerable` types, items are compared using the underying implementation.
# when the actual type (being compared against) is a `String`.
# For `Enumerable` types, items are compared using the underlying implementation.
# In both cases, the `includes?` method is used.
#
# This is identical to `#contain`, but accepts an array (or enumerable type) instead of multiple arguments.
@ -522,7 +522,7 @@ module Spectator::DSL
# This is similar to `#contain`, but uses a different method for matching.
# Typically a `String` or `Array` (any `Enumerable` works) is checked against.
# The *expected* argument can be a `String` or `Char`
# when the actual type (being comapred against) is a `String`.
# when the actual type (being compared against) is a `String`.
# The `includes?` method is used for this case.
# For `Enumerable` types, each item is inspected until one matches.
# The === operator is used for this case, which allows for equality, type, regex, and other matches.
@ -557,7 +557,7 @@ module Spectator::DSL
# This is similar to `#contain_elements`, but uses a different method for matching.
# Typically a `String` or `Array` (any `Enumerable` works) is checked against.
# The *expected* argument can be a `String` or `Char`
# when the actual type (being comapred against) is a `String`.
# when the actual type (being compared against) is a `String`.
# The `includes?` method is used for this case.
# For `Enumerable` types, each item is inspected until one matches.
# The === operator is used for this case, which allows for equality, type, regex, and other matches.

View File

@ -8,7 +8,7 @@ module Spectator
# such as whether it was successful and a description of the operation.
struct Expectation
# Location of the expectation in source code.
# This can be nil if the location isn't capturable,
# This can be nil if the location can't be captured,
# for instance using the *should* syntax or dynamically created expectations.
getter! location : Location

View File

@ -9,7 +9,7 @@ module Spectator::Formatting
class DocumentFormatter < Formatter
include Summary
# Identation string.
# Indentation string.
private INDENT = " "
# String used for groups and examples that don't have a name.

View File

@ -66,7 +66,7 @@ module Spectator::Formatting
# The *notification* will be an `ExampleNotification` type of object.
#
# NOTE: Errors are normally considered failures,
# however `#example_error` is called instead if one occurs in an exmaple.
# however `#example_error` is called instead if one occurs in an example.
def example_failed(_notification)
end

View File

@ -52,7 +52,7 @@ module Spectator
end
end
# Instanciates a new harness and yields it.
# Instantiates a new harness and yields it.
# The `.current` harness is set to the new harness for the duration of the block.
# `.current` is reset to the previous value (probably nil) afterwards, even if the block raises.
# The result of the block is returned.

View File

@ -1,6 +1,6 @@
module Spectator
# Identifier used in the spec.
# Signficant to the user.
# Significant to the user.
# When a label is a symbol, then it is referencing a type or method.
# A label is nil when one can't be provided or captured.
alias Label = String | Symbol | Nil

View File

@ -2,7 +2,7 @@ require "./matchers/*"
module Spectator
# Evaluates conditions on values and objects
# to determine whether they satisify test criteria.
# to determine whether they satisfy test criteria.
module Matchers
end
end

View File

@ -83,7 +83,7 @@ module Spectator::Matchers
# The first array is the missing elements (present in expected, missing in actual).
# The second array array is the extra elements (not present in expected, present in actual).
private def compare_arrays(expected_elements, actual_elements)
# Produce hashes where the array elements are the keys, and the values are the number of occurances.
# Produce hashes where the array elements are the keys, and the values are the number of occurrences.
expected_hash = expected_elements.group_by(&.itself).map { |k, v| {k, v.size} }.to_h
actual_hash = actual_elements.group_by(&.itself).map { |k, v| {k, v.size} }.to_h
@ -96,11 +96,11 @@ module Spectator::Matchers
# Expects two hashes, with values as counts for keys.
# Produces an array of differences with elements repeated if needed.
private def hash_count_difference(first, second)
# Subtract the number of occurances from the other array.
# Subtract the number of occurrences from the other array.
# A duplicate hash is used here because the original can't be modified,
# since it there's a two-way comparison.
#
# Then reject elements that have zero (or less) occurances.
# Then reject elements that have zero (or less) occurrences.
# Lastly, expand to the correct number of elements.
first.map do |element, count|
if second_count = second[element]?

View File

@ -67,7 +67,7 @@ module Spectator::Matchers
{% end %}
end
# Checks if all attributes from the snapshot of them are satisified.
# Checks if all attributes from the snapshot of them are satisfied.
private def match?(snapshot)
# Test that every attribute has the expected value.
{% for attribute in ExpectedType.keys %}

View File

@ -11,7 +11,7 @@ module Spectator::Matchers
"matches #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
expected.value === actual.value
end
@ -22,7 +22,7 @@ module Spectator::Matchers
actual.value === expected.value
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -32,7 +32,7 @@ module Spectator::Matchers
"#{actual.label} does not match #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -12,12 +12,12 @@ module Spectator::Matchers
"is in #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
expected.value.includes?(actual.value)
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -27,7 +27,7 @@ module Spectator::Matchers
"#{actual.label} is not in #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -12,12 +12,12 @@ module Spectator::Matchers
"compiles as #{Expected}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
Expected == typeof(actual.value)
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -27,7 +27,7 @@ module Spectator::Matchers
"#{actual.label} does not compile as #{Expected}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,7 +11,7 @@ module Spectator::Matchers
"is empty"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual_value = actual.value
return unexpected(actual_value, actual.label) unless actual_value.responds_to?(:empty?)
@ -19,7 +19,7 @@ module Spectator::Matchers
actual_value.empty?
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -29,7 +29,7 @@ module Spectator::Matchers
"#{actual.label} is not empty"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,12 +11,12 @@ module Spectator::Matchers
"equals #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
expected.value == actual.value
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -26,7 +26,7 @@ module Spectator::Matchers
"#{actual.label} does not equal #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,12 +11,12 @@ module Spectator::Matchers
"greater than or equal to #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual.value >= expected.value
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -26,7 +26,7 @@ module Spectator::Matchers
"#{actual.label} is less than #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,12 +11,12 @@ module Spectator::Matchers
"greater than #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual.value > expected.value
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -26,7 +26,7 @@ module Spectator::Matchers
"#{actual.label} is less than or equal to #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,7 +11,7 @@ module Spectator::Matchers
"has key #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual_value = actual.value
return unexpected(actual_value, actual.label) unless actual_value.responds_to?(:has_key?)
@ -19,7 +19,7 @@ module Spectator::Matchers
actual_value.has_key?(expected.value)
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -29,7 +29,7 @@ module Spectator::Matchers
"#{actual.label} does not have key #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -35,7 +35,7 @@ module Spectator::Matchers
end
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -45,7 +45,7 @@ module Spectator::Matchers
"#{actual.label} does not have #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.
@ -68,7 +68,7 @@ module Spectator::Matchers
{% end %}
end
# Checks if all predicate methods from the snapshot of them are satisified.
# Checks if all predicate methods from the snapshot of them are satisfied.
private def match?(snapshot) : Bool
# Test each predicate and immediately return false if one is false.
{% for attribute in ExpectedType.keys %}

View File

@ -11,7 +11,7 @@ module Spectator::Matchers
"has value #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual_value = actual.value
return unexpected(actual_value, actual.label) unless actual_value.responds_to?(:has_value?)
@ -19,7 +19,7 @@ module Spectator::Matchers
actual_value.has_value?(expected.value)
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -29,7 +29,7 @@ module Spectator::Matchers
"#{actual.label} does not have value #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,12 +11,12 @@ module Spectator::Matchers
"is not equal to #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
expected.value != actual.value
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -26,7 +26,7 @@ module Spectator::Matchers
"#{actual.label} is equal to #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -10,12 +10,12 @@ module Spectator::Matchers
"is an instance of #{Expected}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual.value.class == Expected
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -25,7 +25,7 @@ module Spectator::Matchers
"#{actual.label} is not an instance of #{Expected}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,12 +11,12 @@ module Spectator::Matchers
"less than or equal to #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual.value <= expected.value
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -26,7 +26,7 @@ module Spectator::Matchers
"#{actual.label} is greater than #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,12 +11,12 @@ module Spectator::Matchers
"less than #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual.value < expected.value
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -26,7 +26,7 @@ module Spectator::Matchers
"#{actual.label} is greater than or equal to #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,12 +11,12 @@ module Spectator::Matchers
"is nil"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual.value.nil?
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -26,7 +26,7 @@ module Spectator::Matchers
"#{actual.label} is not nil"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -12,12 +12,12 @@ module Spectator::Matchers
"matches #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual.value === expected.value
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -27,7 +27,7 @@ module Spectator::Matchers
"#{actual.label} does not match #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -41,7 +41,7 @@ module Spectator::Matchers
end
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -51,7 +51,7 @@ module Spectator::Matchers
"#{actual.label} is not #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.
@ -74,7 +74,7 @@ module Spectator::Matchers
{% end %}
end
# Checks if all predicate methods from the snapshot of them are satisified.
# Checks if all predicate methods from the snapshot of them are satisfied.
private def match?(snapshot)
# Test each predicate and immediately return false if one is false.
{% for attribute in ExpectedType.keys %}

View File

@ -27,12 +27,12 @@ module Spectator::Matchers
RangeMatcher.new(expected)
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
expected.value.includes?(actual.value)
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -42,7 +42,7 @@ module Spectator::Matchers
"#{actual.label} is not in #{expected.label} (#{exclusivity})"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,7 +11,7 @@ module Spectator::Matchers
"is #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
value = expected.value
if value.nil?
@ -24,7 +24,7 @@ module Spectator::Matchers
end
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -34,7 +34,7 @@ module Spectator::Matchers
"#{actual.label} is not #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,12 +11,12 @@ module Spectator::Matchers
"matches #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
!!(actual.value =~ expected.value)
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -26,7 +26,7 @@ module Spectator::Matchers
"#{actual.label} does not match #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,7 +11,7 @@ module Spectator::Matchers
"has size #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual_value = actual.value
return unexpected(actual_value, actual.label) unless actual_value.responds_to?(:size?)
@ -19,7 +19,7 @@ module Spectator::Matchers
expected.value == actual_value.size
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -29,7 +29,7 @@ module Spectator::Matchers
"#{actual.label} does not have #{expected.label} elements"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -11,7 +11,7 @@ module Spectator::Matchers
"is the same size as #{expected.label}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual_value = actual.value
return unexpected(actual_value, actual.label) unless actual_value.responds_to?(:size?)
@ -19,7 +19,7 @@ module Spectator::Matchers
expected.value.size == actual_value.size
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -29,7 +29,7 @@ module Spectator::Matchers
"#{actual.label} is not the same size as #{expected.label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -10,11 +10,11 @@ module Spectator::Matchers
# that is suitable for most matchers.
# Matchers based on this class need to define `#match?` and `#failure_message`.
# If the matcher can be negated,
# the `#failure_message_when_negated` method needs to be overriden.
# the `#failure_message_when_negated` method needs to be overridden.
# Additionally, the `#does_not_match?` method can be specified
# if there's custom behavior for negated matches.
# If the matcher operates on or has extra data that is useful for debug,
# then the `#values` and `#negated_values` methods can be overriden.
# then the `#values` and `#negated_values` methods can be overridden.
# Finally, define a `#description` message that can be used for the one-liner "it" syntax.
abstract struct StandardMatcher < Matcher
# Actually performs the test against the expression (value or block).
@ -47,7 +47,7 @@ module Spectator::Matchers
end
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -55,7 +55,7 @@ module Spectator::Matchers
# Actual values should be returned by `#values`.
private abstract def failure_message(actual : Expression(T)) : String forall T
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.
@ -70,14 +70,14 @@ module Spectator::Matchers
raise "Negation with #{self.class} is not supported."
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private abstract def match?(actual : Expression(T)) : Bool forall T
# If the expectation is negated, then this method is called instead of `#match?`.
#
# The default implementation of this method is to invert the result of `#match?`.
# If the matcher requires custom handling of negated matches,
# then this method should be overriden.
# then this method should be overridden.
# Remember to override `#failure_message_when_negated` as well.
private def does_not_match?(actual : Expression(T)) : Bool forall T
!match?(actual)

View File

@ -102,12 +102,12 @@ module Spectator::Matchers
RegexMatcher.new(expected)
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
@truthy == !!actual.value
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -117,7 +117,7 @@ module Spectator::Matchers
"#{actual.label} is #{negated_label}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -16,12 +16,12 @@ module Spectator::Matchers
"is a #{Expected}"
end
# Checks whether the matcher is satisifed with the expression given to it.
# Checks whether the matcher is satisfied with the expression given to it.
private def match?(actual : Expression(T)) : Bool forall T
actual.value.is_a?(Expected)
end
# Message displayed when the matcher isn't satisifed.
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
#
@ -31,7 +31,7 @@ module Spectator::Matchers
"#{actual.label} is not a #{Expected}"
end
# Message displayed when the matcher isn't satisifed and is negated.
# Message displayed when the matcher isn't satisfied and is negated.
# This is essentially what would satisfy the matcher if it wasn't negated.
#
# This is only called when `#does_not_match?` returns false.

View File

@ -6,11 +6,11 @@ module Spectator::Matchers
#
# Matchers based on this class need to define `#match?` and `#failure_message`.
# If the matcher can be negated,
# the `#failure_message_when_negated` method needs to be overriden.
# the `#failure_message_when_negated` method needs to be overridden.
# Additionally, the `#does_not_match?` method can be specified
# if there's custom behavior for negated matches.
# If the matcher operates on or has extra data that is useful for debug,
# then the `#values` and `#negated_values` methods can be overriden.
# then the `#values` and `#negated_values` methods can be overridden.
# Finally, define a `#description` message that can be used for the one-liner "it" syntax.
#
# The failure messages should typically only contain the test expression labels.

View File

@ -2,7 +2,7 @@ require "json"
require "./example"
module Spectator
# Information about the runtimes of examples.
# Information about the runtime of examples.
class Profile
include Indexable(Example)

View File

@ -38,13 +38,13 @@ class Object
::Spectator::Harness.current.report(expectation)
end
# Works the same as `#should` except that the condition check is postphoned.
# Works the same as `#should` except that the condition check is postponed.
# The expectation is checked after the example finishes and all hooks have run.
def should_eventually(matcher, message = nil)
::Spectator::Harness.current.defer { should(matcher, message) }
end
# Works the same as `#should_not` except that the condition check is postphoned.
# Works the same as `#should_not` except that the condition check is postponed.
# The expectation is checked after the example finishes and all hooks have run.
def should_never(matcher, message = nil)
::Spectator::Harness.current.defer { should_not(matcher, message) }

View File

@ -100,7 +100,7 @@ module Spectator
end
# Completes a previously defined example group and pops it off the group stack.
# Be sure to call `#start_group` and `#end_group` symmetically.
# Be sure to call `#start_group` and `#end_group` symmetrically.
def end_group : Nil
Log.trace { "End group: #{current}" }
raise "Can't pop root group" if root?
@ -164,14 +164,14 @@ module Spectator
end
# Registers a new "after_suite" hook.
# The hook will be prepended to the list.
# The hook will be pre-pended to the list.
# A new hook will be created by passing args to `ExampleGroupHook.new`.
def after_suite(*args, **kwargs) : Nil
root.before_all(*args, **kwargs)
end
# Registers a new "after_suite" hook.
# The hook will be prepended to the list.
# The hook will be pre-pended to the list.
# A new hook will be created by passing args to `ExampleGroupHook.new`.
def after_suite(*args, **kwargs, &block) : Nil
root.after_all(*args, **kwargs, &block)