Sha256: 02e829b8c298cc41ce58c7abe658644555064f00d79fea05e4b8068ada69fa17

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 Bytes

Contents

require 'ae/core_ext'

# = Assertion
#
#   "The reserve of modern assertions is sometimes pushed to extremes,
#    in which the fear of being contradicted leads the writer to strip
#    himself of almost all sense and meaning."
#                              -- Sir Winston Churchill (1874 - 1965)
#
# This is the underlying Exception class of the whole system.
#
class Assertion < Exception

  def self.recount
    $assertions = 0
    $failures   = 0
  end

  def self.count ; $assertions ; end
  def self.fails ; $failures   ; end

  #
  def initialize(message=nil, opts={})
    backtrace = opts[:backtrace]
    super(message)
    set_backtrace(backtrace) if backtrace
  end

  def to_s
    'fail ' + super
  end

end

# Copyright (c) 2008,2009 Thomas Sawyer

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ae-1.4.0 lib/ae/assertion.rb
ae-1.3.0 lib/ae/assertion.rb
ae-1.2.3 lib/ae/assertion.rb
ae-1.2.2 lib/ae/assertion.rb