Commit graph

755 commits

Author SHA1 Message Date
Michael Miller
f01fb2df4b Post-conditions work, pre-conditions don't 2019-04-06 12:20:08 -06:00
Michael Miller
c6c80ccb8e Removing pre- and post-conditions fix the issue 2019-04-06 12:18:34 -06:00
Michael Miller
728477914f Showing all expectations in default output works
JSON output still crashes.
Is there are bug in the JSON builder?

Invalid memory access (signal 11) at address 0x7fe500000300
[0x55924f801836] *CallStack::print_backtrace:Int32 +118
[0x55924f7f21f0] __crystal_sigfault_handler +192
Program exited because of a segmentation fault (11)
2019-04-06 12:13:39 -06:00
Michael Miller
f336b1261b Segfault still occurring
Traced it to the message method in equality matcher.
Looks like converting the string to JSON causes the issue, don't know 
why.
Static string with no variables gets optimized out and still has the 
problem.
2019-04-06 12:08:27 -06:00
Michael Miller
0f4a92e5b2 Placeholder negate method to get around first issue
All match data values now have a negate method, but it might not do 
anything.
With this change, a segfault occurs during output.

Invalid memory access (signal 11) at address 0x0
[0x55f0f6604906] *CallStack::print_backtrace:Int32 +118
[0x55f0f65f52c0] __crystal_sigfault_handler +192
[0x7fa1f7a8a890] ???
[0x55f0f6612cf6] *Slice(T):🆕read_only<Pointer(UInt8), Int32, 
Bool>:Slice(UInt8) +22
[0x55f0f6608265] *String#to_slice:Slice(UInt8) +37
[0x55f0f6608208] *String#to_s<String::Builder>:Nil +24
[0x55f0f6611b91] *String::Builder +17
[0x55f0f667ab7a] 
*Spectator::Matchers::EqualityMatcher::MatchData(String, String) +26
Program exited because of a segmentation fault (11)
2019-04-06 11:55:37 -06:00
Michael Miller
61ee8ce1e1 Add spec that produces error
When forcing all expectations to be shown (via --json), an error occurs.
It looks like Crystal doesn't know what the types of some expectation 
values are.

can't execute `value.negate` at 
/home/michael/Projects/spectator/src/spectator/expectations/expectation.cr:28:13: 
`value` has no type
src/spectator/expectations/expectation.cr:28:13 in 'values'
src/spectator/expectations/expectation.cr:266:5 in 'to_json'
src/spectator/expectations/example_expectations.cr:58:16 in 'to_json'
/usr/share/crystal/src/json/builder.cr:249:5 in 'field'
src/spectator/finished_result.cr:24:7 in 'add_json_fields'
src/spectator/result.cr:29:9 in 'to_json'
src/spectator/formatting/json_formatter.cr:40:7 in 'end_example'
src/spectator/runner.cr:59:32 in 'run_example'
src/spectator/runner.cr:35:9 in 'collect_results'
src/spectator/runner.cr:356:5 in 'run'
src/spectator.cr:107:5 in 'run'
src/spectator.cr:81:29 in '->'
/usr/share/crystal/src/kernel.cr:255:3 in 'run'
/usr/share/crystal/src/crystal/main.cr:47:5 in 'main'
/usr/share/crystal/src/crystal/main.cr:106:3 in 'main'
__libc_start_main
_start
???
2019-04-06 11:53:51 -06:00
Michael Miller
12c71a25cd Merge branch 'master' of gitlab.com:arctic-fox/spectator 2019-04-05 23:53:55 -06:00
Michael Miller
9650d7f9c1 Use inspect on values in to_s
The to_json method calls to_s, which results in incorrect output.
2019-04-05 23:13:23 -06:00
Michael Miller
53de72805b Add skip macro as alternative to pending 2019-04-05 20:07:04 -06:00
Michael Miller
c18d9c4ffd Allow top-level context macro 2019-04-05 18:38:57 -06:00
Michael Miller
7a0e28945a Merge branch 'master' of gitlab.com:arctic-fox/spectator 2019-04-03 18:20:24 -06:00
Michael Miller
31a2bbcebb random_sample should use Spectator's global random 2019-04-02 22:22:40 -06:00
Michael Miller
57c54d943c Add info on generated docs 2019-04-02 22:10:52 -06:00
Michael Miller
675ef60f9d Consistent version 2019-04-02 22:05:27 -06:00
Michael Miller
7a8ebf6db5 Generate docs and publish to pages 2019-04-02 21:38:36 -06:00
Michael Miller
157fdb813c Fix doc regarding hook execution order 2019-04-02 19:46:32 -06:00
Michael Miller
fef8715ce1 Allow it, pending, and xit to omit what 2019-03-31 20:56:08 -06:00
Michael Miller
58031e01c6 Missed a usage of yield that should be block 2019-03-31 18:53:40 -06:00
Michael Miller
60f50b6378 Add ability to name subjects 2019-03-31 12:53:00 -06:00
Michael Miller
0990b0fde2 Add before/after hook example 2019-03-31 12:47:34 -06:00
Michael Miller
2cea10a124 Fix undefined user variable in example 2019-03-31 12:47:22 -06:00
Michael Miller
b78b6dde54 Update README with more examples 2019-03-31 12:45:58 -06:00
Michael Miller
0b8d624a94 Expand matcher checklist
This better shows which matchers are actually implemented.
2019-03-31 10:48:00 -06:00
Michael Miller
785f2ef2dd Missing doc 2019-03-30 18:38:06 -06:00
Michael Miller
2ea69d2355 Add spec for array matcher 2019-03-30 18:38:06 -06:00
Michael Miller
27ec27a3f3 Add array matcher 2019-03-30 18:38:06 -06:00
Michael Miller
cd60fae157 Add respond_to matcher 2019-03-28 23:20:32 -06:00
Michael Miller
151108b063 Update shard info 2019-03-27 20:08:33 -06:00
Michael Miller
2e4793fdf1 Update README 2019-03-27 20:08:06 -06:00
Michael Miller
e87314be58 Use block instead of yield to insert block
The "yield" method produces `begin...end`.
The "block" method produces `do...end`, which is needed for this syntax.
2019-03-26 21:45:31 -06:00
Michael Miller
2da1f9dbbf Missed one 2019-03-26 18:05:08 -06:00
Michael Miller
007c0c7950 Fix "missing" variables caused by wrong macro syntax 2019-03-26 17:59:15 -06:00
Michael Miller
44e681ae79 Change JSON timing values to seconds as a float 2019-03-25 16:56:38 -06:00
Michael Miller
4eb8eadd9e Add profile info to JSON output 2019-03-25 16:54:27 -06:00
Michael Miller
df6431f2d7 Add profile summary to TAP output 2019-03-25 16:49:57 -06:00
Michael Miller
291a927f1e Add profile information to suite summary 2019-03-25 16:44:20 -06:00
Michael Miller
34b0399654 Use example_runtime instead of total runtime
This fixes the issue where < 10 examples in profile showed less than 
100% total time.
2019-03-25 16:31:01 -06:00
Michael Miller
72aa72781a Move human time to its own type to share it 2019-03-25 16:15:00 -06:00
Michael Miller
aabc25ad4f Change formatters to take nillable profile 2019-03-25 16:05:38 -06:00
Michael Miller
6dd4c4bc2f Add Profile class 2019-03-25 15:54:51 -06:00
Michael Miller
a02e2ff701 Add profile config option 2019-03-25 12:26:45 -06:00
Michael Miller
35b887f8f0 Add placeholders for profile functionality 2019-03-25 12:13:11 -06:00
Michael Miller
2d88097c04 Re-implement filters in command-line arguments 2019-03-25 11:39:27 -06:00
Michael Miller
2ff9505766 Add filter to TestSuite 2019-03-25 11:35:39 -06:00
Michael Miller
49c396714e Revert 29279e1
Update Runner to not use Iterable#each
2019-03-25 11:29:20 -06:00
Michael Miller
3654b2473b Add example filter to config 2019-03-25 11:17:53 -06:00
Michael Miller
d1767ebb7a Add CompositeExampleFilter 2019-03-25 11:10:27 -06:00
Michael Miller
481319c097 Add NullExampleFilter 2019-03-25 10:58:49 -06:00
Michael Miller
a3c1892465 Move example filters from === to their own types 2019-03-25 10:51:50 -06:00
Michael Miller
b2ab579d8a Remove --pattern option
This can be handled by calling `crystal spec`.
2019-03-25 10:51:20 -06:00