Michael Miller
5cc735368c
Update comparison matchers
2019-08-01 21:17:24 -06:00
Michael Miller
42b8fe471f
Fix some includes and a dangling old file
2019-08-01 16:37:19 -06:00
Michael Miller
11600a2f8d
Simplify more matchers that are easy targets
2019-08-01 16:35:02 -06:00
Michael Miller
16a2204a2d
Simplify CaseMatcher by using new matcher refactoring
2019-08-01 16:17:39 -06:00
Michael Miller
c75fba8076
Change visibility to private
2019-08-01 16:17:12 -06:00
Michael Miller
4b59dcf142
Pass actual value to failure message methods and values
2019-08-01 16:02:28 -06:00
Michael Miller
f63697b019
Update ValueMatcher to use Matcher's methods
2019-08-01 15:59:29 -06:00
Michael Miller
114a4077f3
Fix parameters on LabeledValue
2019-08-01 15:58:48 -06:00
Michael Miller
f004912fc1
Value first, then label
2019-08-01 15:48:39 -06:00
Michael Miller
7e3b3cd999
Fix namespaces
2019-08-01 15:44:04 -06:00
Michael Miller
99d8f2a845
Use TestValue instead of custom LabeledValue
2019-08-01 15:40:46 -06:00
Michael Miller
763a65beac
Rename again
...
This naming is more appropriate since these types can be used for
expected and actual values.
2019-08-01 15:38:20 -06:00
Michael Miller
dd69cec536
Should capture a block instead of a value
2019-08-01 15:22:45 -06:00
Michael Miller
28680fa849
Rename Actual types to be more "human" sounding
2019-08-01 15:22:18 -06:00
Michael Miller
79a095bb31
Use new style expectations and actuals in DSL
2019-08-01 15:00:56 -06:00
Michael Miller
96c271cf33
No need to shout
2019-08-01 14:46:47 -06:00
Michael Miller
ba1c37b142
Fix macro
2019-08-01 14:46:13 -06:00
Michael Miller
10cf7bbb77
Update Expectation to use new MatchData
2019-08-01 14:05:27 -06:00
Michael Miller
96f2888b88
Fully implement match methods
...
Add placeholders for matcher values.
2019-08-01 14:05:05 -06:00
Michael Miller
acd01a23e6
Re-add MatchData and variants
2019-08-01 14:04:00 -06:00
Michael Miller
ae43c930bf
Replace MatchDataValue types with a single LabeledValue
2019-08-01 13:49:08 -06:00
Michael Miller
43ba4de202
Merge branch 'matcher-refactor-split' into matcher-refactor
2019-07-31 21:04:28 -06:00
Michael Miller
3a7dc7299a
Rewrite ExpectationPartial and remove sub-types
...
The partial now contains the actual and source.
It also calls the correct match method on the matcher and constructs an
expectation (which needs to be updated).
2019-07-31 20:11:30 -06:00
Michael Miller
42b916bdf7
New "actual" types
2019-07-31 20:01:39 -06:00
Michael Miller
e95c81f46e
Pass negation flag to matcher
...
Some matchers need to know if they're negated to work properly and can't
be simply negated afterwards.
2019-07-30 16:19:27 -06:00
Michael Miller
ab1c0269e0
Remove DummyMatchData
...
No longer needed since MatchData was changed to non-abstract.
2019-07-30 16:13:48 -06:00
Michael Miller
a06247bb1e
Change MatchData to Expectation
...
After including negation into matcher logic, these types are equivalent.
2019-07-30 16:11:55 -06:00
Michael Miller
27f844ce25
Remove abstract base match data
...
Switching to a single type that holds the data.Trying to reduce the
number of types and generic types generated.
2019-07-30 16:08:06 -06:00
Michael Miller
c7e6b82a9a
Change wording around let variant
...
The value is set when the expression is run at program startup, not when
the test starts.
2019-07-19 23:10:22 +00:00
Michael Miller
98476057f5
Implement assignment variant of let keyword
...
Resolves #18
2019-07-19 16:44:00 -06:00
Michael Miller
3c7bbe4e42
Allow actual collection to be enumerable, not just array
...
Force expected collection to an array.
2019-06-12 15:36:09 -06:00
Michael Miller
19d52ff02b
Add unordered array matcher
2019-06-12 15:35:33 -06:00
Michael Miller
3ff5b2ac5e
Capture element type
2019-06-12 13:58:11 -06:00
Michael Miller
efde29c90e
Add have_size_of matcher
2019-06-09 12:45:49 -06:00
Michael Miller
bb2b834662
Add have_size matcher
2019-06-09 12:44:46 -06:00
Michael Miller
091cbaa81a
Cleanup have_ variant by using a new matcher
2019-06-01 23:27:16 -06:00
Michael Miller
16bcce59ae
Handle have_
prefix for matcher
2019-06-01 23:14:58 -06:00
Michael Miller
45f0f7f6d1
Include predicate arguments in label
2019-06-01 23:06:39 -06:00
Michael Miller
36f53d82db
Use label from matcher macro
2019-06-01 22:53:12 -06:00
Michael Miller
7e73ec2fe1
Allow passing arguments to predicate matcher
2019-06-01 22:46:06 -06:00
Michael Miller
cc4ab9756a
Fix the actual type reported by the type matcher
...
If an object has a difference between compiler and runtime type, then
the type matcher would report the actual as the compiler type.
The match would be successful, because it uses the runtime check
(is_a?).
2019-06-01 20:48:24 -06:00
Michael Miller
ca564619ad
Change example wrapper type to a class
...
Fixes issue #11 .
Variables (defined with let) were getting re-created between the hooks
and the example code.
This was due to a separate struct value being returned for each fetch to
the wrapped example instance.
In turn, the wrappers for variables were reset for each fetch.
2019-06-01 20:10:08 -06:00
Michael Miller
01b5d71ad0
Fixed an issue where named subjects could crash the compiler
...
Received:
Nil assertion failed (NilAssertionError)
from ???
...
Error: you've found a bug in the Crystal compiler. ...
for this code:
subject(point) { Point.new }
describe "#x" do
subject { point.x }
end
Redefining subjects with a named subject broke.
This commit fixes that with a simply flip in the definitions.
2019-05-21 13:44:19 -06:00
Michael Miller
77307f6eb1
Split part of RangeMatcher off as CollectionMatcher
...
Use CollectionMatcher for `be_within`.
The `#of` method creates a RangeMatcher.
2019-05-16 18:20:08 -06:00
Michael Miller
fa5c13df0e
Remove min-max variation of be_within
...
Use `be_between(min, max)` instead.
This matches RSpec.
2019-05-16 18:09:21 -06:00
Michael Miller
0fc28241dd
Add be_between matcher which is an alias of be_within
2019-05-14 21:50:09 -06:00
Michael Miller
2378594c5d
Use reference matching for be()
2019-05-08 16:59:59 -06:00
Michael Miller
f53bc26c28
Add ReferenceMatcher type
2019-05-08 16:59:36 -06:00
Michael Miller
7168b26218
Remove regex matcher - use case matcher
2019-05-08 16:39:00 -06:00
Michael Miller
6d81e26298
Fix for issue #4
2019-05-08 15:22:32 -06:00