aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/test/.gitignore1
-rw-r--r--Library/Homebrew/test/Rakefile22
-rw-r--r--Library/Homebrew/test/testing_env.rb7
3 files changed, 27 insertions, 3 deletions
diff --git a/Library/Homebrew/test/.gitignore b/Library/Homebrew/test/.gitignore
new file mode 100644
index 000000000..3b6ee585f
--- /dev/null
+++ b/Library/Homebrew/test/.gitignore
@@ -0,0 +1 @@
+/coverage
diff --git a/Library/Homebrew/test/Rakefile b/Library/Homebrew/test/Rakefile
index cf3000b9b..5faa77ca7 100644
--- a/Library/Homebrew/test/Rakefile
+++ b/Library/Homebrew/test/Rakefile
@@ -1,9 +1,10 @@
require 'rake'
require 'rake/testtask'
-Dir.chdir File.expand_path(File.dirname(__FILE__))
+TEST_DIRECTORY = File.expand_path(File.dirname(__FILE__))
+TEST_FILES = FileList["#{TEST_DIRECTORY}/test_*.rb"]
-TEST_FILES = FileList['test_*.rb']
+Dir.chdir TEST_DIRECTORY
task :default => :test
@@ -21,3 +22,20 @@ namespace :test do
end
end
end
+
+begin
+ require 'rubygems'
+ require 'rcov/rcovtask'
+
+ Rcov::RcovTask.new do |t|
+ t.libs << Dir.pwd
+ t.test_files = TEST_FILES
+ t.rcov_opts = %w{--exclude=Gems
+ --exclude=test_
+ --exclude=testball
+ --exclude=testing}
+ t.output_dir = TEST_DIRECTORY+'/coverage'
+ end
+rescue LoadError
+ nil
+end
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb
index 9a760cf23..7042b77e1 100644
--- a/Library/Homebrew/test/testing_env.rb
+++ b/Library/Homebrew/test/testing_env.rb
@@ -25,8 +25,13 @@ HOMEBREW_CURL_ARGS = '-fsLA'
MACOS_VERSION=10.6
(HOMEBREW_PREFIX+'Library/Formula').mkpath
+
+prevwd = Dir.pwd
Dir.chdir HOMEBREW_PREFIX
-at_exit { HOMEBREW_PREFIX.parent.rmtree }
+at_exit do
+ Dir.chdir prevwd
+ HOMEBREW_PREFIX.parent.rmtree
+end
# Test fixtures and files can be found relative to this path
TEST_FOLDER = Pathname.new(ABS__FILE__).parent.realpath