Changeset 31409

Show
Ignore:
Timestamp:
03/20/09 20:45:59 (4 years ago)
Author:
frsyuki
Message:

lang/ruby/chukan: Chukan::Test: nested test

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/chukan/trunk/chukan.rb

    r31408 r31409  
    9696} 
    9797 
    98 __END__                            # yaml documents are here 
    99 --- 
     98__END__ 
     99---                                # yaml documents are here 
    100100name:  test A 
    101101user:  a-san 
     
    377377         
    378378                def self.included(*mod) 
    379                         ObjectSpace.define_finalizer(mod, report) 
    380                         @@start = Time.now 
     379                        unless @@start 
     380                                ObjectSpace.define_finalizer(mod, report) 
     381                                @@start = Time.now 
     382                        end 
    381383                end 
    382384         
    383385                def test(name = nil, directive = nil, &block) 
    384                         @@count += 1 
    385386                        if yield 
    386                                 tap(Color::SUCCESS, "ok", @@count, name, directive) 
     387                                tap(Color::SUCCESS, "ok", @@count+=1, name, directive) 
    387388                                @@cases[name][0] += 1 
    388389                        else 
    389                                 tap(Color::FAIL, "not ok", @@count, name, directive) 
     390                                tap(Color::FAIL, "not ok", @@count+=1, name, directive) 
    390391                                print_backtrace(caller, "test failed") 
    391392                                @@cases[name][1] += 1 
    392393                        end 
    393394                rescue Exception 
    394                         tap(Color::ERROR, "not ok", @@count, name, directive) 
     395                        tap(Color::ERROR, "not ok", @@count+=1, name, directive) 
    395396                        print_backtrace($!.backtrace, "#{$!} (#{$!.class})") 
    396397                        @@cases[name][2] += 1