diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-06 00:49:14 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-06 00:49:14 +0000 |
| commit | c5ce953462f424138f0009ce978eb9620aff84a7 (patch) | |
| tree | 17b5651ee9b996f735c283b95ad74322a3e94a19 /test | |
| parent | 2113eed0137630836b3de3e2a8bc17b6cb7198e8 (diff) | |
| download | puppet-c5ce953462f424138f0009ce978eb9620aff84a7.tar.gz puppet-c5ce953462f424138f0009ce978eb9620aff84a7.tar.xz puppet-c5ce953462f424138f0009ce978eb9620aff84a7.zip | |
Adding aptitude support, including a new util::package module that provides a method for package version sorting, and a couple of smaller bug fixes. This fixes #237.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1570 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/loadedfile.rb (renamed from test/other/parsedfile.rb) | 8 | ||||
| -rwxr-xr-x | test/other/puppet.rb | 1 | ||||
| -rw-r--r-- | test/types/service.rb | 1 | ||||
| -rwxr-xr-x | test/util/classgen.rb | 2 | ||||
| -rwxr-xr-x | test/util/package.rb | 30 |
5 files changed, 35 insertions, 7 deletions
diff --git a/test/other/parsedfile.rb b/test/other/loadedfile.rb index 2f87308ab..efb17a1e5 100755 --- a/test/other/parsedfile.rb +++ b/test/other/loadedfile.rb @@ -5,11 +5,11 @@ if __FILE__ == $0 end require 'puppet' -require 'puppet/parsedfile' +require 'puppet/loadedfile' require 'puppettest' require 'test/unit' -class TestParsedFile < Test::Unit::TestCase +class TestLoadedFile < Test::Unit::TestCase include TestPuppet def test_file Puppet[:filetimeout] = 0 @@ -17,7 +17,7 @@ class TestParsedFile < Test::Unit::TestCase path = tempfile() File.open(path, "w") { |f| f.puts "yayness" } assert_nothing_raised { - file = Puppet::ParsedFile.new(path) + file = Puppet::LoadedFile.new(path) } assert(!file.changed?, "File incorrectly returned changed") @@ -36,7 +36,7 @@ class TestParsedFile < Test::Unit::TestCase File.open(path, "w") { |f| f.puts "yay" } file = nil assert_nothing_raised { - file = Puppet::ParsedFile.new(path) + file = Puppet::LoadedFile.new(path) } assert_nothing_raised { file.changed? } diff --git a/test/other/puppet.rb b/test/other/puppet.rb index b9ddb07b0..18600f7a0 100755 --- a/test/other/puppet.rb +++ b/test/other/puppet.rb @@ -5,7 +5,6 @@ if __FILE__ == $0 end require 'puppet' -require 'puppet/parsedfile' require 'puppettest' require 'test/unit' diff --git a/test/types/service.rb b/test/types/service.rb index c6f530dc7..e936e8f84 100644 --- a/test/types/service.rb +++ b/test/types/service.rb @@ -16,7 +16,6 @@ end if $skipsvcs puts "Skipping service testing on %s" % Facter["operatingsystem"].value else - puts "wtf?" #class TestInitService < Test::Unit::TestCase class TestInitService include TestPuppet diff --git a/test/util/classgen.rb b/test/util/classgen.rb index 825a98f3c..7b1b4731c 100755 --- a/test/util/classgen.rb +++ b/test/util/classgen.rb @@ -58,7 +58,7 @@ class TestPuppetUtilClassGen < Test::Unit::TestCase klass = nil assert_nothing_raised { - klass = GenTest.genclass(:yayness, :parent => newclass) + klass = GenTest.genclass(:funtest, :parent => newclass) } assert(klass.preinited, "prehook did not get called") diff --git a/test/util/package.rb b/test/util/package.rb new file mode 100755 index 000000000..2d7f633de --- /dev/null +++ b/test/util/package.rb @@ -0,0 +1,30 @@ +if __FILE__ == $0 + $:.unshift '..' + $:.unshift '../../lib' + $puppetbase = ".." +end + +require 'puppet' +require 'puppet/util/package' +require 'puppettest' +require 'test/unit' + +class TestPuppetUtilPackage < Test::Unit::TestCase + include TestPuppet + 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 + 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 + assert_nothing_raised do + newary = ary.sort { |a, b| + versioncmp(a,b) + } + end + assert_equal(["0002", "1", "1.06", "1.1-3", "1.1-4", "1.1-5", "1.1.6", "1.1.a", "1.1a", "1.2", "1.5", "2.3", "2.3.0", "2.3.1", "2.3a.1", "2.4", "2.4", "2.4b", "2.40.2", "3.0", "3.1"], newary) + end +end + +# $Id$ |
