mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Remove unnecessary free variables
This commit is contained in:
parent
3c94d1f8fd
commit
72e4ac8fe9
8 changed files with 20 additions and 20 deletions
|
@ -113,7 +113,7 @@ module Spectator::DSL
|
|||
{% end %}
|
||||
end
|
||||
|
||||
def allow(thing : T) forall T
|
||||
def allow(thing)
|
||||
Mocks::Allow.new(thing)
|
||||
end
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ module Spectator::Formatting
|
|||
end
|
||||
|
||||
# Creates a colorized version of the comment.
|
||||
def self.color(text : T) forall T
|
||||
def self.color(text)
|
||||
Color.comment(new(text))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -63,12 +63,12 @@ module Spectator::Matchers
|
|||
end
|
||||
|
||||
# Specifies what the resulting value of the expression must be.
|
||||
def to(value : T) forall T
|
||||
def to(value)
|
||||
ChangeExactMatcher.new(@expression, @expected, value)
|
||||
end
|
||||
|
||||
# Specifies what the resulting value of the expression should change by.
|
||||
def by(amount : T) forall T
|
||||
def by(amount)
|
||||
ChangeExactMatcher.new(@expression, @expected, @expected + value)
|
||||
end
|
||||
|
||||
|
|
|
@ -49,27 +49,27 @@ module Spectator::Matchers
|
|||
end
|
||||
|
||||
# Specifies what the initial value of the expression must be.
|
||||
def from(value : T) forall T
|
||||
def from(value)
|
||||
ChangeFromMatcher.new(@expression, value)
|
||||
end
|
||||
|
||||
# Specifies what the resulting value of the expression must be.
|
||||
def to(value : T) forall T
|
||||
def to(value)
|
||||
ChangeToMatcher.new(@expression, value)
|
||||
end
|
||||
|
||||
# Specifies that t he resulting value must be some amount different.
|
||||
def by(amount : T) forall T
|
||||
def by(amount)
|
||||
ChangeRelativeMatcher.new(@expression, "by #{amount}") { |before, after| amount == after - before }
|
||||
end
|
||||
|
||||
# Specifies that the resulting value must be at least some amount different.
|
||||
def by_at_least(minimum : T) forall T
|
||||
def by_at_least(minimum)
|
||||
ChangeRelativeMatcher.new(@expression, "by at least #{minimum}") { |before, after| minimum <= after - before }
|
||||
end
|
||||
|
||||
# Specifies that the resulting value must be at most some amount different.
|
||||
def by_at_most(maximum : T) forall T
|
||||
def by_at_most(maximum)
|
||||
ChangeRelativeMatcher.new(@expression, "by at most #{maximum}") { |before, after| maximum >= after - before }
|
||||
end
|
||||
|
||||
|
|
|
@ -57,12 +57,12 @@ module Spectator::Matchers
|
|||
end
|
||||
|
||||
# Specifies what the initial value of the expression must be.
|
||||
def from(value : T) forall T
|
||||
def from(value)
|
||||
ChangeExactMatcher.new(@expression, value, @expected)
|
||||
end
|
||||
|
||||
# Specifies how much the initial value should change by.
|
||||
def by(amount : T) forall T
|
||||
def by(amount)
|
||||
ChangeExactMatcher.new(@expression, @expected - amount, @expected)
|
||||
end
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ module Spectator::Matchers
|
|||
# ```
|
||||
# expect(0).to be < 1
|
||||
# ```
|
||||
def <(value : ExpectedType) forall ExpectedType
|
||||
def <(value)
|
||||
expected = TestValue.new(value)
|
||||
LessThanMatcher.new(expected)
|
||||
end
|
||||
|
@ -37,7 +37,7 @@ module Spectator::Matchers
|
|||
# ```
|
||||
# expect(0).to be <= 1
|
||||
# ```
|
||||
def <=(value : ExpectedType) forall ExpectedType
|
||||
def <=(value)
|
||||
expected = TestValue.new(value)
|
||||
LessThanEqualMatcher.new(expected)
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ module Spectator::Matchers
|
|||
# ```
|
||||
# expect(2).to be > 1
|
||||
# ```
|
||||
def >(value : ExpectedType) forall ExpectedType
|
||||
def >(value)
|
||||
expected = TestValue.new(value)
|
||||
GreaterThanMatcher.new(expected)
|
||||
end
|
||||
|
@ -57,7 +57,7 @@ module Spectator::Matchers
|
|||
# ```
|
||||
# expect(2).to be >= 1
|
||||
# ```
|
||||
def >=(value : ExpectedType) forall ExpectedType
|
||||
def >=(value)
|
||||
expected = TestValue.new(value)
|
||||
GreaterThanEqualMatcher.new(expected)
|
||||
end
|
||||
|
@ -67,7 +67,7 @@ module Spectator::Matchers
|
|||
# ```
|
||||
# expect(0).to be == 0
|
||||
# ```
|
||||
def ==(value : ExpectedType) forall ExpectedType
|
||||
def ==(value)
|
||||
expected = TestValue.new(value)
|
||||
EqualityMatcher.new(expected)
|
||||
end
|
||||
|
@ -77,7 +77,7 @@ module Spectator::Matchers
|
|||
# ```
|
||||
# expect(0).to be != 1
|
||||
# ```
|
||||
def !=(value : ExpectedType) forall ExpectedType
|
||||
def !=(value)
|
||||
expected = TestValue.new(value)
|
||||
InequalityMatcher.new(expected)
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ module Spectator::Mocks
|
|||
nil
|
||||
end
|
||||
|
||||
def and_return(value : T) forall T
|
||||
def and_return(value)
|
||||
ValueMethodStub.new(@name, @source, value, @args)
|
||||
end
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ module Spectator
|
|||
# Adds a new value by duplicating the current set and adding to it.
|
||||
# The new sample values with the additional value is returned.
|
||||
# The original set of sample values is not modified.
|
||||
def add(id : Symbol, name : String, value : T) : TestValues forall T
|
||||
wrapper = TypedValueWrapper(T).new(value)
|
||||
def add(id : Symbol, name : String, value) : TestValues
|
||||
wrapper = TypedValueWrapper.new(value)
|
||||
TestValues.new(@values.merge({
|
||||
id => Entry.new(name, wrapper),
|
||||
}))
|
||||
|
|
Loading…
Reference in a new issue