diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-15 03:07:37 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-15 03:07:37 +0000 |
commit | 6361928083d01906ab9d8782b6533b4ed7c834a0 (patch) | |
tree | 172488be8a74c9313d35b9cd7d53999cd55f561d /lib/rake/testtask.rb | |
parent | 031e1570b934d6b3a1e17ae8eb78a44dac8186d3 (diff) | |
download | ruby-6361928083d01906ab9d8782b6533b4ed7c834a0.tar.gz |
* lib/rake.rb, lib/rake/*.rb: Upgrade to rake-10.3.2
[fix GH-668]
* test/rake/*.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rake/testtask.rb')
-rw-r--r-- | lib/rake/testtask.rb | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb index c693dd2626..2daa589634 100644 --- a/lib/rake/testtask.rb +++ b/lib/rake/testtask.rb @@ -1,5 +1,3 @@ -# Define a task library for running unit tests. - require 'rake' require 'rake/tasklib' @@ -67,6 +65,9 @@ module Rake # Array of commandline options to pass to ruby when running test loader. attr_accessor :ruby_opts + # Description of the test task. (default is 'Run tests') + attr_accessor :description + # Explicitly define the list of test files to be included in a # test. +list+ is expected to be an array of file names (a # FileList is acceptable). If both +pattern+ and +test_files+ are @@ -86,6 +87,7 @@ module Rake @warning = false @loader = :rake @ruby_opts = [] + @description = "Run tests" + (@name == :test ? "" : " for #{@name}") yield self if block_given? @pattern = 'test/test*.rb' if @pattern.nil? && @test_files.nil? define @@ -93,7 +95,7 @@ module Rake # Create the tasks defined by this task lib. def define - desc "Run tests" + (@name == :test ? "" : " for #{@name}") + desc @description task @name do FileUtilsExt.verbose(@verbose) do args = @@ -121,18 +123,18 @@ module Rake "") end - def ruby_opts_string + def ruby_opts_string # :nodoc: opts = @ruby_opts.dup opts.unshift("-I\"#{lib_path}\"") unless @libs.empty? opts.unshift("-w") if @warning opts.join(" ") end - def lib_path + def lib_path # :nodoc: @libs.join(File::PATH_SEPARATOR) end - def file_list_string + def file_list_string # :nodoc: file_list.map { |fn| "\"#{fn}\"" }.join(' ') end @@ -156,18 +158,18 @@ module Rake end || '' end - def ruby_version + def ruby_version # :nodoc: RUBY_VERSION end - def run_code + def run_code # :nodoc: case @loader when :direct "-e \"ARGV.each{|f| require f}\"" when :testrb "-S testrb #{fix}" when :rake - "-I\"#{rake_lib_dir}\" \"#{rake_loader}\"" + "#{rake_include_arg} \"#{rake_loader}\"" end end @@ -184,6 +186,15 @@ module Rake nil end + def rake_include_arg # :nodoc: + spec = Gem.loaded_specs['rake'] + if spec.respond_to?(:default_gem?) && spec.default_gem? + "" + else + "-I\"#{rake_lib_dir}\"" + end + end + def rake_lib_dir # :nodoc: find_dir('rake') or fail "unable to find rake lib" |