Sha256: d7afd874db33c044fd713b0a5c8abfe2e92965d219fbe507e57606d29422ba98

Contents?: true

Size: 1.09 KB

Versions: 17

Compression:

Stored size: 1.09 KB

Contents

##
# @api private
module PropCheck::Property::OutputFormatter
  extend self

  def pre_output(output, n_successful, generated_root, problem)
    output.puts ""
    output.puts "(after #{n_successful} successful property test runs)"
    output.puts "Failed on: "
    output.puts "`#{print_roots(generated_root)}`"
    output.puts ""
    output.puts "Exception message:\n---\n#{problem}"
    output.puts "---"
    output.puts ""

    output
  end

  def post_output(output, n_shrink_steps, shrunken_result, shrunken_exception)
    if n_shrink_steps == 0
      output.puts '(shrinking impossible)'
    else
      output.puts ''
      output.puts "Shrunken input (after #{n_shrink_steps} shrink steps):"
      output.puts "`#{print_roots(shrunken_result)}`"
      output.puts ""
      output.puts "Shrunken exception:\n---\n#{shrunken_exception}"
      output.puts "---"
      output.puts ""
    end
    output
  end

  def print_roots(lazy_tree_val)
    if lazy_tree_val.is_a?(Array) && lazy_tree_val.length == 1 && lazy_tree_val[0].is_a?(Hash)
      lazy_tree_val[0].ai
    else
      lazy_tree_val.ai
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
prop_check-0.18.2 lib/prop_check/property/output_formatter.rb
prop_check-0.18.1 lib/prop_check/property/output_formatter.rb
prop_check-0.18.0 lib/prop_check/property/output_formatter.rb
prop_check-0.17.0 lib/prop_check/property/output_formatter.rb
prop_check-0.16.0 lib/prop_check/property/output_formatter.rb
prop_check-0.15.0 lib/prop_check/property/output_formatter.rb
prop_check-0.14.1 lib/prop_check/property/output_formatter.rb
prop_check-0.14.0 lib/prop_check/property/output_formatter.rb
prop_check-0.13.0 lib/prop_check/property/output_formatter.rb
prop_check-0.12.1 lib/prop_check/property/output_formatter.rb
prop_check-0.12.0 lib/prop_check/property/output_formatter.rb
prop_check-0.11.1 lib/prop_check/property/output_formatter.rb
prop_check-0.11.0 lib/prop_check/property/output_formatter.rb
prop_check-0.10.4 lib/prop_check/property/output_formatter.rb
prop_check-0.10.3 lib/prop_check/property/output_formatter.rb
prop_check-0.10.2 lib/prop_check/property/output_formatter.rb
prop_check-0.10.1 lib/prop_check/property/output_formatter.rb