diff options
author | Steve Kemp <steve@steve.org.uk> | 2012-11-23 15:54:53 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2012-11-23 15:54:53 +0000 |
commit | 21659bf0caab820d3c90efe3785c7521974272a8 (patch) | |
tree | 7422c1edbfe6ba38675e66d88a1f98cee920923f | |
parent | 19ad4dc151720b6d172e2f3dabf11cce933ba18d (diff) |
Allow the test-factory to return the known-test types, and then test *each* of the with a simple constructed test.
-rw-r--r-- | lib/custodian/testfactory.rb | 2 | ||||
-rwxr-xr-x | t/test-custodian-testfactory.rb | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/custodian/testfactory.rb b/lib/custodian/testfactory.rb index 6ae74d1..be5584c 100644 --- a/lib/custodian/testfactory.rb +++ b/lib/custodian/testfactory.rb @@ -63,7 +63,7 @@ module Custodian # i.e. Derived classes that have registered themselves. # # - def types + def self.known_tests @@subclasses end diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb index db79f50..b7834ea 100755 --- a/t/test-custodian-testfactory.rb +++ b/t/test-custodian-testfactory.rb @@ -168,5 +168,33 @@ class TestTestFactory < Test::Unit::TestCase end end + + # + # Get all the types we know about. + # + def test_types + registered = Custodian::TestFactory.known_tests() + + registered.each do |obj| + + # + # Try to get the name + # + name=obj.to_s + if ( name =~ /protocoltest::(.*)Test$/i ) + tst = $1.dup.downcase + + # normal + test_one = "http://foo/ must run #{tst} on 1234" + test_two = "http://foo/ must not run #{tst} on 12345" + + assert_nothing_raised do + assert( Custodian::TestFactory.create( test_one ) ) + assert( Custodian::TestFactory.create( test_two ) ) + end + end + end + end + end |