Module: Nanotest

Extended by:
Nanotest
Included in:
Nanotest
Defined in:
lib/nanotest.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.resultsObject

:nodoc:



16
17
18
# File 'lib/nanotest.rb', line 16

def self.results #:nodoc:
  @@dots.join + "\n" + @@failures.join("\n")
end

Instance Method Details

#assert(msg = nil, file = nil, line = nil, stack = caller, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/nanotest.rb', line 6

def assert(msg=nil, file=nil, line=nil, stack=caller, &block)
  unless block.call
    f,l = stack.first.match(/(.*):(\d+)/)[1..2]
    @@failures << "(%s:%0.3d) %s" % [file || f, line || l, msg || "assertion failed"]
    @@dots << 'F'
  else
    @@dots << '.'
  end
end