From 728477914fe4047bc4a31a0d0f7247786bea80f2 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 6 Apr 2019 12:13:39 -0600 Subject: [PATCH] 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) --- src/spectator/formatting/failure_block.cr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/spectator/formatting/failure_block.cr b/src/spectator/formatting/failure_block.cr index 4b7276e..dcd8202 100644 --- a/src/spectator/formatting/failure_block.cr +++ b/src/spectator/formatting/failure_block.cr @@ -52,8 +52,12 @@ module Spectator::Formatting # Produces a list of unsatisfied expectations and their values. private def unsatisfied_expectations(indent) - @result.expectations.each_unsatisfied do |expectation| - indent.line(Color.failure(LabeledText.new("Failure", expectation.actual_message))) + @result.expectations.each do |expectation| + if expectation.satisfied? + indent.line(Color.success(LabeledText.new("Success", expectation.actual_message))) + else + indent.line(Color.failure(LabeledText.new("Failure", expectation.actual_message))) + end indent.line indent.increase do matcher_values(indent, expectation)