Verified Commit 59ce3123 authored by Mike Miller's avatar Mike Miller
Browse files

Fix typos and spelling

parent bc61e0e6
Pipeline #417962216 passed with stages
in 2 minutes and 51 seconds
......@@ -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
......
......@@ -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.
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
......@@ -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).
#
......
......@@ -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.
......
......@@ -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
......
......@@ -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.
......
......@@ -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
......
......@@ -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.
......
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
......
......@@ -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
......@@ -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]?
......
......@@ -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 %}
......
......@@ -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.
......
......@@ -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.
......
......@@ -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.
......
......@@ -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.
......
......@@ -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.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment