summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 13:08:33 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 13:08:33 +0000
commit22b40326730fb7a4a8e2f5cb8d877f6a84494d02 (patch)
treec08f5ade5267c79cf3929bccc75dd4b704717500 /t
parent5cc24f3a9a25a4214f1ee85a24960cce9f4f9516 (diff)
Avoid "Array.new" and "Hash.new"
Instead use {} + ().
Diffstat (limited to 't')
-rwxr-xr-xt/test-custodian-alertfactory.rb4
-rwxr-xr-xt/test-custodian-parser.rb8
-rwxr-xr-xt/test-custodian-testfactory.rb4
-rwxr-xr-xt/test-custodian-util-ping.rb4
4 files changed, 10 insertions, 10 deletions
diff --git a/t/test-custodian-alertfactory.rb b/t/test-custodian-alertfactory.rb
index f81a763..e12dbdd 100755
--- a/t/test-custodian-alertfactory.rb
+++ b/t/test-custodian-alertfactory.rb
@@ -30,7 +30,7 @@ class TestAlertFactory < Test::Unit::TestCase
#
# Ensure we can create each of the two alert types we care about
#
- methods = Array.new()
+ methods = []
methods.push( "file" )
methods.push( "smtp" )
@@ -94,7 +94,7 @@ class TestAlertFactory < Test::Unit::TestCase
obj = Custodian::AlertFactory.create( nil, nil )
end
assert_raise ArgumentError do
- obj = Custodian::AlertFactory.create( Array.new, nil )
+ obj = Custodian::AlertFactory.create( [], nil )
end
end
diff --git a/t/test-custodian-parser.rb b/t/test-custodian-parser.rb
index bd6a933..5822ecd 100755
--- a/t/test-custodian-parser.rb
+++ b/t/test-custodian-parser.rb
@@ -93,12 +93,12 @@ class TestCustodianParser < Test::Unit::TestCase
#
parser = Custodian::Parser.new()
# 2.a. Comment lines return nil.
- tmp = Array.new()
+ tmp = []
tmp.push( "# This is a comment.." )
assert( parser.parse_lines( tmp ).nil? )
# 2.b. Adding a test will return an array of test-objects.
- tmp = Array.new()
+ tmp = []
tmp.push( "smtp.bytemark.co.uk must run ssh on 22 otherwise 'oops'." );
ret = parser.parse_lines( tmp )
assert( ret.kind_of? Array );
@@ -171,7 +171,7 @@ EOF
#
# Input text
#
- text = Array.new()
+ text = []
text.push( "FOO is kvm1.vm.bytemark.co.uk." );
text.push( "FOO2 is kvm2.vm.bytemark.co.uk." );
@@ -202,7 +202,7 @@ EOF
#
# Input text to parse.
#
- text = Array.new()
+ text = []
text.push( "FOO is kvm1.vm.bytemark.co.uk." );
text.push( "FOO is kvm2.vm.bytemark.co.uk." );
diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb
index aef71c6..6a115ce 100755
--- a/t/test-custodian-testfactory.rb
+++ b/t/test-custodian-testfactory.rb
@@ -32,7 +32,7 @@ class TestTestFactory < Test::Unit::TestCase
end
assert_raise ArgumentError do
- obj = Custodian::TestFactory.create( Array.new, nil )
+ obj = Custodian::TestFactory.create( [], nil )
end
@@ -290,7 +290,7 @@ class TestTestFactory < Test::Unit::TestCase
def test_target_detection
- a = Array.new()
+ a = []
a.push( "test.host.example.com must run ftp.")
a.push( "ftp://test.host.example.com/ must run ftp.")
diff --git a/t/test-custodian-util-ping.rb b/t/test-custodian-util-ping.rb
index efeef64..3dd363a 100755
--- a/t/test-custodian-util-ping.rb
+++ b/t/test-custodian-util-ping.rb
@@ -49,10 +49,10 @@ class TestPingUtil < Test::Unit::TestCase
# A hostname is a string, not an array, hash, or similar.
#
assert_raise ArgumentError do
- Custodian::Util::Ping.new( Hash.new)
+ Custodian::Util::Ping.new( {})
end
assert_raise ArgumentError do
- Custodian::Util::Ping.new( Array.new)
+ Custodian::Util::Ping.new( [])
end