summaryrefslogtreecommitdiff
path: root/t/test-custodian-parser.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:15 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:15 +0000
commitaf2ee063abea8235a8cbd1448533e4f4fbc0d0af (patch)
tree969e448e2d5995f7e838a68ef1d25d54df9b8d29 /t/test-custodian-parser.rb
parentbb2ec1f07af747c69f2fd1e5b70c41b35fb069e6 (diff)
Prefer single-quotes when you don't need interpolation.
So "foo" is less good than 'foo'.
Diffstat (limited to 't/test-custodian-parser.rb')
-rwxr-xr-xt/test-custodian-parser.rb50
1 files changed, 25 insertions, 25 deletions
diff --git a/t/test-custodian-parser.rb b/t/test-custodian-parser.rb
index 49416b3..bbdb8ad 100755
--- a/t/test-custodian-parser.rb
+++ b/t/test-custodian-parser.rb
@@ -51,7 +51,7 @@ class TestCustodianParser < Test::Unit::TestCase
def test_period
parser = Custodian::Parser.new
- result = parser.parse_line( "example.vm.bytemark.co.uk must run ping except between 00-23" )
+ result = parser.parse_line( 'example.vm.bytemark.co.uk must run ping except between 00-23' )
assert( result.nil? )
end
@@ -72,7 +72,7 @@ class TestCustodianParser < Test::Unit::TestCase
parser = Custodian::Parser.new
# 1.a. Comment lines return nil.
- result = parser.parse_line( "# this is a comment" )
+ result = parser.parse_line( '# this is a comment' )
assert( result.nil? )
# 1.b. Non-strings are an error
@@ -94,7 +94,7 @@ class TestCustodianParser < Test::Unit::TestCase
parser = Custodian::Parser.new
# 2.a. Comment lines return nil.
tmp = []
- tmp.push( "# This is a comment.." )
+ tmp.push( '# This is a comment..' )
assert( parser.parse_lines( tmp ).nil? )
# 2.b. Adding a test will return an array of test-objects.
@@ -172,8 +172,8 @@ EOF
# Input text
#
text = []
- text.push( "FOO is kvm1.vm.bytemark.co.uk." )
- text.push( "FOO2 is kvm2.vm.bytemark.co.uk." )
+ text.push( 'FOO is kvm1.vm.bytemark.co.uk.' )
+ text.push( 'FOO2 is kvm2.vm.bytemark.co.uk.' )
#
# Test the parser with this text
@@ -203,8 +203,8 @@ EOF
# Input text to parse.
#
text = []
- text.push( "FOO is kvm1.vm.bytemark.co.uk." )
- text.push( "FOO is kvm2.vm.bytemark.co.uk." )
+ text.push( 'FOO is kvm1.vm.bytemark.co.uk.' )
+ text.push( 'FOO is kvm2.vm.bytemark.co.uk.' )
#
# Test the parser with this text
@@ -241,7 +241,7 @@ EOF
# Expand a line - which should result in no change
# as the line does not involve a known-macro
#
- in_txt = "example.bytemark.co.uk must run smtp."
+ in_txt = 'example.bytemark.co.uk must run smtp.'
out_txt = parser.expand_macro( in_txt )
#
@@ -255,14 +255,14 @@ EOF
#
# Now define a macro
#
- parser.parse_line( "TARGET is example1.bytemark.co.uk and example2.bytemark.co.uk." )
+ parser.parse_line( 'TARGET is example1.bytemark.co.uk and example2.bytemark.co.uk.' )
macros = parser.macros
assert( !macros.empty? )
#
# Now we have a two-host macro, repeat the expansion
#
- ret = parser.expand_macro( "TARGET must run smtp on 25." )
+ ret = parser.expand_macro( 'TARGET must run smtp on 25.' )
#
# The result should be an array
@@ -284,12 +284,12 @@ EOF
# test data
#
data = {
- "http://example must run http." => true,
- "http://example must run http with status 200." => true,
+ 'http://example must run http.' => true,
+ 'http://example must run http with status 200.' => true,
"http://example must run http with content 'bar'." => true,
- "http://example must run http following redirects." => true,
- "http://example must run http not following redirects." => false,
- "http://example must run http not following redirect." => false,
+ 'http://example must run http following redirects.' => true,
+ 'http://example must run http not following redirects.' => false,
+ 'http://example must run http not following redirect.' => false,
}
data.each do |str,follow|
@@ -325,10 +325,10 @@ EOF
# test data
#
data = {
- "http://example must run http." => true,
- "http://example must run http with status 200." => true,
+ 'http://example must run http.' => true,
+ 'http://example must run http with status 200.' => true,
"http://example must run http with content 'bar'." => true,
- "http://example must run http without cache busting." => false,
+ 'http://example must run http without cache busting.' => false,
}
data.each do |str,cb|
@@ -365,13 +365,13 @@ EOF
# test data
#
data = {
- "foo must run rsync." => nil,
- "foo must run redis." => nil,
- "foo must not run ping." => nil,
- "foo must not run ssh otherwise 'fail'" => "fail",
- "foo must not run ssh otherwise 'fail'." => "fail",
- "foo must run redis otherwise 'memorystorage service is dead'" => "memorystorage service is dead",
- "foo must run ping otherwise 'don't you love me?'" => "don"
+ 'foo must run rsync.' => nil,
+ 'foo must run redis.' => nil,
+ 'foo must not run ping.' => nil,
+ "foo must not run ssh otherwise 'fail'" => 'fail',
+ "foo must not run ssh otherwise 'fail'." => 'fail',
+ "foo must run redis otherwise 'memorystorage service is dead'" => 'memorystorage service is dead',
+ "foo must run ping otherwise 'don't you love me?'" => 'don'
}
#