Sha256: c0164631e8685d602ad40688566fdba8797954dca5de07e7f288f47f4440e8df

Contents?: true

Size: 896 Bytes

Versions: 24

Compression:

Stored size: 896 Bytes

Contents

module Test
  module Unit
    module Collector
      def initialize
        @filters = []
      end

      def filter=(filters)
        @filters = case(filters)
          when Proc
            [filters]
          when Array
            filters
        end
      end

      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

      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

      def sort(suites)
        suites.sort_by {|suite| suite.name || suite.to_s}
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 6 rubygems

Version Path
test-unit-2.0.6 lib/test/unit/collector.rb
activeldap-1.2.1 test-unit/lib/test/unit/collector.rb
test-unit-2.0.5 lib/test/unit/collector.rb
test-unit-2.0.4 lib/test/unit/collector.rb
groonga-0.0.7 test-unit/lib/test/unit/collector.rb
activegroonga-0.0.7 test-unit/lib/test/unit/collector.rb
activesambaldap-0.0.8 test-unit/lib/test/unit/collector.rb
activeldap-1.2.0 test-unit/lib/test/unit/collector.rb
ActiveSambaLdap-0.0.7 test-unit/lib/test/unit/collector.rb
test-unit-2.0.3 lib/test/unit/collector.rb
groonga-0.0.3 test-unit/lib/test/unit/collector.rb
groonga-0.0.4 test-unit/lib/test/unit/collector.rb
groonga-0.0.5 test-unit/lib/test/unit/collector.rb
groonga-0.0.6 test-unit/lib/test/unit/collector.rb
activesambaldap-0.0.7 test-unit/lib/test/unit/collector.rb
activeldap-1.1.0 test-unit/lib/test/unit/collector.rb
activegroonga-0.0.6 test-unit/lib/test/unit/collector.rb
activegroonga-0.0.2 test-unit/lib/test/unit/collector.rb
activegroonga-0.0.1 test-unit/lib/test/unit/collector.rb
activeldap-1.0.2 test-unit/lib/test/unit/collector.rb