Sha256: 7d5e91d659ab47db3d4d19f9180d84d1cc6071fce80577d2653926075f1c8534

Contents?: true

Size: 883 Bytes

Versions: 1

Compression:

Stored size: 883 Bytes

Contents

module TestRocket
  extend Module.new { attr_accessor :out }
  
  def _test(a, b)
    send((call rescue()) ? a : b)
  end
  
  def launched?
    !!($launched rescue())
  end

  def +@; r = _test :_pass, :_fail; (TestRocket.out || $>) << r; r end
  def -@; r = _test :_fail, :_pass; (TestRocket.out || $>) << r; r end
  def ~@; r = _pend;                (TestRocket.out || $>) << r; r end
  def !@; r = _desc;                (TestRocket.out || $>) << r; r end
  
  def _pass; ($targets += 1; $hits += 1) if launched?; "    OK\n"; end
  def _fail; ($targets += 1)             if launched?; "    FAIL @ #{source_location.join(':')}\n"; end
  def _pend; ($targets += 1; $lost += 1) if launched?; "    PENDING '#{call.to_s}' @ #{source_location.join(':')}\n"; end
  def _desc;                                           "  FIRE '#{call.to_s}'!\n"; end

end
Proc.send :include, TestRocket

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aki-testrocket-0.0.3 lib/testrocket.rb