Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • test/unit/collector.rb
  • test/unit/collector/dir.rb
  • test/unit/collector/objectspace.rb

Test::Unit::Collector

Public Class Methods

new() click to toggle source
 
               # File test/unit/collector.rb, line 4
def initialize
  @filters = []
end
            

Public Instance Methods

add_suite(destination, suite) click to toggle source
 
               # File test/unit/collector.rb, line 17
def add_suite(destination, suite)
  to_delete = suite.tests.find_all{|t| !include?(t)}
  to_delete.each{|t| suite.delete(t)}
  destination << suite unless(suite.size == 0)
end
            
filter=(filters) click to toggle source
 
               # File test/unit/collector.rb, line 8
def filter=(filters)
  @filters = case(filters)
    when Proc
      [filters]
    when Array
      filters
  end
end
            
include?(test) click to toggle source
 
               # File test/unit/collector.rb, line 23
def include?(test)
  return true if(@filters.empty?)
  @filters.each do |filter|
    result = filter[test]
    if(result.nil?)
      next
    elsif(!result)
      return false
    else
      return true
    end
  end
  true
end
            
sort(suites) click to toggle source
 
               # File test/unit/collector.rb, line 38
def sort(suites)
  suites.sort_by{|s| s.name}
end