Commit graph

937 commits

Author SHA1 Message Date
Michael Miller
5481c3d431 Formatting 2019-03-03 10:32:00 -07:00
Michael Miller
8310ea2aa5 Label exception with type 2019-03-03 10:30:58 -07:00
Michael Miller
6307024af3 Colorize matcher values green and red 2019-03-03 10:26:03 -07:00
Michael Miller
df71e56b3e Replace FailureMessage with LabeledText 2019-03-03 10:19:17 -07:00
Michael Miller
2c5da0c345 Move message line inside content
This allows for multiple message lines for multiple expectations.
2019-03-03 10:11:46 -07:00
Michael Miller
238dc38a36 Use Indent tracker type 2019-03-03 09:54:39 -07:00
Michael Miller
8cdc5f0b3f Fix indent and add empty line method 2019-03-03 09:54:09 -07:00
Michael Miller
f73a51ae0c WIP display all expectations
Display the error stacktrace after expectations if the result is an 
ErroredResult.
2019-03-03 09:48:44 -07:00
Michael Miller
66c1dc3bce Create indentation guide type 2019-03-03 09:46:12 -07:00
Michael Miller
e722cc4f1f Initial code for displaying errors 2019-02-28 22:16:33 -07:00
Michael Miller
f37105af5e Add padding to pairs to right-align key 2019-02-28 20:14:03 -07:00
Michael Miller
cc3392022e Move value enumeration to another type 2019-02-28 19:49:23 -07:00
Michael Miller
0fce18a610 Use inspect instead of to_s for values 2019-02-28 19:29:24 -07:00
Michael Miller
daf2f43f25 Rename module from Formatters to Formatting 2019-02-28 19:14:03 -07:00
Michael Miller
80150f945b Change back to passing text as argument 2019-02-28 16:48:26 -07:00
Michael Miller
1610d6ebe3 Create a type to output a key-value pair 2019-02-28 16:46:50 -07:00
Michael Miller
4e3290ebfe Initial code to get match data values to output
Expose the match data values through the Expectation class.
2019-02-28 16:35:50 -07:00
Michael Miller
0a48b5f447 Use block with line method 2019-02-28 16:30:56 -07:00
Michael Miller
d5bef6f1da Fix flipped expected and actual labels
NilMatcher output was correct, but variables were named incorrectly.
2019-02-28 16:08:22 -07:00
Michael Miller
1219b19d89 Support shorthand &.foo(ARGS) syntax 2019-02-28 15:40:04 -07:00
Michael Miller
619927b3e6 Forgot to swap label and expected in DSL 2019-02-28 15:22:14 -07:00
Michael Miller
6942e70024 Remove unnecessary type specification 2019-02-28 15:18:56 -07:00
Michael Miller
65dd6243dd Rename to match class name 2019-02-28 15:17:50 -07:00
Michael Miller
5ba03a90ff Swap label and expected value parameters
This matches the partial initializer parameters.
Also cleaned up some code in the Expectation spec.
2019-02-28 15:17:12 -07:00
Michael Miller
f3e50c6432 TruthyMatcher doesn't need to store a label
Extend from Matcher instead of ValueMatcher to bypass storing the label.
The "expected" value is still used, but is renamed to "truthy" and used
for the label.
2019-02-28 14:52:15 -07:00
Michael Miller
226708cb82 Abstract Matcher#label getter
There's no need to store a value for this.
Some matchers have a static label.
2019-02-28 14:48:46 -07:00
Michael Miller
8cc66b538f Condense the ExpectedActual initializer
Made label and expected value public.
2019-02-28 14:41:30 -07:00
Michael Miller
4c7e8a3225 Condense expected and actual values and labels
Created a new struct specifically to store expected and actual valuesand
their user labels.
2019-02-28 14:05:31 -07:00
Michael Miller
520901332e Remove dummy MatchData type
Also fix for undefined MatchData type in Matcher types.
2019-02-28 13:53:54 -07:00
Michael Miller
b4af87f903 Fix fallout from last commit in Expectation spec
All tests pass in this commit!
2019-02-28 13:52:01 -07:00
Michael Miller
e6ce54202d Remove Matcher methods moved to MatchData
Update spec for EqualityMatcher to reflect this.
2019-02-28 13:47:50 -07:00
Michael Miller
b4502711cd Add MatchData for EqualityMatcher
crystal spec runs, but fails for this commit.
2019-02-28 13:32:38 -07:00
Michael Miller
94cbb9860a Update NilMatcher to use MatchData and #match 2019-02-28 11:31:05 -07:00
Michael Miller
0dd66c8803 Update Expectation spec to use new parameters 2019-02-28 11:07:16 -07:00
Michael Miller
b855599ce6 Workaround for strange compiler error 2019-02-28 10:53:03 -07:00
Michael Miller
26187a0f31 Fix oddity with type being unresolvable 2019-02-27 22:20:57 -07:00
Michael Miller
c1f61d68bf Use MatchData 2019-02-26 20:29:04 -07:00
Michael Miller
0bf106ab2e Placeholders for #match method 2019-02-23 22:33:33 -07:00
Michael Miller
42d8eb6da3 Matched flag isn't needed (match data has it) 2019-02-23 22:26:49 -07:00
Michael Miller
1e1503331e Initial change to MatchData 2019-02-23 21:52:10 -07:00
Michael Miller
87ca825845 Return 1 on failure 2019-02-22 16:54:36 -07:00
Michael Miller
487726ea54 Move failure command it's own type 2019-02-22 16:43:25 -07:00
Michael Miller
e92b1dc466 Add #failed? method to Report 2019-02-22 15:09:55 -07:00
Michael Miller
dbffad837d Calculate each type of result once at initialization 2019-02-22 13:54:12 -07:00
Michael Miller
5c2747efc0 Move stats to their own types 2019-02-22 13:47:57 -07:00
Michael Miller
48a1e61949 Change FailueBlock to a private struct 2019-02-20 21:47:18 -07:00
Michael Miller
0ca300ba89 Move characters constant to sub-module 2019-02-20 21:38:23 -07:00
Michael Miller
e752f901a5 Move more failure block chunks to their own structs 2019-02-20 21:28:11 -07:00
Michael Miller
bef3243c6c Remove unecessary result parameter 2019-02-20 21:22:42 -07:00
Michael Miller
919e2b96f6 Update specs for new Result#call functionality 2019-02-20 21:17:27 -07:00