Files

Rcodetools::XMPTestUnitFilter

Constants

OTHER

Public Class Methods

new(opts = {}) click to toggle source
    # File lib/rcodetools/xmptestunitfilter.rb, line 7
 7:   def initialize(opts = {})
 8:     super
 9:     @output_stdout = false
10:     mod = @parentheses ? :WithParentheses : :Poetry
11:     extend self.class.const_get(mod) unless opts[:_no_extend_module]
12:   end

Private Instance Methods

_value_assertions(klass_value_txt_pair, expression) click to toggle source
    # File lib/rcodetools/xmptestunitfilter.rb, line 54
54:   def _value_assertions(klass_value_txt_pair, expression)
55:     klass_txt, value_txt = klass_value_txt_pair
56:     value = eval(value_txt) || OTHER.new
57:     # special cases
58:     value = nil if value_txt.strip == "nil"
59:     value = false if value_txt.strip == "false"
60:     value_assertions klass_txt, value_txt, value, expression
61:   rescue Exception
62:     return object_assertions(klass_txt, value_txt, expression)
63:   end
annotated_line(line, expression, runtime_data, idx) click to toggle source
    # File lib/rcodetools/xmptestunitfilter.rb, line 15
15:   def annotated_line(line, expression, runtime_data, idx)
16:     indent =  /^\s*/.match(line)[0]
17:     assertions(expression.strip, runtime_data, idx).map{|x| indent + x}.join("\n")
18:   end
assertions(expression, runtime_data, index) click to toggle source
    # File lib/rcodetools/xmptestunitfilter.rb, line 25
25:   def assertions(expression, runtime_data, index)
26:     exceptions = runtime_data.exceptions
27:     ret = []
28: 
29:     unless (vars = runtime_data.bindings[index]).empty?
30:       vars.each{|var| ret << equal_assertion(var, expression) }
31:     end
32:     if !(wanted = runtime_data.results[index]).empty? || !exceptions[index]
33:       case (wanted[0][1] rescue 1)
34:       when "nil"
35:         ret.concat nil_assertion(expression)
36:       else
37:         case wanted.size
38:         when 1
39:           ret.concat _value_assertions(wanted[0], expression)
40:         else
41:           # discard values from multiple runs
42:           ret.concat(["#xmpfilter: WARNING!! extra values ignored"] + 
43:                      _value_assertions(wanted[0], expression))
44:         end
45:       end
46:     else
47:       ret.concat raise_assertion(expression, exceptions, index)
48:     end
49: 
50:     ret
51:   end
prepare_line(expr, idx) click to toggle source
    # File lib/rcodetools/xmptestunitfilter.rb, line 20
20:   def prepare_line(expr, idx)
21:     basic_eval = prepare_line_annotation(expr, idx)
22:     %begin; #{basic_eval}; rescue Exception; $stderr.puts("#{MARKER}[#{idx}] ~> " + $!.class.to_s); end|
23:   end
raise_assertion(expression, exceptions, index) click to toggle source
    # File lib/rcodetools/xmptestunitfilter.rb, line 65
65:   def raise_assertion(expression, exceptions, index)
66:     ["assert_raise(#{exceptions[index][0]}){#{expression}}"]
67:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.