Module: PropCheck::Property::OutputFormatter Private

Extended by:
OutputFormatter
Included in:
OutputFormatter
Defined in:
lib/prop_check/property/output_formatter.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#post_output(output, n_shrink_steps, shrunken_result, shrunken_exception) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/prop_check/property/output_formatter.rb', line 19

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

#pre_output(output, n_successful, generated_root, problem) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/prop_check/property/output_formatter.rb', line 6

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



34
35
36
37
38
39
40
# File 'lib/prop_check/property/output_formatter.rb', line 34

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