diff options
author | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-31 01:29:54 +0000 |
---|---|---|
committer | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-31 01:29:54 +0000 |
commit | 9b1e8d55363aa67e9e981b7977ed6eded8026b68 (patch) | |
tree | cb6c85daf5e8ea3fe3dfc023d92054a9b99e06d0 | |
parent | bdc819b48857b5994fb9e1dcaddf3ac5ee59fb21 (diff) | |
download | puppet-9b1e8d55363aa67e9e981b7977ed6eded8026b68.tar.gz puppet-9b1e8d55363aa67e9e981b7977ed6eded8026b68.tar.xz puppet-9b1e8d55363aa67e9e981b7977ed6eded8026b68.zip |
Accept a single file as a test to run in addition to a directory
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1046 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | test/puppettest.rb | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/test/puppettest.rb b/test/puppettest.rb index a8af679fb..8bcef7faa 100644 --- a/test/puppettest.rb +++ b/test/puppettest.rb @@ -890,24 +890,26 @@ class PuppetTestSuite def initialize(name) path = File.join(self.class.basedir, name) - unless FileTest.directory?(path) - puts "TestSuites are directories containing test cases" + if FileTest.directory?(path) + # load each of the files + Dir.entries(path).collect { |file| + File.join(path,file) + }.find_all { |file| + FileTest.file?(file) and file =~ /\.rb$/ + }.sort { |a,b| + # in the order they were modified, so the last modified files + # are loaded and thus displayed last + File.stat(b) <=> File.stat(a) + }.each { |file| + require file + } + elsif FileTest.file?(path) && path =~ /\.rb$/ + require path + else + puts "TestSuites are directories or files containing test cases" puts "no such directory: %s" % path exit(65) end - - # load each of the files - Dir.entries(path).collect { |file| - File.join(path,file) - }.find_all { |file| - FileTest.file?(file) and file =~ /\.rb$/ - }.sort { |a,b| - # in the order they were modified, so the last modified files - # are loaded and thus displayed last - File.stat(b) <=> File.stat(a) - }.each { |file| - require file - } end end |