summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2009-02-26 11:43:39 +1100
committerJames Turnbull <james@lovedthanlost.net>2009-02-26 11:43:39 +1100
commit5f73eb553fd083b558fb9553b0c07b6019d0ccee (patch)
tree123ef2a9c7b8aa4e1cd52e6b98d0b3c53d626de6 /test
parente40aea3c655e698d26c29370227b52c489e6db2b (diff)
downloadpuppet-5f73eb553fd083b558fb9553b0c07b6019d0ccee.tar.gz
puppet-5f73eb553fd083b558fb9553b0c07b6019d0ccee.tar.xz
puppet-5f73eb553fd083b558fb9553b0c07b6019d0ccee.zip
Fixed #1849 - Ruby 1.9 portability: `when' doesn't like colons, replace with semicolons
Diffstat (limited to 'test')
-rwxr-xr-xtest/lib/puppettest.rb4
-rw-r--r--test/lib/puppettest/support/utils.rb2
-rwxr-xr-xtest/network/handler/fileserver.rb4
-rwxr-xr-xtest/rails/host.rb4
-rwxr-xr-xtest/ral/manager/attributes.rb8
-rwxr-xr-xtest/ral/providers/group.rb2
-rwxr-xr-xtest/ral/providers/package.rb2
-rwxr-xr-xtest/ral/providers/provider.rb6
-rwxr-xr-xtest/ral/providers/user.rb14
-rwxr-xr-xtest/ral/type/cron.rb4
-rwxr-xr-xtest/ral/type/file.rb4
-rwxr-xr-xtest/test4
-rwxr-xr-xtest/util/settings.rb4
13 files changed, 31 insertions, 31 deletions
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb
index 42295785e..3c6083fa6 100755
--- a/test/lib/puppettest.rb
+++ b/test/lib/puppettest.rb
@@ -255,8 +255,8 @@ module PuppetTest
def tmpdir
unless defined? @tmpdir and @tmpdir
@tmpdir = case Facter["operatingsystem"].value
- when "Darwin": "/private/tmp"
- when "SunOS": "/var/tmp"
+ when "Darwin"; "/private/tmp"
+ when "SunOS"; "/var/tmp"
else
"/tmp"
end
diff --git a/test/lib/puppettest/support/utils.rb b/test/lib/puppettest/support/utils.rb
index adc3b09ff..f23c6483b 100644
--- a/test/lib/puppettest/support/utils.rb
+++ b/test/lib/puppettest/support/utils.rb
@@ -72,7 +72,7 @@ module PuppetTest::Support::Utils
def run_events(type, trans, events, msg)
case type
- when :evaluate, :rollback: # things are hunky-dory
+ when :evaluate, :rollback # things are hunky-dory
else
raise Puppet::DevError, "Incorrect run_events type"
end
diff --git a/test/network/handler/fileserver.rb b/test/network/handler/fileserver.rb
index 9bd26ac07..5158f51ca 100755
--- a/test/network/handler/fileserver.rb
+++ b/test/network/handler/fileserver.rb
@@ -544,13 +544,13 @@ class TestFileServer < Test::Unit::TestCase
host, ip = sub
case type
- when :deny:
+ when :deny
assert_raise(Puppet::AuthorizationError,
"Host %s, ip %s, allowed %s" %
[host, ip, mount]) {
list = server.list(mount, :manage, true, false, host, ip)
}
- when :allow:
+ when :allow
assert_nothing_raised("Host %s, ip %s, denied %s" %
[host, ip, mount]) {
list = server.list(mount, :manage, true, false, host, ip)
diff --git a/test/rails/host.rb b/test/rails/host.rb
index 79f0ae398..a7b17c3ae 100755
--- a/test/rails/host.rb
+++ b/test/rails/host.rb
@@ -88,10 +88,10 @@ class TestRailsHost < PuppetTest::TestCase
end
assert(resource[:restype] != "", "Did not get a type from the resource")
case resource["restype"]
- when "File":
+ when "File"
assert_equal("user#{i}", resource.parameter("owner"),
"got no owner for %s" % resource.ref)
- when "Exec":
+ when "Exec"
assert_equal("user#{i}", resource.parameter("user"),
"got no user for %s" % resource.ref)
else
diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb
index 05f8bc97f..ab5ba85d1 100755
--- a/test/ral/manager/attributes.rb
+++ b/test/ral/manager/attributes.rb
@@ -172,7 +172,7 @@ class TestTypeAttributes < Test::Unit::TestCase
end
case old
- when :one: # param
+ when :one # param
assert_equal(val, inst[new],
"Incorrect alias value for %s in []" % new)
else
@@ -209,13 +209,13 @@ class TestTypeAttributes < Test::Unit::TestCase
resource = type.new(:provider => prov.name, :name => "test%s" % i, :none => "a", :one => "b", :two => "c")
case prov.name
- when :nope:
+ when :nope
yes = [:none]
no = [:one, :two]
- when :maybe:
+ when :maybe
yes = [:none, :one]
no = [:two]
- when :yep:
+ when :yep
yes = [:none, :one, :two]
no = []
end
diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb
index 044545be1..e4ee82a74 100755
--- a/test/ral/providers/group.rb
+++ b/test/ral/providers/group.rb
@@ -47,7 +47,7 @@ class TestGroupProvider < Test::Unit::TestCase
end
case Facter["operatingsystem"].value
- when "Darwin":
+ when "Darwin"
def missing?(group)
output = %x{nidump -r /groups/#{group} / 2>/dev/null}.chomp
diff --git a/test/ral/providers/package.rb b/test/ral/providers/package.rb
index 3b61c1abd..486078ed7 100755
--- a/test/ral/providers/package.rb
+++ b/test/ral/providers/package.rb
@@ -240,7 +240,7 @@ class TestPackageProvider < Test::Unit::TestCase
def modpkg(pkg)
case pkg[:provider]
- when :sun:
+ when :sun
pkg[:adminfile] = "/usr/local/pkg/admin_file"
end
end
diff --git a/test/ral/providers/provider.rb b/test/ral/providers/provider.rb
index 25f1d605f..4df67807f 100755
--- a/test/ral/providers/provider.rb
+++ b/test/ral/providers/provider.rb
@@ -506,13 +506,13 @@ class TestProviderFeatures < Test::Unit::TestCase
[nope, maybe, yep].each do |prov|
assert(prov.respond_to?(:supports_parameter?), "%s does not respond to :supports_parameter?" % prov.name)
case prov.name
- when :nope:
+ when :nope
supported = [:neither]
un = [:some, :both]
- when :maybe:
+ when :maybe
supported = [:neither, :some]
un = [:both]
- when :yep:
+ when :yep
supported = [:neither, :some, :both]
un = []
end
diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb
index 1cb139b7d..3f68469c1 100755
--- a/test/ral/providers/user.rb
+++ b/test/ral/providers/user.rb
@@ -32,7 +32,7 @@ class TestUserProvider < Test::Unit::TestCase
end
case Facter["operatingsystem"].value
- when "Darwin":
+ when "Darwin"
def missing?(user)
output = %x{nidump -r /users/#{user} / 2>/dev/null}.chomp
@@ -119,12 +119,12 @@ class TestUserProvider < Test::Unit::TestCase
def fakedata(name, param)
case param
- when :name: name
- when :ensure: :present
- when :comment: "Puppet's Testing User %s" % name # use a single quote a la #375
- when :gid: nonrootgroup.gid
- when :shell: findshell()
- when :home: "/home/%s" % name
+ when :name; name
+ when :ensure; :present
+ when :comment; "Puppet's Testing User %s" % name # use a single quote a la #375
+ when :gid; nonrootgroup.gid
+ when :shell; findshell()
+ when :home; "/home/%s" % name
else
return nil
end
diff --git a/test/ral/type/cron.rb b/test/ral/type/cron.rb
index 6eceb273d..20ed773d6 100755
--- a/test/ral/type/cron.rb
+++ b/test/ral/type/cron.rb
@@ -194,7 +194,7 @@ class TestCron < Test::Unit::TestCase
[:valid, :invalid].each { |type|
hash[type].each { |value|
case type
- when :valid:
+ when :valid
assert_nothing_raised {
cron[param] = value
}
@@ -203,7 +203,7 @@ class TestCron < Test::Unit::TestCase
assert_equal([value.to_s], cron.should(param),
"Cron value was not set correctly")
end
- when :invalid:
+ when :invalid
assert_raise(Puppet::Error, "%s is incorrectly a valid %s" %
[value, param]) {
cron[param] = value
diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb
index 1a7813b74..08fdab821 100755
--- a/test/ral/type/file.rb
+++ b/test/ral/type/file.rb
@@ -1108,9 +1108,9 @@ class TestFile < Test::Unit::TestCase
# Now change something so that we replace the file
case attr
- when :source:
+ when :source
File.open(source, "w") { |f| f.puts "some different text" }
- when :content: file[:content] = "something completely different"
+ when :content; file[:content] = "something completely different"
else
raise "invalid attr %s" % attr
end
diff --git a/test/test b/test/test
index a8efd50bc..1e0f9fd2b 100755
--- a/test/test
+++ b/test/test
@@ -184,8 +184,8 @@ def run(files, flags = nil)
files.each do |file|
case File.stat(file).ftype
- when "file": args << file
- when "directory": args += ruby_files(file)
+ when "file"; args << file
+ when "directory"; args += ruby_files(file)
else
$stderr.puts "Skipping %s; can't handle %s" %
[file, File.stat(file).ftype]
diff --git a/test/util/settings.rb b/test/util/settings.rb
index f34cbbc46..2ff9e66ec 100755
--- a/test/util/settings.rb
+++ b/test/util/settings.rb
@@ -379,7 +379,7 @@ yay = /a/path
assert_equal(user.uid, File.stat(path).uid, "UIDS are not equal")
case Facter["operatingsystem"].value
- when /BSD/, "Darwin": # nothing
+ when /BSD/, "Darwin" # nothing
else
assert_equal(group.gid, File.stat(path).gid, "GIDS are not equal")
end
@@ -418,7 +418,7 @@ yay = /a/path
assert_equal(user.uid, File.stat(path).uid, "UIDS are not equal")
case Facter["operatingsystem"].value
- when /BSD/, "Darwin": # nothing
+ when /BSD/, "Darwin" # nothing
else
assert_equal(group.gid, File.stat(path).gid, "GIDS are not equal")
end