diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:09:46 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:09:46 +0000 |
commit | 891b720013f06f092f6be82adad95e5551c696b6 (patch) | |
tree | bffba558147d68d951f403caa2b6396e4faf5f29 /t | |
parent | 3a96cc957dbd97c6ffeaea42f738e7c35b4acbc7 (diff) |
Do not use parentheses for method calls with no arguments.
This is neater. Flagged by rubocop
Diffstat (limited to 't')
-rwxr-xr-x | t/test-custodian-parser.rb | 32 | ||||
-rwxr-xr-x | t/test-custodian-settings.rb | 12 | ||||
-rwxr-xr-x | t/test-custodian-testfactory.rb | 24 | ||||
-rwxr-xr-x | t/test-custodian-util-timespan.rb | 4 |
4 files changed, 36 insertions, 36 deletions
diff --git a/t/test-custodian-parser.rb b/t/test-custodian-parser.rb index 5822ecd..43a0754 100755 --- a/t/test-custodian-parser.rb +++ b/t/test-custodian-parser.rb @@ -44,13 +44,13 @@ class TestCustodianParser < Test::Unit::TestCase # Constructor # assert_nothing_raised do - Custodian::Parser.new() + Custodian::Parser.new end end def test_period - parser = Custodian::Parser.new() + parser = Custodian::Parser.new result = parser.parse_line( "example.vm.bytemark.co.uk must run ping except between 00-23" ) assert( result.nil? ) end @@ -69,7 +69,7 @@ class TestCustodianParser < Test::Unit::TestCase # # 1. By string. # - parser = Custodian::Parser.new() + parser = Custodian::Parser.new # 1.a. Comment lines return nil. result = parser.parse_line( "# this is a comment" ) @@ -91,7 +91,7 @@ class TestCustodianParser < Test::Unit::TestCase # # 2. By array. # - parser = Custodian::Parser.new() + parser = Custodian::Parser.new # 2.a. Comment lines return nil. tmp = [] tmp.push( "# This is a comment.." ) @@ -107,7 +107,7 @@ class TestCustodianParser < Test::Unit::TestCase # # 3. By lines # - parser = Custodian::Parser.new() + parser = Custodian::Parser.new # 3.a. Comment lines return nil. str =<<EOF # This is a comment @@ -134,7 +134,7 @@ EOF # def test_macros_lines - parser = Custodian::Parser.new() + parser = Custodian::Parser.new # # Input text @@ -155,7 +155,7 @@ EOF # macros = parser.macros assert( ! macros.empty? ) - assert( macros.size() == 2 ) + assert( macros.size == 2 ) end @@ -166,7 +166,7 @@ EOF # def test_macros_array - parser = Custodian::Parser.new() + parser = Custodian::Parser.new # # Input text @@ -186,7 +186,7 @@ EOF # macros = parser.macros assert( ! macros.empty? ) - assert( macros.size() == 2 ) + assert( macros.size == 2 ) end @@ -197,7 +197,7 @@ EOF # def test_duplicate_macros - parser = Custodian::Parser.new() + parser = Custodian::Parser.new # # Input text to parse. @@ -219,7 +219,7 @@ EOF # macros = parser.macros assert( ! macros.empty? ) - assert( macros.size() == 1 ) + assert( macros.size == 1 ) end @@ -233,7 +233,7 @@ EOF # # Create a parser - validate it is free of macros. # - parser = Custodian::Parser.new() + parser = Custodian::Parser.new macros = parser.macros assert( macros.empty? ) @@ -248,7 +248,7 @@ EOF # The difference is the return value will be an array # assert( out_txt.kind_of? Array ) - assert( out_txt.size() == 1 ) + assert( out_txt.size == 1 ) assert( out_txt[0] == in_txt ) @@ -268,7 +268,7 @@ EOF # The result should be an array # assert( ret.kind_of? Array ) - assert_equal( ret.size(), 2 ) + assert_equal( ret.size, 2 ) assert( ret[0] =~ /example1/) assert( ret[1] =~ /example2/) @@ -391,9 +391,9 @@ EOF assert_equal( obj[0].to_s, str ) if ( fail.nil? ) - assert( obj[0].get_notification_text().nil? ) + assert( obj[0].get_notification_text.nil? ) else - assert_equal( obj[0].get_notification_text(), fail ) + assert_equal( obj[0].get_notification_text, fail ) end end diff --git a/t/test-custodian-settings.rb b/t/test-custodian-settings.rb index 8dea986..0347e7c 100755 --- a/t/test-custodian-settings.rb +++ b/t/test-custodian-settings.rb @@ -29,8 +29,8 @@ class TestConfigurationSingleton < Test::Unit::TestCase # Test that we're genuinely a singleton # def test_singleton - a = Custodian::Settings.instance() - b = Custodian::Settings.instance() + a = Custodian::Settings.instance + b = Custodian::Settings.instance assert( a ) assert( b ) @@ -42,7 +42,7 @@ class TestConfigurationSingleton < Test::Unit::TestCase # Test that our settings are suitable types # def test_types - settings = Custodian::Settings.instance() + settings = Custodian::Settings.instance # retry delay - probably unset. @@ -64,18 +64,18 @@ class TestConfigurationSingleton < Test::Unit::TestCase # timeout - probably unset. - a = settings.timeout() + a = settings.timeout assert( a.class == Fixnum ) # store a number settings._store( "timeout", 5 ) - a = settings.timeout() + a = settings.timeout assert( a.class == Fixnum ) assert( a == 5 ) # store a string settings._store( "timeout", "35" ) - a = settings.timeout() + a = settings.timeout assert( a.class == Fixnum ) assert( a == 35 ) diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb index 6a115ce..6c71003 100755 --- a/t/test-custodian-testfactory.rb +++ b/t/test-custodian-testfactory.rb @@ -52,8 +52,8 @@ class TestTestFactory < Test::Unit::TestCase end - assert( Custodian::TestFactory.create( "ftp.example.com must run ftp." )[0].target() == "ftp.example.com" ) - assert( Custodian::TestFactory.create( "ftp://ftp.example.com/ must run ftp." )[0].target() == "ftp.example.com" ) + assert( Custodian::TestFactory.create( "ftp.example.com must run ftp." )[0].target == "ftp.example.com" ) + assert( Custodian::TestFactory.create( "ftp://ftp.example.com/ must run ftp." )[0].target == "ftp.example.com" ) # @@ -77,7 +77,7 @@ class TestTestFactory < Test::Unit::TestCase assert( obj.kind_of? Array ) assert( ! obj.empty? ) assert_equal( obj[0].get_type, "ftp" ) - assert_equal( obj[0].port().to_s(), prt ) + assert_equal( obj[0].port.to_s, prt ) end end @@ -109,7 +109,7 @@ class TestTestFactory < Test::Unit::TestCase assert(obj) assert( obj.kind_of? Array ) assert( ! obj.empty? ) - assert( obj[0].port().to_s == prt , "'#{str}' gave expected port '#{prt}'.") + assert( obj[0].port.to_s == prt , "'#{str}' gave expected port '#{prt}'.") end end @@ -130,9 +130,9 @@ class TestTestFactory < Test::Unit::TestCase assert( Custodian::TestFactory.create( "ftp://example.com/ must run rsync on 3311 otherwise 'xxx'." ) ) end - assert( Custodian::TestFactory.create( "rsync.example.com must run rsync." )[0].target() == + assert( Custodian::TestFactory.create( "rsync.example.com must run rsync." )[0].target == "rsync.example.com" ) - assert( Custodian::TestFactory.create( "rsync://rsync.example.com/ must run rsync." )[0].target() == + assert( Custodian::TestFactory.create( "rsync://rsync.example.com/ must run rsync." )[0].target == "rsync.example.com" ) @@ -156,7 +156,7 @@ class TestTestFactory < Test::Unit::TestCase assert( obj.kind_of? Array ) assert( ! obj.empty? ) - assert( obj[0].port().to_s == prt , "'#{str}' gave expected port '#{prt}'.") + assert( obj[0].port.to_s == prt , "'#{str}' gave expected port '#{prt}'.") end end end @@ -237,7 +237,7 @@ class TestTestFactory < Test::Unit::TestCase # Ensure we got the object, and the port was correct. # assert(obj, "created object via TestFactory.create('#{str}')") - assert( obj[0].inverted() == inv, "#{str} -> #{inv}" ) + assert( obj[0].inverted == inv, "#{str} -> #{inv}" ) end end @@ -247,7 +247,7 @@ class TestTestFactory < Test::Unit::TestCase # Get all the types we know about. # def test_types - registered = Custodian::TestFactory.known_tests() + registered = Custodian::TestFactory.known_tests # for each test-type registered.keys.each do |type| @@ -270,10 +270,10 @@ class TestTestFactory < Test::Unit::TestCase assert_nothing_raised do test_one_obj = Custodian::TestFactory.create( test_one ) - assert( !test_one_obj[0].inverted() ) + assert( !test_one_obj[0].inverted ) test_two_obj = Custodian::TestFactory.create( test_two ) - assert( test_two_obj[0].inverted(), "Found inverted test for #{tst}" ) + assert( test_two_obj[0].inverted, "Found inverted test for #{tst}" ) assert_equal( tst, test_one_obj[0].get_type ) assert_equal( tst, test_two_obj[0].get_type ) @@ -306,7 +306,7 @@ class TestTestFactory < Test::Unit::TestCase assert(obj) assert( obj.kind_of? Array ) assert( ! obj.empty? ) - assert_equal( "test.host.example.com", obj[0].target() ) + assert_equal( "test.host.example.com", obj[0].target ) end end end diff --git a/t/test-custodian-util-timespan.rb b/t/test-custodian-util-timespan.rb index ef05fe7..29e9b83 100755 --- a/t/test-custodian-util-timespan.rb +++ b/t/test-custodian-util-timespan.rb @@ -215,14 +215,14 @@ class TestTimeSpanUtil < Test::Unit::TestCase def test_wrap_around for h in 00..23 - assert_equal( 1, Custodian::Util::TimeSpan.to_hours( h,h ).size() ) + assert_equal( 1, Custodian::Util::TimeSpan.to_hours( h,h ).size ) end # # But the time-period 00-23 is a full day # assert_equal( 24, - Custodian::Util::TimeSpan.to_hours( 0,23 ).size() ) + Custodian::Util::TimeSpan.to_hours( 0,23 ).size ) end |