3 # Author:: Nathaniel Talbott.
4 # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
5 # License:: Ruby license.
10 # A collection of tests which can be #run.
12 # Note: It is easy to confuse a TestSuite instance with
13 # something that has a static suite method; I know because _I_
14 # have trouble keeping them straight. Think of something that
15 # has a suite method as simply providing a way to get a
16 # meaningful TestSuite instance.
18 attr_reader :name, :tests
20 STARTED = name + "::STARTED"
21 FINISHED = name + "::FINISHED"
23 # Creates a new TestSuite with the given name.
24 def initialize(name="Unnamed TestSuite")
29 # Runs the tests and/or suites contained in this
31 def run(result, &progress_block)
34 test.run(result, &progress_block)
39 # Adds the test to the suite.
49 # Retuns the rolled up number of tests in this suite;
50 # i.e. if the suite contains other suites, it counts the
51 # tests within those suites, not the suites themselves.
54 @tests.each { |test| total_size += test.size }
62 # Overridden to return the name given the suite at
68 # It's handy to be able to compare TestSuite instances.
70 return false unless(other.kind_of?(self.class))
71 return false unless(@name == other.name)