diff options
| author | Ian Taylor <ian@lorf.org> | 2009-06-05 12:39:04 -0400 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-06-06 09:12:00 +1000 |
| commit | 4f2c066a97e59a89df64af4b25beac6f3f0553c2 (patch) | |
| tree | 126540beec3c65448e01e1b48d27275ec4ee6ea4 /test/util | |
| parent | 97e6975d69f239e24993315a25a3117b1daa48c3 (diff) | |
| download | puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.tar.gz puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.tar.xz puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.zip | |
Removed extra whitespace from end of lines
Diffstat (limited to 'test/util')
| -rwxr-xr-x | test/util/features.rb | 14 | ||||
| -rwxr-xr-x | test/util/fileparsing.rb | 12 | ||||
| -rwxr-xr-x | test/util/inifile.rb | 10 | ||||
| -rwxr-xr-x | test/util/log.rb | 2 | ||||
| -rwxr-xr-x | test/util/package.rb | 2 | ||||
| -rwxr-xr-x | test/util/settings.rb | 20 | ||||
| -rwxr-xr-x | test/util/storage.rb | 4 | ||||
| -rwxr-xr-x | test/util/utiltest.rb | 20 |
8 files changed, 42 insertions, 42 deletions
diff --git a/test/util/features.rb b/test/util/features.rb index ef69ad72b..8788599ce 100755 --- a/test/util/features.rb +++ b/test/util/features.rb @@ -26,12 +26,12 @@ class TestFeatures < Test::Unit::TestCase raise ArgumentError, "nopes" end end - + assert(@features.respond_to?(:failer?), "Feature method did not get added") assert_nothing_raised("failure propagated outside of feature") do assert(! @features.failer?, "failure was considered true") end - + # Now make one that succeeds $succeeds = nil assert_nothing_raised("Failed to add normal feature") do @@ -40,22 +40,22 @@ class TestFeatures < Test::Unit::TestCase end end assert($succeeds, "Block was not called on initialization") - + assert(@features.respond_to?(:succeeds?), "Did not add succeeding feature") assert_nothing_raised("Failed to call succeeds") { assert(@features.succeeds?, "Feature was not true") } end - + def test_libs assert_nothing_raised do @features.add(:puppet, :libs => %w{puppet}) end - + assert(@features.puppet?) - + assert_nothing_raised do @features.add(:missing, :libs => %w{puppet no/such/library/okay}) end - + assert(! @features.missing?, "Missing lib was considered true") end diff --git a/test/util/fileparsing.rb b/test/util/fileparsing.rb index d7c196cdb..c88bcb23a 100755 --- a/test/util/fileparsing.rb +++ b/test/util/fileparsing.rb @@ -72,7 +72,7 @@ class TestUtilFileParsing < Test::Unit::TestCase # Make sure it matches assert_nothing_raised do - assert_equal({:record_type => :comment, :line => comment}, + assert_equal({:record_type => :comment, :line => comment}, @parser.parse_line(comment)) end @@ -88,13 +88,13 @@ class TestUtilFileParsing < Test::Unit::TestCase # The comment should still match assert_nothing_raised do - assert_equal({:record_type => :comment, :line => comment}, + assert_equal({:record_type => :comment, :line => comment}, @parser.parse_line(comment)) end # As should our new line type assert_nothing_raised do - assert_equal({:record_type => :blank, :line => ""}, + assert_equal({:record_type => :blank, :line => ""}, @parser.parse_line("")) end @@ -141,12 +141,12 @@ class TestUtilFileParsing < Test::Unit::TestCase end assert_nothing_raised("Did not parse old comment") do - assert_equal({:record_type => :comment, :line => comment}, + assert_equal({:record_type => :comment, :line => comment}, @parser.parse_line(comment)) end comment = '" another type of comment' assert_nothing_raised("Did not parse new comment") do - assert_equal({:record_type => :comment2, :line => comment}, + assert_equal({:record_type => :comment2, :line => comment}, @parser.parse_line(comment)) end @@ -318,7 +318,7 @@ class TestUtilFileParsing < Test::Unit::TestCase # Check parsing first result = @parser.parse_line(start) [:one, :two].each do |param| - assert_equal(record[param], result[param], + assert_equal(record[param], result[param], "Did not correctly parse %s" % start.inspect) end diff --git a/test/util/inifile.rb b/test/util/inifile.rb index 50075fa92..8ce52ee8d 100755 --- a/test/util/inifile.rb +++ b/test/util/inifile.rb @@ -13,7 +13,7 @@ class TestFileType < Test::Unit::TestCase super @file = Puppet::Util::IniConfig::File.new end - + def teardown @file = nil super @@ -43,7 +43,7 @@ class TestFileType < Test::Unit::TestCase @file.read(fsub) } main = get_section('main') - assert_entries(main, + assert_entries(main, { 'key1' => 'main.value1', 'key2' => 'main.value2' }) sub1 = get_section('sub1') assert_entries(sub1, { 'key1' => 'sub1 value1' }) @@ -106,9 +106,9 @@ class TestFileType < Test::Unit::TestCase end def assert_entries(section, hash) - hash.each do |k, v| - assert_equal(v, section[k], - "Expected <#{v}> for #{section.name}[#{k}] " + + hash.each do |k, v| + assert_equal(v, section[k], + "Expected <#{v}> for #{section.name}[#{k}] " + "but got <#{section[k]}>") end end diff --git a/test/util/log.rb b/test/util/log.rb index 74bb1faa1..00db10e61 100755 --- a/test/util/log.rb +++ b/test/util/log.rb @@ -195,7 +195,7 @@ class TestLog < Test::Unit::TestCase Puppet.warning "A test" assert(File.read(file) =~ /A test/, "File did not flush") - # Rename the file + # Rename the file newfile = file + ".old" File.rename(file, newfile) diff --git a/test/util/package.rb b/test/util/package.rb index 8d4fbc8e8..b77850d4b 100755 --- a/test/util/package.rb +++ b/test/util/package.rb @@ -11,7 +11,7 @@ class TestPuppetUtilPackage < Test::Unit::TestCase include Puppet::Util::Package def test_versioncmp - ary = %w{ 1.1.6 2.3 1.1a 3.0 1.5 1 2.4 1.1-4 + ary = %w{ 1.1.6 2.3 1.1a 3.0 1.5 1 2.4 1.1-4 2.3.1 1.2 2.3.0 1.1-3 2.4b 2.4 2.40.2 2.3a.1 3.1 0002 1.1-5 1.1.a 1.06} newary = nil diff --git a/test/util/settings.rb b/test/util/settings.rb index 1fdd425e6..6d5f6382a 100755 --- a/test/util/settings.rb +++ b/test/util/settings.rb @@ -205,7 +205,7 @@ yay = /a/path file = tempfile() File.open(file, "w") { |f| f.puts text } - + result = nil assert_nothing_raised { result = @config.send(:parse_file, file) @@ -348,7 +348,7 @@ yay = /a/path # already stored in a config def test_writingfiles File.umask(0022) - + path = tempfile() mode = 0644 @@ -374,7 +374,7 @@ yay = /a/path assert_equal(mode, filemode(path), "Modes are not equal") - # OS X is broken in how it chgrps files + # OS X is broken in how it chgrps files if Puppet::Util::SUIDManager.uid == 0 assert_equal(user.uid, File.stat(path).uid, "UIDS are not equal") @@ -388,7 +388,7 @@ yay = /a/path def test_mkdir File.umask(0022) - + path = tempfile() mode = 0755 @@ -413,7 +413,7 @@ yay = /a/path assert_equal(mode, filemode(path), "Modes are not equal") - # OS X and *BSD is broken in how it chgrps files + # OS X and *BSD is broken in how it chgrps files if Puppet::Util::SUIDManager.uid == 0 assert_equal(user.uid, File.stat(path).uid, "UIDS are not equal") @@ -448,7 +448,7 @@ yay = /a/path def test_configs_replace_in_url config = mkconfig - + config.setdefaults(:mysection, :name => ["yayness", "yay"]) config.setdefaults(:mysection, :url => ["http://$name/rahness", "yay"]) @@ -610,15 +610,15 @@ yay = /a/path # assert(! yay.find { |o| o.class.name == :group and o.name == "root" }, # "Found root group") end - + # #415 def test_remove_trailing_spaces config = mkconfig() file = tempfile() File.open(file, "w") { |f| f.puts "rah = something " } - + config.setdefaults(:yay, :config => [file, "eh"], :rah => ["testing", "a desc"]) - + assert_nothing_raised { config.parse } assert_equal("something", config[:rah], "did not remove trailing whitespace in parsing") end @@ -701,7 +701,7 @@ yay = /a/path def test_get_getopt_args element = CElement.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") - + element.short = "n" assert_equal([["--foo", "-n", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") diff --git a/test/util/storage.rb b/test/util/storage.rb index 89c3b13f8..e2c4dce59 100755 --- a/test/util/storage.rb +++ b/test/util/storage.rb @@ -74,7 +74,7 @@ class TestStorage < Test::Unit::TestCase assert_same Hash, state.class assert_equal 0, state.size end - + def test_caching hash = nil one = Puppet::Type.type(:exec).new :title => "/bin/echo one" @@ -83,7 +83,7 @@ class TestStorage < Test::Unit::TestCase hash = Puppet::Util::Storage.cache(object) end assert_equal({}, hash, "Did not get empty hash back for %s" % object) - + hash[:testing] = true assert_nothing_raised do hash = Puppet::Util::Storage.cache(object) diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb index 41c9b517a..62179084f 100755 --- a/test/util/utiltest.rb +++ b/test/util/utiltest.rb @@ -119,7 +119,7 @@ class TestPuppetUtil < Test::Unit::TestCase assert_equal(nil, ret) end - + def test_execute command = tempfile() File.open(command, "w") { |f| @@ -131,13 +131,13 @@ class TestPuppetUtil < Test::Unit::TestCase output = Puppet::Util.execute([command, "yaytest", "funtest"]) end assert_equal("yaytest\nfuntest\n", output) - + # Now try it with a single quote assert_nothing_raised do output = Puppet::Util.execute([command, "yay'test", "funtest"]) end assert_equal("yay'test\nfuntest\n", output) - + # Now make sure we can squelch output (#565) assert_nothing_raised do output = Puppet::Util.execute([command, "yay'test", "funtest"], :squelch => true) @@ -148,12 +148,12 @@ class TestPuppetUtil < Test::Unit::TestCase assert_raise(Puppet::ExecutionFailure) do out = Puppet::Util.execute(["touch", "/no/such/file/could/exist"]) end - + # And that we can tell it not to fail assert_nothing_raised() do out = Puppet::Util.execute(["touch", "/no/such/file/could/exist"], :failonfail => false) end - + if Process.uid == 0 # Make sure we correctly set our uid and gid user = nonrootuser @@ -164,13 +164,13 @@ class TestPuppetUtil < Test::Unit::TestCase end assert(FileTest.exists?(file), "file was not created") assert_equal(user.uid, File.stat(file).uid, "uid was not set correctly") - + # We can't really check the gid, because it just behaves too # inconsistently everywhere. # assert_equal(group.gid, File.stat(file).gid, # "gid was not set correctly") end - + # (#565) Test the case of patricide. patricidecommand = tempfile() File.open(patricidecommand, "w") { |f| @@ -202,7 +202,7 @@ class TestPuppetUtil < Test::Unit::TestCase ENV["LC_MESSAGES"] = orig_lc_messages ENV["LANGUAGE"] = orig_lc_messages end - + # Mmm, we love gettext(3) ENV["LANG"] = "en_US" ENV["LC_ALL"] = "en_US" @@ -213,12 +213,12 @@ class TestPuppetUtil < Test::Unit::TestCase assert_equal('C', Puppet::Util.execute(['ruby', '-e', "print ENV['#{env}']"]), "Environment var #{env} wasn't set to 'C'") - + assert_equal 'en_US', ENV[env], "Environment var #{env} not set back correctly" end end - + # Check whether execute() accepts strings in addition to arrays. def test_string_exec cmd = "/bin/echo howdy" |
