mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rake: Update rake to fix some bugs and hide deprecated features
from RDoc. * lib/rake/version.rb: Bump version to 0.9.2.1 to distinguish it from the released version. * NEWS: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
84ece95163
commit
2619f216fe
19 changed files with 170 additions and 84 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Tue Jun 28 11:45:30 2011 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
|
* lib/rake: Update rake to fix some bugs and hide deprecated features
|
||||||
|
from RDoc.
|
||||||
|
* lib/rake/version.rb: Bump version to 0.9.2.1 to distinguish it from
|
||||||
|
the released version.
|
||||||
|
* NEWS: ditto
|
||||||
|
|
||||||
Tue Jun 28 11:17:28 2011 Eric Hodel <drbrain@segment7.net>
|
Tue Jun 28 11:17:28 2011 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
* lib/rdoc: Update to RDoc 3.7 (final)
|
* lib/rdoc: Update to RDoc 3.7 (final)
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -195,7 +195,7 @@ with all sufficient information, see the ChangeLog file.
|
||||||
* support for bash/zsh completion.
|
* support for bash/zsh completion.
|
||||||
|
|
||||||
* Rake
|
* Rake
|
||||||
* Rake has been upgraded from 0.8.7 to 0.9.2. For full release notes see
|
* Rake has been upgraded from 0.8.7 to 0.9.2.1. For full release notes see
|
||||||
https://github.com/jimweirich/rake/blob/master/CHANGES
|
https://github.com/jimweirich/rake/blob/master/CHANGES
|
||||||
|
|
||||||
* RDoc
|
* RDoc
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
|
|
||||||
require 'rake/version'
|
require 'rake/version'
|
||||||
|
|
||||||
|
# :stopdoc:
|
||||||
RAKEVERSION = Rake::VERSION
|
RAKEVERSION = Rake::VERSION
|
||||||
|
# :startdoc:
|
||||||
|
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
# referenced Task from the top level.
|
# referenced Task from the top level.
|
||||||
|
|
||||||
warn "WARNING: Classic namespaces are deprecated and will be removed from future versions of Rake."
|
warn "WARNING: Classic namespaces are deprecated and will be removed from future versions of Rake."
|
||||||
|
# :stopdoc:
|
||||||
Task = Rake::Task
|
Task = Rake::Task
|
||||||
FileTask = Rake::FileTask
|
FileTask = Rake::FileTask
|
||||||
FileCreationTask = Rake::FileCreationTask
|
FileCreationTask = Rake::FileCreationTask
|
||||||
RakeApp = Rake::Application
|
RakeApp = Rake::Application
|
||||||
|
# :startdoc:
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
require 'rake'
|
require 'rake'
|
||||||
|
|
||||||
|
# :stopdoc:
|
||||||
CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
||||||
CLEAN.clear_exclude.exclude { |fn|
|
CLEAN.clear_exclude.exclude { |fn|
|
||||||
fn.pathmap("%f") == 'core' && File.directory?(fn)
|
fn.pathmap("%f") == 'core' && File.directory?(fn)
|
||||||
|
|
|
@ -2,11 +2,18 @@
|
||||||
require 'rake/file_utils_ext'
|
require 'rake/file_utils_ext'
|
||||||
|
|
||||||
module Rake
|
module Rake
|
||||||
|
|
||||||
|
##
|
||||||
|
# DSL is a module that provides #task, #desc, #namespace, etc. Use this
|
||||||
|
# when you'd like to use rake outside the top level scope.
|
||||||
|
|
||||||
module DSL
|
module DSL
|
||||||
|
|
||||||
|
#--
|
||||||
# Include the FileUtils file manipulation functions in the top
|
# Include the FileUtils file manipulation functions in the top
|
||||||
# level module, but mark them private so that they don't
|
# level module, but mark them private so that they don't
|
||||||
# unintentionally define methods on other objects.
|
# unintentionally define methods on other objects.
|
||||||
|
#++
|
||||||
|
|
||||||
include FileUtilsExt
|
include FileUtilsExt
|
||||||
private(*FileUtils.instance_methods(false))
|
private(*FileUtils.instance_methods(false))
|
||||||
|
@ -139,7 +146,7 @@ module Rake
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module DeprecatedObjectDSL
|
module DeprecatedObjectDSL # :nodoc:
|
||||||
Commands = Object.new.extend DSL
|
Commands = Object.new.extend DSL
|
||||||
DSL.private_instance_methods(false).each do |name|
|
DSL.private_instance_methods(false).each do |name|
|
||||||
line = __LINE__+1
|
line = __LINE__+1
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# ###########################################################################
|
#--
|
||||||
# Extensions to time to allow comparisons with an early time class.
|
# Extensions to time to allow comparisons with an early time class.
|
||||||
#
|
|
||||||
class Time
|
class Time
|
||||||
alias rake_original_time_compare :<=>
|
alias rake_original_time_compare :<=>
|
||||||
def <=>(other)
|
def <=>(other)
|
||||||
|
@ -10,5 +10,5 @@ class Time
|
||||||
rake_original_time_compare(other)
|
rake_original_time_compare(other)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end # class Time
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
|
|
||||||
# ###########################################################################
|
#--
|
||||||
# This a FileUtils extension that defines several additional commands to be
|
# This a FileUtils extension that defines several additional commands to be
|
||||||
# added to the FileUtils utility functions.
|
# added to the FileUtils utility functions.
|
||||||
#
|
|
||||||
module FileUtils
|
module FileUtils
|
||||||
# Path to the currently running Ruby program
|
# Path to the currently running Ruby program
|
||||||
RUBY = File.join(
|
RUBY = File.join(
|
||||||
|
@ -38,6 +37,7 @@ module FileUtils
|
||||||
options[:noop] ||= Rake::FileUtilsExt.nowrite_flag
|
options[:noop] ||= Rake::FileUtilsExt.nowrite_flag
|
||||||
Rake.rake_check_options options, :noop, :verbose
|
Rake.rake_check_options options, :noop, :verbose
|
||||||
Rake.rake_output_message cmd.join(" ") if options[:verbose]
|
Rake.rake_output_message cmd.join(" ") if options[:verbose]
|
||||||
|
|
||||||
unless options[:noop]
|
unless options[:noop]
|
||||||
res = rake_system(*cmd)
|
res = rake_system(*cmd)
|
||||||
status = $?
|
status = $?
|
||||||
|
@ -46,7 +46,7 @@ module FileUtils
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_shell_runner(cmd)
|
def create_shell_runner(cmd) # :nodoc:
|
||||||
show_command = cmd.join(" ")
|
show_command = cmd.join(" ")
|
||||||
show_command = show_command[0,42] + "..." unless $trace
|
show_command = show_command[0,42] + "..." unless $trace
|
||||||
lambda { |ok, status|
|
lambda { |ok, status|
|
||||||
|
@ -55,14 +55,16 @@ module FileUtils
|
||||||
end
|
end
|
||||||
private :create_shell_runner
|
private :create_shell_runner
|
||||||
|
|
||||||
def set_verbose_option(options)
|
def set_verbose_option(options) # :nodoc:
|
||||||
if options[:verbose].nil?
|
unless options.key? :verbose
|
||||||
options[:verbose] = Rake::FileUtilsExt.verbose_flag.nil? || Rake::FileUtilsExt.verbose_flag
|
options[:verbose] =
|
||||||
|
Rake::FileUtilsExt.verbose_flag == Rake::FileUtilsExt::DEFAULT ||
|
||||||
|
Rake::FileUtilsExt.verbose_flag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
private :set_verbose_option
|
private :set_verbose_option
|
||||||
|
|
||||||
def rake_system(*cmd)
|
def rake_system(*cmd) # :nodoc:
|
||||||
Rake::AltSystem.system(*cmd)
|
Rake::AltSystem.system(*cmd)
|
||||||
end
|
end
|
||||||
private :rake_system
|
private :rake_system
|
||||||
|
|
|
@ -12,7 +12,10 @@ module Rake
|
||||||
class << self
|
class << self
|
||||||
attr_accessor :verbose_flag, :nowrite_flag
|
attr_accessor :verbose_flag, :nowrite_flag
|
||||||
end
|
end
|
||||||
FileUtilsExt.verbose_flag = nil
|
|
||||||
|
DEFAULT = Object.new
|
||||||
|
|
||||||
|
FileUtilsExt.verbose_flag = DEFAULT
|
||||||
FileUtilsExt.nowrite_flag = false
|
FileUtilsExt.nowrite_flag = false
|
||||||
|
|
||||||
$fileutils_verbose = true
|
$fileutils_verbose = true
|
||||||
|
|
|
@ -7,6 +7,8 @@ require 'rubygems/package_task'
|
||||||
|
|
||||||
require 'rake'
|
require 'rake'
|
||||||
|
|
||||||
|
# :stopdoc:
|
||||||
|
|
||||||
module Rake
|
module Rake
|
||||||
GemPackageTask = Gem::PackageTask
|
GemPackageTask = Gem::PackageTask
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,22 @@
|
||||||
require 'rake'
|
require 'rake'
|
||||||
|
|
||||||
# Load the test files from the command line.
|
# Load the test files from the command line.
|
||||||
|
argv = ARGV.select do |argument|
|
||||||
|
case argument
|
||||||
|
when /^-/ then
|
||||||
|
argument
|
||||||
|
when /\*/ then
|
||||||
|
FileList[argument].to_a.each do |file|
|
||||||
|
require File.expand_path file
|
||||||
|
end
|
||||||
|
|
||||||
ARGV.each do |f|
|
false
|
||||||
next if f =~ /^-/
|
|
||||||
|
|
||||||
if f =~ /\*/
|
|
||||||
FileList[f].to_a.each { |fn| require File.expand_path(fn) }
|
|
||||||
else
|
else
|
||||||
require File.expand_path(f)
|
require File.expand_path argument
|
||||||
|
|
||||||
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ARGV.replace argv
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ begin
|
||||||
rescue LoadError, Gem::LoadError
|
rescue LoadError, Gem::LoadError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# :stopdoc:
|
||||||
|
|
||||||
if defined?(RDoc::Task) then
|
if defined?(RDoc::Task) then
|
||||||
module Rake
|
module Rake
|
||||||
RDocTask = RDoc::Task unless const_defined? :RDocTask
|
RDocTask = RDoc::Task unless const_defined? :RDocTask
|
||||||
|
|
|
@ -43,6 +43,10 @@ module Rake
|
||||||
@hash.each(&block)
|
@hash.each(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def values_at(*keys)
|
||||||
|
keys.map { |k| lookup(k) }
|
||||||
|
end
|
||||||
|
|
||||||
def method_missing(sym, *args, &block)
|
def method_missing(sym, *args, &block)
|
||||||
lookup(sym.to_sym)
|
lookup(sym.to_sym)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Rake
|
module Rake
|
||||||
VERSION = '0.9.2'
|
VERSION = '0.9.2.1'
|
||||||
|
|
||||||
module Version
|
module Version # :nodoc: all
|
||||||
MAJOR, MINOR, BUILD = VERSION.split '.'
|
MAJOR, MINOR, BUILD = VERSION.split '.'
|
||||||
NUMBERS = [ MAJOR, MINOR, BUILD ]
|
NUMBERS = [ MAJOR, MINOR, BUILD ]
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,7 @@ class TestRakeFileUtils < Rake::TestCase
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
FileUtils::LN_SUPPORTED[0] = true
|
FileUtils::LN_SUPPORTED[0] = true
|
||||||
|
RakeFileUtils.verbose_flag = Rake::FileUtilsExt::DEFAULT
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
@ -101,7 +102,11 @@ class TestRakeFileUtils < Rake::TestCase
|
||||||
|
|
||||||
def test_file_utils_methods_are_available_at_top_level
|
def test_file_utils_methods_are_available_at_top_level
|
||||||
create_file("a")
|
create_file("a")
|
||||||
|
|
||||||
|
capture_io do
|
||||||
rm_rf "a"
|
rm_rf "a"
|
||||||
|
end
|
||||||
|
|
||||||
refute File.exist?("a")
|
refute File.exist?("a")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -208,7 +213,7 @@ class TestRakeFileUtils < Rake::TestCase
|
||||||
assert_equal "shellcommand.rb\n", err
|
assert_equal "shellcommand.rb\n", err
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sh_no_verbose
|
def test_sh_verbose_false
|
||||||
shellcommand
|
shellcommand
|
||||||
|
|
||||||
_, err = capture_io do
|
_, err = capture_io do
|
||||||
|
@ -220,6 +225,16 @@ class TestRakeFileUtils < Rake::TestCase
|
||||||
assert_equal '', err
|
assert_equal '', err
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_sh_verbose_flag_nil
|
||||||
|
shellcommand
|
||||||
|
|
||||||
|
RakeFileUtils.verbose_flag = nil
|
||||||
|
|
||||||
|
assert_silent do
|
||||||
|
sh %{shellcommand.rb}, :noop=>true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_ruby_with_a_single_string_argument
|
def test_ruby_with_a_single_string_argument
|
||||||
check_expansion
|
check_expansion
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ class TestRakeFunctional < Rake::TestCase
|
||||||
|
|
||||||
rake
|
rake
|
||||||
|
|
||||||
assert_not_match %r{^BAD:}, @out
|
refute_match %r{^BAD:}, @out
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_rbext
|
def test_rbext
|
||||||
|
@ -441,7 +441,7 @@ class TestRakeFunctional < Rake::TestCase
|
||||||
|
|
||||||
rake "-T"
|
rake "-T"
|
||||||
|
|
||||||
assert_not_match("t2", @out)
|
refute_match("t2", @out)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_comment_after_desc_is_ignored
|
def test_comment_after_desc_is_ignored
|
||||||
|
@ -476,10 +476,6 @@ class TestRakeFunctional < Rake::TestCase
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def assert_not_match(pattern, string, comment="'#{pattern}' was found (incorrectly) in '#{string}.inspect")
|
|
||||||
assert_nil Regexp.new(pattern).match(string), comment
|
|
||||||
end
|
|
||||||
|
|
||||||
# Run a shell Ruby command with command line options (using the
|
# Run a shell Ruby command with command line options (using the
|
||||||
# default test options). Output is captured in @out, @err and
|
# default test options). Output is captured in @out, @err and
|
||||||
# @status.
|
# @status.
|
||||||
|
|
21
test/rake/test_rake_rake_test_loader.rb
Normal file
21
test/rake/test_rake_rake_test_loader.rb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
require File.expand_path('../helper', __FILE__)
|
||||||
|
|
||||||
|
class TestRakeRakeTestLoader < Rake::TestCase
|
||||||
|
|
||||||
|
def test_pattern
|
||||||
|
orig_LOADED_FEATURES = $:.dup
|
||||||
|
FileUtils.touch 'foo.rb'
|
||||||
|
FileUtils.touch 'test_a.rb'
|
||||||
|
FileUtils.touch 'test_b.rb'
|
||||||
|
|
||||||
|
ARGV.replace %w[foo.rb test_*.rb -v]
|
||||||
|
|
||||||
|
load File.join(@orig_PWD, 'lib/rake/rake_test_loader.rb')
|
||||||
|
|
||||||
|
assert_equal %w[-v], ARGV
|
||||||
|
ensure
|
||||||
|
$:.replace orig_LOADED_FEATURES
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
|
@ -158,5 +158,13 @@ class TestRakeTaskWithArguments < Rake::TestCase
|
||||||
t = task(:t => [:pre])
|
t = task(:t => [:pre])
|
||||||
t.invoke("bill", "1.2")
|
t.invoke("bill", "1.2")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_values_at
|
||||||
|
t = task(:pre, [:a, :b, :c]) { |t, args|
|
||||||
|
a, b, c = args.values_at(:a, :b, :c)
|
||||||
|
assert_equal %w[1 2 3], [a, b, c]
|
||||||
|
}
|
||||||
|
t.invoke(*%w[1 2 3])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,18 +4,7 @@ require 'rake/testtask'
|
||||||
class TestRakeTestTask < Rake::TestCase
|
class TestRakeTestTask < Rake::TestCase
|
||||||
include Rake
|
include Rake
|
||||||
|
|
||||||
def setup
|
def test_initialize
|
||||||
super
|
|
||||||
|
|
||||||
Task.clear
|
|
||||||
ENV.delete('TEST')
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_no_task
|
|
||||||
assert ! Task.task_defined?(:test)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_defaults
|
|
||||||
tt = Rake::TestTask.new do |t| end
|
tt = Rake::TestTask.new do |t| end
|
||||||
refute_nil tt
|
refute_nil tt
|
||||||
assert_equal :test, tt.name
|
assert_equal :test, tt.name
|
||||||
|
@ -25,7 +14,7 @@ class TestRakeTestTask < Rake::TestCase
|
||||||
assert Task.task_defined?(:test)
|
assert Task.task_defined?(:test)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_non_defaults
|
def test_initialize_override
|
||||||
tt = Rake::TestTask.new(:example) do |t|
|
tt = Rake::TestTask.new(:example) do |t|
|
||||||
t.libs = ['src', 'ext']
|
t.libs = ['src', 'ext']
|
||||||
t.pattern = 'test/tc_*.rb'
|
t.pattern = 'test/tc_*.rb'
|
||||||
|
@ -39,29 +28,43 @@ class TestRakeTestTask < Rake::TestCase
|
||||||
assert Task.task_defined?(:example)
|
assert Task.task_defined?(:example)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_pattern
|
def test_file_list_ENV_TEST
|
||||||
|
ENV['TEST'] = 'testfile.rb'
|
||||||
|
tt = Rake::TestTask.new do |t|
|
||||||
|
t.pattern = '*'
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal ["testfile.rb"], tt.file_list.to_a
|
||||||
|
ensure
|
||||||
|
ENV.delete 'TEST'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_libs_equals
|
||||||
|
test_task = Rake::TestTask.new do |t|
|
||||||
|
t.libs << ["A", "B"]
|
||||||
|
end
|
||||||
|
|
||||||
|
path = %w[lib A B].join File::PATH_SEPARATOR
|
||||||
|
|
||||||
|
assert_equal "-I\"#{path}\"", test_task.ruby_opts_string
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_libs_equals_empty
|
||||||
|
test_task = Rake::TestTask.new do |t|
|
||||||
|
t.libs = []
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal '', test_task.ruby_opts_string
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_pattern_equals
|
||||||
tt = Rake::TestTask.new do |t|
|
tt = Rake::TestTask.new do |t|
|
||||||
t.pattern = '*.rb'
|
t.pattern = '*.rb'
|
||||||
end
|
end
|
||||||
assert_equal ['*.rb'], tt.file_list.to_a
|
assert_equal ['*.rb'], tt.file_list.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_env_test
|
def test_pattern_equals_test_files_equals
|
||||||
ENV['TEST'] = 'testfile.rb'
|
|
||||||
tt = Rake::TestTask.new do |t|
|
|
||||||
t.pattern = '*'
|
|
||||||
end
|
|
||||||
assert_equal ["testfile.rb"], tt.file_list.to_a
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_test_files
|
|
||||||
tt = Rake::TestTask.new do |t|
|
|
||||||
t.test_files = FileList['a.rb', 'b.rb']
|
|
||||||
end
|
|
||||||
assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_both_pattern_and_test_files
|
|
||||||
tt = Rake::TestTask.new do |t|
|
tt = Rake::TestTask.new do |t|
|
||||||
t.test_files = FileList['a.rb', 'b.rb']
|
t.test_files = FileList['a.rb', 'b.rb']
|
||||||
t.pattern = '*.rb'
|
t.pattern = '*.rb'
|
||||||
|
@ -69,48 +72,49 @@ class TestRakeTestTask < Rake::TestCase
|
||||||
assert_equal ['a.rb', 'b.rb', '*.rb'], tt.file_list.to_a
|
assert_equal ['a.rb', 'b.rb', '*.rb'], tt.file_list.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_direct_run_has_quoted_paths
|
def test_run_code_direct
|
||||||
test_task = Rake::TestTask.new(:tx) do |t|
|
test_task = Rake::TestTask.new do |t|
|
||||||
t.loader = :direct
|
t.loader = :direct
|
||||||
end
|
end
|
||||||
assert_match(/-e ".*"/, test_task.run_code)
|
|
||||||
|
assert_equal '-e "ARGV.each{|f| require f}"', test_task.run_code
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_testrb_run_has_quoted_paths_on_ruby_182
|
def test_run_code_rake
|
||||||
test_task = Rake::TestTask.new(:tx) do |t|
|
test_task = Rake::TestTask.new do |t|
|
||||||
|
t.loader = :rake
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_match(/-I".*?" ".*?"/, test_task.run_code)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_run_code_testrb_ruby_1_8_2
|
||||||
|
test_task = Rake::TestTask.new do |t|
|
||||||
t.loader = :testrb
|
t.loader = :testrb
|
||||||
end
|
end
|
||||||
|
|
||||||
flexmock(test_task).should_receive(:ruby_version).and_return('1.8.2')
|
flexmock(test_task).should_receive(:ruby_version).and_return('1.8.2')
|
||||||
|
|
||||||
assert_match(/^-S testrb +".*"$/, test_task.run_code)
|
assert_match(/^-S testrb +".*"$/, test_task.run_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_testrb_run_has_quoted_paths_on_ruby_186
|
def test_run_code_testrb_ruby_1_8_6
|
||||||
test_task = Rake::TestTask.new(:tx) do |t|
|
test_task = Rake::TestTask.new do |t|
|
||||||
t.loader = :testrb
|
t.loader = :testrb
|
||||||
end
|
end
|
||||||
|
|
||||||
flexmock(test_task).should_receive(:ruby_version).and_return('1.8.6')
|
flexmock(test_task).should_receive(:ruby_version).and_return('1.8.6')
|
||||||
|
|
||||||
assert_match(/^-S testrb +$/, test_task.run_code)
|
assert_match(/^-S testrb +$/, test_task.run_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_rake_run_has_quoted_paths
|
def test_test_files_equals
|
||||||
test_task = Rake::TestTask.new(:tx) do |t|
|
tt = Rake::TestTask.new do |t|
|
||||||
t.loader = :rake
|
t.test_files = FileList['a.rb', 'b.rb']
|
||||||
end
|
|
||||||
assert_match(/".*"/, test_task.run_code)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_nested_libs_will_be_flattened
|
assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
|
||||||
test_task = Rake::TestTask.new(:tx) do |t|
|
|
||||||
t.libs << ["A", "B"]
|
|
||||||
end
|
|
||||||
sep = File::PATH_SEPARATOR
|
|
||||||
assert_match(/lib#{sep}A#{sep}B/, test_task.ruby_opts_string)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_empty_lib_path_implies_no_dash_I_option
|
|
||||||
test_task = Rake::TestTask.new(:tx) do |t|
|
|
||||||
t.libs = []
|
|
||||||
end
|
|
||||||
refute_match(/-I/, test_task.ruby_opts_string)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue