Sha256: 6e0beb0b55a6c622f5b3a6348f7f1c87b9535259c8b065275bf502a810094b01

Contents?: true

Size: 907 Bytes

Versions: 1

Compression:

Stored size: 907 Bytes

Contents

class AssertionError < StandardError
end

class Object
  
  def >>(res)
    # The expection is assertion[1]
    if res == self
      if $DEBUG
        @assertion_count ||= 0
        @assertion_success ||= 0
        @assertion_count += 1 
        @assertion_success += 1
        # should track a list
      end
    else
      if $DEBUG
        @assertion_count ||= 0
        @assertion_failure ||= 0
        @assertion_count += 1
        @assertion_failure += 1
        # should track a list
      else
        raise AssertionError, "#{res.inspect} != #{self.inspect}"
      end
    end
    res
  end

end 

# --- developing test ---

if $0 == __FILE__
  s = String.new
  p (s >> 1)
end

# [1] A principle of design: An object evaluates all its own equalities.
#     
#         class Me
#           def compare(b)
#             # not b == self, but
#             self == b
#           end
#         end
#

 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.6.3 lib/facet-dev/object/>>.rb