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)
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.
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)
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
???