diff options
-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 |