From 19ad4dc151720b6d172e2f3dabf11cce933ba18d Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Fri, 23 Nov 2012 15:46:12 +0000 Subject: Removed duplicate member-variables for subclasses. Allow test-inversion via "must not run". --- t/test-custodian-testfactory.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 't') diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb index 9aeb6e1..db79f50 100755 --- a/t/test-custodian-testfactory.rb +++ b/t/test-custodian-testfactory.rb @@ -137,6 +137,36 @@ class TestTestFactory < Test::Unit::TestCase assert( Custodian::TestFactory.create( "ftp://example.com/ must not run rsync." ) ) assert( Custodian::TestFactory.create( "ftp://example.com/ must not run rsync on 333." ) ) end + + + # + # Test some inversions + # + data = { + "foo must run rsync." => false, + "rsync://foo/ must run rsync." => false, + "foo must run ping otherwise" => false, + "foo must not run ping otherwise" => true, + "foo must not run ssh otherwise" => true, + "foo must not run ldap otherwise" => true, + } + + # + # Run each test + # + data.each do |str,inv| + assert_nothing_raised do + + obj = Custodian::TestFactory.create( str ) + + # + # Ensure we got the object, and the port was correct. + # + assert(obj, "created object via TestFactory.create('#{str}')") + assert( obj.inverted() == inv, "#{str} -> #{inv}" ) + end + end + end end -- cgit v1.2.1