Commit graph

544 commits

Author SHA1 Message Date
Michael Miller
8d3ab0d44c Transform named tuple match data to array
Trying to keep some of the existing code (and better syntax).
2019-03-22 10:38:09 -06:00
Michael Miller
66bd1555ac Use Symbol instead of String 2019-03-22 10:35:43 -06:00
Michael Miller
0b467012cb Initial work on match data values management 2019-03-22 10:30:03 -06:00
Michael Miller
dba047e1ec Formatting 2019-03-22 00:16:09 -06:00
Michael Miller
a804907f75 Add text to output for fail-fast 2019-03-22 00:14:36 -06:00
Michael Miller
a31d5c8b5b Implement fail-fast in runner
Report tracks number of omitted tests due to abort.
2019-03-22 00:05:53 -06:00
Michael Miller
9e63c20df2 Add fail-fast to config 2019-03-21 23:40:00 -06:00
Michael Miller
fe81586527 Pass builder instead of individual arguments
Config members will get large.
Preventing a large amount of arguments in advance.
2019-03-21 23:03:13 -06:00
Michael Miller
244947a81d Wrap stringified block with back-ticks 2019-03-21 21:21:05 -06:00
Michael Miller
4a887bb906 Add DSL for expect_raises 2019-03-21 21:18:36 -06:00
Michael Miller
f3ef2e561e Initial implementation of raise_error matcher 2019-03-21 21:10:16 -06:00
Michael Miller
72ccafb8b7 Pass subject to proc via partial 2019-03-21 21:09:46 -06:00
Michael Miller
e552cbffd2 Fix DSL usage of BlockExpectationPartial 2019-03-19 21:20:23 -06:00
Michael Miller
33e3b5a811 Use {{yield}} only in methods
The {{yield}} expression wraps the block with "begin ... end".
For some reason classes and modules can be defined in a "begin ... end"
block, but that might change.
2019-03-10 06:42:51 -06:00
Michael Miller
0ca0ba0a55 Fix tests to account for negation wrappers 2019-03-07 16:12:23 -07:00
Michael Miller
37f2ce99a3 Simplify negated usage and expose value 2019-03-07 15:34:55 -07:00
Michael Miller
ee7a91c3dd Add negation wrappers
Fixes the reported expected values when the expectation is negated.
2019-03-06 21:39:28 -07:00
Michael Miller
018e3232cd Update RangeMatcher to use MatchData
There is a compilation error.
It appears that since the last Matcher#match method has been
implemented,
Crystal is finally grouping all of the NamedTuples together.
2019-03-06 15:01:00 -07:00
Michael Miller
acf52e1553 Pass through prefixed value #inspect method 2019-03-06 14:30:46 -07:00
Michael Miller
fbee1d9461 Update RegexMatcher to use MatchData 2019-03-06 13:10:16 -07:00
Michael Miller
f29aba42d2 Update TruthyMatcher to use MatchData 2019-03-06 13:04:18 -07:00
Michael Miller
5fd1547ced Fix verbage around failure message 2019-03-06 12:01:32 -07:00
Michael Miller
6e62ccdfc5 Update TypeMatcher to use MatchData 2019-03-06 11:19:57 -07:00
Michael Miller
81e20b13ec Update PredicateMatcher to use MatchData 2019-03-06 11:05:13 -07:00
Michael Miller
6ab2aad532 Update HaveMatcher to use MatchData 2019-03-06 10:29:00 -07:00
Michael Miller
a78b80ed1f Update StartWithMatcher to use MatchData 2019-03-06 09:33:36 -07:00
Michael Miller
76d09a22ff Update HaveValueMatcher to use MatchData 2019-03-06 02:19:12 -07:00
Michael Miller
3f1d8751fe Update HaveKeyMatcher to use MatchData 2019-03-06 02:02:55 -07:00
Michael Miller
95b4a349da Update InequalityMatcher to use MatchData 2019-03-05 19:00:49 -07:00
Michael Miller
d35a739e60 Update LessThanMatcher to use MatchData 2019-03-05 16:53:15 -07:00
Michael Miller
f846408848 Update LessThanEqualMatcher to use MatchData 2019-03-05 16:37:51 -07:00
Michael Miller
36d3bd0a70 Update GreaterThanMatcher to use MatchData 2019-03-05 16:28:29 -07:00
Michael Miller
83d398465f Update GreaterThanEqualMatcher to use MatchData
Add PrefixedValue type to help convey values better (without string
concat).
2019-03-05 15:39:30 -07:00
Michael Miller
27409f4a92 Display last item and full list when #last is used
Only perform one check with #responds_to?.
2019-03-05 13:52:59 -07:00
Michael Miller
52f8c52a58 Fix EndWithMatcher compile errors 2019-03-04 21:43:26 -07:00
Michael Miller
7b0f607a6a Update EndWithMatcher to use MatchData 2019-03-04 20:16:21 -07:00
Michael Miller
1090a7f2f3 Fix botched copy/paste 2019-03-04 18:30:18 -07:00
Michael Miller
e7441df159 Update AttributesMatcher to use MatchData
This is a glorious mess.
2019-03-04 16:06:20 -07:00
Michael Miller
df663d30d9 Update EmptyMatcher to use MatchData 2019-03-03 20:21:39 -07:00
Michael Miller
be3218bcd8 Update ContainMatcher to use MatchData 2019-03-03 20:03:20 -07:00
Michael Miller
cdef7f9fa3 Use macro yield and remove &block when not needed 2019-03-03 19:24:56 -07:00
Michael Miller
51765c0c8b Fix strange compiler error
Compiler said there was an error, but not what it was.
The compiler wasn't clear where the issue was either.
2019-03-03 19:06:37 -07:00
Michael Miller
e38bcd544a Update CaseMatcher to use MatchData 2019-03-03 19:05:20 -07:00
Michael Miller
50a782b803 Minor adjustments to equality matcher 2019-03-03 12:26:31 -07:00
Michael Miller
ffed61b9e3 Implement condensed document output 2019-03-03 11:56:43 -07:00
Michael Miller
52a6a645b9 Display group names 2019-03-03 11:05:28 -07:00
Michael Miller
f338e9b99d Add -v argument to use document formatter 2019-03-03 10:52:15 -07:00
Michael Miller
a3c4d06e45 WIP code for document formatter (-v) 2019-03-03 10:51:52 -07:00
Michael Miller
ca92fbb29f Extend self in Spectator module 2019-03-03 10:49:28 -07:00
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
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
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
b855599ce6 Workaround for strange compiler error 2019-02-28 10:53:03 -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
002c1d892b Adjust how Result#call works 2019-02-20 21:00:22 -07:00
Michael Miller
8f85a6436f Rewrite to use indentation methods 2019-02-20 20:09:23 -07:00
Michael Miller
1cd0f0249e Create struct for colorized comment 2019-02-19 19:56:07 -07:00
Michael Miller
4126ee3451 Some work on FailureBlock 2019-02-17 23:15:58 -07:00
Michael Miller
f2c17189fc Adjust (mostly remove) explicit return types 2019-02-17 23:12:16 -07:00
Michael Miller
b646b8bec5 Remove unused ExampleStatus enum 2019-02-17 23:09:23 -07:00
Michael Miller
eaf1d19feb Move the expectations attribute up to FinishedResult 2019-02-17 23:03:43 -07:00
Michael Miller
847cc662bd Update docs
Mostly fixes around symbols for syntax.
Added some missing docs and updated incorrect or vague ones.
2019-02-17 23:01:43 -07:00