diff options
| author | Steve Kemp <steve@steve.org.uk> | 2012-11-23 16:03:27 +0000 | 
|---|---|---|
| committer | Steve Kemp <steve@steve.org.uk> | 2012-11-23 16:03:27 +0000 | 
| commit | 5ed5667803eb44780cdbc5e4183c1f55daaf2555 (patch) | |
| tree | f09f57a4138d42901b5bf694ea51f8787087bdd6 | |
| parent | 21659bf0caab820d3c90efe3785c7521974272a8 (diff) | |
  Test that inverted() works for each protocol test we know about.
| -rw-r--r-- | lib/custodian/protocoltest/dns.rb | 8 | ||||
| -rw-r--r-- | lib/custodian/protocoltest/http.rb | 9 | ||||
| -rwxr-xr-x | t/test-custodian-testfactory.rb | 8 | 
3 files changed, 23 insertions, 2 deletions
| diff --git a/lib/custodian/protocoltest/dns.rb b/lib/custodian/protocoltest/dns.rb index 6c5e8db..d1c6ee2 100644 --- a/lib/custodian/protocoltest/dns.rb +++ b/lib/custodian/protocoltest/dns.rb @@ -33,6 +33,14 @@ module Custodian          #          @line = line +        # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end        end diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb index 1b7f442..133fdaf 100644 --- a/lib/custodian/protocoltest/http.rb +++ b/lib/custodian/protocoltest/http.rb @@ -47,6 +47,15 @@ module Custodian            raise ArgumentError, "The target wasn't an URL"          end +        # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end +        end diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb index b7834ea..0f4777a 100755 --- a/t/test-custodian-testfactory.rb +++ b/t/test-custodian-testfactory.rb @@ -189,8 +189,12 @@ class TestTestFactory < Test::Unit::TestCase          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 ) ) + +          test_one_obj = Custodian::TestFactory.create( test_one ) +          assert( !test_one_obj.inverted() ) + +          test_two_obj = Custodian::TestFactory.create( test_two ) +          assert( test_two_obj.inverted(), "Found inverted test for #{tst}" )          end        end      end | 
