lib/testrocket.rb in testrocket-0.0.1 vs lib/testrocket.rb in testrocket-0.0.2

- old
+ new

@@ -1,15 +1,18 @@ module TestRocket - module Out; attr_accessor :out; end; extend Out - - def _test(a, b) - send((call rescue()) ? a : b) - end + extend Module.new { attr_accessor :out } - def +@; r = _test :_pass, :_fail; (TestRocket.out || $>).puts r; r end - def -@; r = _test :_fail, :_pass; (TestRocket.out || $>).puts r; r end + def _test(a, b); send((call rescue()) ? a : b) end - def _pass; ' OK'; end - def _fail; "FAIL @ #{source_location.join(':')}"; end + def +@; _show _test :_pass, :_fail end + def -@; _show _test :_fail, :_pass end + def ~; _show _pend; end + def !; _show _desc; end + + def _show(r); (TestRocket.out || $>) << r + "\n"; r end + def _pass; " OK" end + def _fail; " FAIL @ #{source_location * ':'}" end + def _pend; "PENDING '#{call}' @ #{source_location * ':'}" end + def _desc; " FIRE '#{call}'!" end end -Proc.send :include, TestRocket \ No newline at end of file +Proc.send :include, TestRocket