ruby: added unified assert script

This commit is contained in:
Derek Hower 2009-09-15 11:32:11 -05:00
parent 803cf3b434
commit a06cfa199f

View file

@ -0,0 +1,18 @@
#!/usr/bin/env ruby
class AssertionFailure < RuntimeError
attr_reader :msg, :output
def initialize(message, out=nil)
@msg = message
@output = out
end
end
class NotImplementedException < Exception
end
def assert(condition,message)
unless condition
raise AssertionFailure.new(message), "\n\nAssertion failed: \n\n #{message}\n\n"
end
end