prefer to use double quotes string literals

This commit is contained in:
SHIBATA Hiroshi 2016-09-05 17:25:29 +09:00
parent f8f686ec84
commit 7863b97587
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2
82 changed files with 870 additions and 869 deletions

View File

@ -4,8 +4,9 @@ AllCops:
Exclude:
- rake.gemspec
StringLiterals:
Enabled: false
Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
SpaceAroundEqualsInParameterDefault:
Enabled: false

View File

@ -1,3 +1,3 @@
source 'https://rubygems.org'
source "https://rubygems.org"
gemspec

View File

@ -6,33 +6,33 @@
# This file may be distributed under an MIT style license. See
# MIT-LICENSE for details.
lib = File.expand_path('../lib', __FILE__)
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rdoc/task'
require "bundler/gem_tasks"
require "rake/testtask"
require "rdoc/task"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.verbose = true
t.test_files = FileList['test/**/test_*.rb']
t.test_files = FileList["test/**/test_*.rb"]
end
RDoc::Task.new do |doc|
doc.main = 'README.rdoc'
doc.title = 'Rake -- Ruby Make'
doc.main = "README.rdoc"
doc.title = "Rake -- Ruby Make"
doc.rdoc_files = FileList.new %w[lib MIT-LICENSE doc/**/*.rdoc *.rdoc]
doc.rdoc_dir = 'html'
doc.rdoc_dir = "html"
end
task ghpages: :rdoc do
`git checkout gh-pages`
require 'fileutils'
FileUtils.rm_rf '/tmp/html'
FileUtils.mv 'html', '/tmp'
FileUtils.rm_rf '*'
FileUtils.cp_r Dir.glob('/tmp/html/*'), '.'
require "fileutils"
FileUtils.rm_rf "/tmp/html"
FileUtils.mv "html", "/tmp"
FileUtils.rm_rf "*"
FileUtils.cp_r Dir.glob("/tmp/html/*"), "."
end
task default: :test

View File

@ -22,6 +22,6 @@
# IN THE SOFTWARE.
#++
require 'rake'
require "rake"
Rake.application.run

View File

@ -22,44 +22,44 @@
module Rake; end
require 'rake/version'
require "rake/version"
require 'rbconfig'
require 'fileutils'
require 'singleton'
require 'monitor'
require 'optparse'
require 'ostruct'
require "rbconfig"
require "fileutils"
require "singleton"
require "monitor"
require "optparse"
require "ostruct"
require 'rake/ext/string'
require 'rake/ext/fixnum'
require "rake/ext/string"
require "rake/ext/fixnum"
require 'rake/win32'
require "rake/win32"
require 'rake/linked_list'
require 'rake/cpu_counter'
require 'rake/scope'
require 'rake/task_argument_error'
require 'rake/rule_recursion_overflow_error'
require 'rake/rake_module'
require 'rake/trace_output'
require 'rake/pseudo_status'
require 'rake/task_arguments'
require 'rake/invocation_chain'
require 'rake/task'
require 'rake/file_task'
require 'rake/file_creation_task'
require 'rake/multi_task'
require 'rake/dsl_definition'
require 'rake/file_utils_ext'
require 'rake/file_list'
require 'rake/default_loader'
require 'rake/early_time'
require 'rake/late_time'
require 'rake/name_space'
require 'rake/task_manager'
require 'rake/application'
require 'rake/backtrace'
require "rake/linked_list"
require "rake/cpu_counter"
require "rake/scope"
require "rake/task_argument_error"
require "rake/rule_recursion_overflow_error"
require "rake/rake_module"
require "rake/trace_output"
require "rake/pseudo_status"
require "rake/task_arguments"
require "rake/invocation_chain"
require "rake/task"
require "rake/file_task"
require "rake/file_creation_task"
require "rake/multi_task"
require "rake/dsl_definition"
require "rake/file_utils_ext"
require "rake/file_list"
require "rake/default_loader"
require "rake/early_time"
require "rake/late_time"
require "rake/name_space"
require "rake/task_manager"
require "rake/application"
require "rake/backtrace"
$trace = false

View File

@ -1,11 +1,11 @@
require 'optparse'
require "optparse"
require 'rake/task_manager'
require 'rake/file_list'
require 'rake/thread_pool'
require 'rake/thread_history_display'
require 'rake/trace_output'
require 'rake/win32'
require "rake/task_manager"
require "rake/file_list"
require "rake/thread_pool"
require "rake/thread_history_display"
require "rake/trace_output"
require "rake/win32"
module Rake
@ -38,16 +38,16 @@ module Rake
attr_writer :tty_output
DEFAULT_RAKEFILES = [
'rakefile',
'Rakefile',
'rakefile.rb',
'Rakefile.rb'
"rakefile",
"Rakefile",
"rakefile.rb",
"Rakefile.rb"
].freeze
# Initialize a Rake::Application object.
def initialize
super
@name = 'rake'
@name = "rake"
@rakefiles = DEFAULT_RAKEFILES.dup
@rakefile = nil
@pending_imports = []
@ -56,11 +56,11 @@ module Rake
@default_loader = Rake::DefaultLoader.new
@original_dir = Dir.pwd
@top_level_tasks = []
add_loader('rb', DefaultLoader.new)
add_loader('rf', DefaultLoader.new)
add_loader('rake', DefaultLoader.new)
add_loader("rb", DefaultLoader.new)
add_loader("rf", DefaultLoader.new)
add_loader("rake", DefaultLoader.new)
@tty_output = STDOUT.tty?
@terminal_columns = ENV['RAKE_COLUMNS'].to_i
@terminal_columns = ENV["RAKE_COLUMNS"].to_i
end
# Run the Rake application. The run method performs the following
@ -82,7 +82,7 @@ module Rake
end
# Initialize the command line parameters and app name.
def init(app_name='rake')
def init(app_name="rake")
standard_exception_handling do
@name = app_name
args = handle_options
@ -259,7 +259,7 @@ module Rake
if File.exist?(fn)
others = FileList.glob(fn, File::FNM_CASEFOLD)
return others.size == 1 ? others.first : fn
elsif fn == ''
elsif fn == ""
return fn
end
end
@ -342,7 +342,7 @@ module Rake
end
def unix? # :nodoc:
RbConfig::CONFIG['host_os'] =~
RbConfig::CONFIG["host_os"] =~
/(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
end
@ -385,38 +385,38 @@ module Rake
def standard_rake_options # :nodoc:
sort_options(
[
['--all', '-A',
["--all", "-A",
"Show all tasks, even uncommented ones (in combination with -T or -D)",
lambda { |value|
options.show_all_tasks = value
}
],
['--backtrace=[OUT]',
["--backtrace=[OUT]",
"Enable full backtrace. OUT can be stderr (default) or stdout.",
lambda { |value|
options.backtrace = true
select_trace_output(options, 'backtrace', value)
select_trace_output(options, "backtrace", value)
}
],
['--build-all', '-B',
["--build-all", "-B",
"Build all prerequisites, including those which are up-to-date.",
lambda { |value|
options.build_all = true
}
],
['--comments',
["--comments",
"Show commented tasks only",
lambda { |value|
options.show_all_tasks = !value
}
],
['--describe', '-D [PATTERN]',
["--describe", "-D [PATTERN]",
"Describe the tasks (matching optional PATTERN), then exit.",
lambda { |value|
select_tasks_to_show(options, :describe, value)
}
],
['--dry-run', '-n',
["--dry-run", "-n",
"Do a dry run without executing actions.",
lambda { |value|
Rake.verbose(true)
@ -425,30 +425,30 @@ module Rake
options.trace = true
}
],
['--execute', '-e CODE',
["--execute", "-e CODE",
"Execute some Ruby code and exit.",
lambda { |value|
eval(value)
exit
}
],
['--execute-print', '-p CODE',
["--execute-print", "-p CODE",
"Execute some Ruby code, print the result, then exit.",
lambda { |value|
puts eval(value)
exit
}
],
['--execute-continue', '-E CODE',
["--execute-continue", "-E CODE",
"Execute some Ruby code, " +
"then continue with normal task processing.",
lambda { |value| eval(value) }
],
['--jobs', '-j [NUMBER]',
["--jobs", "-j [NUMBER]",
"Specifies the maximum number of tasks to execute in parallel. " +
"(default is number of CPU cores + 4)",
lambda { |value|
if value.nil? || value == ''
if value.nil? || value == ""
value = Fixnum::MAX
elsif value =~ /^\d+$/
value = value.to_i
@ -459,7 +459,7 @@ module Rake
options.thread_pool_size = value - 1
}
],
['--job-stats [LEVEL]',
["--job-stats [LEVEL]",
"Display job statistics. " +
"LEVEL=history displays a complete job list",
lambda { |value|
@ -470,42 +470,42 @@ module Rake
end
}
],
['--libdir', '-I LIBDIR',
["--libdir", "-I LIBDIR",
"Include LIBDIR in the search path for required modules.",
lambda { |value| $:.push(value) }
],
['--multitask', '-m',
["--multitask", "-m",
"Treat all tasks as multitasks.",
lambda { |value| options.always_multitask = true }
],
['--no-search', '--nosearch',
'-N', "Do not search parent directories for the Rakefile.",
["--no-search", "--nosearch",
"-N", "Do not search parent directories for the Rakefile.",
lambda { |value| options.nosearch = true }
],
['--prereqs', '-P',
["--prereqs", "-P",
"Display the tasks and dependencies, then exit.",
lambda { |value| options.show_prereqs = true }
],
['--quiet', '-q',
["--quiet", "-q",
"Do not log messages to standard output.",
lambda { |value| Rake.verbose(false) }
],
['--rakefile', '-f [FILENAME]',
["--rakefile", "-f [FILENAME]",
"Use FILENAME as the rakefile to search for.",
lambda { |value|
value ||= ''
value ||= ""
@rakefiles.clear
@rakefiles << value
}
],
['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
["--rakelibdir", "--rakelib", "-R RAKELIBDIR",
"Auto-import any .rake files in RAKELIBDIR. " +
"(default is 'rakelib')",
lambda { |value|
options.rakelib = value.split(File::PATH_SEPARATOR)
}
],
['--require', '-r MODULE',
["--require", "-r MODULE",
"Require MODULE before executing rakefile.",
lambda { |value|
begin
@ -519,11 +519,11 @@ module Rake
end
}
],
['--rules',
["--rules",
"Trace the rules resolution.",
lambda { |value| options.trace_rules = true }
],
['--silent', '-s',
["--silent", "-s",
"Like --quiet, but also suppresses the " +
"'in directory' announcement.",
lambda { |value|
@ -531,24 +531,24 @@ module Rake
options.silent = true
}
],
['--suppress-backtrace PATTERN',
["--suppress-backtrace PATTERN",
"Suppress backtrace lines matching regexp PATTERN. " +
"Ignored if --trace is on.",
lambda { |value|
options.suppress_backtrace_pattern = Regexp.new(value)
}
],
['--system', '-g',
["--system", "-g",
"Using system wide (global) rakefiles " +
"(usually '~/.rake/*.rake').",
lambda { |value| options.load_system = true }
],
['--no-system', '--nosystem', '-G',
["--no-system", "--nosystem", "-G",
"Use standard project Rakefile search paths, " +
"ignore system wide rakefiles.",
lambda { |value| options.ignore_system = true }
],
['--tasks', '-T [PATTERN]',
["--tasks", "-T [PATTERN]",
"Display the tasks (matching optional PATTERN) " +
"with descriptions, then exit. " +
"-AT combination displays all of tasks contained no description.",
@ -556,35 +556,35 @@ module Rake
select_tasks_to_show(options, :tasks, value)
}
],
['--trace=[OUT]', '-t',
["--trace=[OUT]", "-t",
"Turn on invoke/execute tracing, enable full backtrace. " +
"OUT can be stderr (default) or stdout.",
lambda { |value|
options.trace = true
options.backtrace = true
select_trace_output(options, 'trace', value)
select_trace_output(options, "trace", value)
Rake.verbose(true)
}
],
['--verbose', '-v',
["--verbose", "-v",
"Log message to standard output.",
lambda { |value| Rake.verbose(true) }
],
['--version', '-V',
["--version", "-V",
"Display the program version.",
lambda { |value|
puts "rake, version #{Rake::VERSION}"
exit
}
],
['--where', '-W [PATTERN]',
["--where", "-W [PATTERN]",
"Describe the tasks (matching optional PATTERN), then exit.",
lambda { |value|
select_tasks_to_show(options, :lines, value)
options.show_all_tasks = true
}
],
['--no-deprecation-warnings', '-X',
["--no-deprecation-warnings", "-X",
"Disable the deprecation warnings.",
lambda { |value|
options.ignore_deprecate = true
@ -595,7 +595,7 @@ module Rake
def select_tasks_to_show(options, show_tasks, value) # :nodoc:
options.show_tasks = show_tasks
options.show_task_pattern = Regexp.new(value || '')
options.show_task_pattern = Regexp.new(value || "")
Rake::TaskManager.record_task_metadata = true
end
private :select_tasks_to_show
@ -603,9 +603,9 @@ module Rake
def select_trace_output(options, trace_option, value) # :nodoc:
value = value.strip unless value.nil?
case value
when 'stdout'
when "stdout"
options.trace_output = $stdout
when 'stderr', nil
when "stderr", nil
options.trace_output = $stderr
else
fail CommandLineOptionError,
@ -618,7 +618,7 @@ module Rake
# arguments that we didn't understand, which should (in theory) be just
# task names and env vars.
def handle_options # :nodoc:
options.rakelib = ['rakelib']
options.rakelib = ["rakelib"]
options.trace_output = $stderr
OptionParser.new do |opts|
@ -632,7 +632,7 @@ module Rake
end
standard_rake_options.each { |args| opts.on(*args) }
opts.environment('RAKEOPT')
opts.environment("RAKEOPT")
end.parse(ARGV)
end
@ -685,7 +685,7 @@ module Rake
Dir.chdir(location)
print_rakefile_directory(location)
Rake.load_rakefile(File.expand_path(@rakefile)) if
@rakefile && @rakefile != ''
@rakefile && @rakefile != ""
options.rakelib.each do |rlib|
glob("#{rlib}/*.rake") do |name|
add_import name
@ -696,7 +696,7 @@ module Rake
end
def glob(path, &block) # :nodoc:
FileList.glob(path.tr("\\", '/')).each(&block)
FileList.glob(path.tr("\\", "/")).each(&block)
end
private :glob
@ -704,8 +704,8 @@ module Rake
def system_dir # :nodoc:
@system_dir ||=
begin
if ENV['RAKE_SYSTEM']
ENV['RAKE_SYSTEM']
if ENV["RAKE_SYSTEM"]
ENV["RAKE_SYSTEM"]
else
standard_system_dir
end
@ -719,7 +719,7 @@ module Rake
end
else
def standard_system_dir #:nodoc:
File.join(File.expand_path('~'), '.rake')
File.join(File.expand_path("~"), ".rake")
end
end
private :standard_system_dir
@ -778,7 +778,7 @@ module Rake
re = /^#{@rakefile}$/
re = /#{re.source}/i if windows?
backtrace.find { |str| str =~ re } || ''
backtrace.find { |str| str =~ re } || ""
end
end

View File

@ -10,7 +10,7 @@ module Rake
reject { |s| s.nil? || s =~ /^ *$/ }
SUPPRESSED_PATHS_RE = SUPPRESSED_PATHS.map { |f| Regexp.quote(f) }.join("|")
SUPPRESSED_PATHS_RE << "|^org\\/jruby\\/\\w+\\.java" if
Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == "jruby"
SUPPRESS_PATTERN = %r!(\A(#{SUPPRESSED_PATHS_RE})|bin/rake:\d+)!i

View File

@ -11,7 +11,7 @@
# The intent of this task is to return a project to its
# pristine, just unpacked state.
require 'rake'
require "rake"
# :stopdoc:
@ -60,7 +60,7 @@ end
CLEAN = ::Rake::FileList["**/*~", "**/*.bak", "**/core"]
CLEAN.clear_exclude.exclude { |fn|
fn.pathmap("%f").downcase == 'core' && File.directory?(fn)
fn.pathmap("%f").downcase == "core" && File.directory?(fn)
}
desc "Remove any temporary products."

View File

@ -14,7 +14,7 @@ module Rake
end
begin
require 'etc'
require "etc"
rescue LoadError
else
if Etc.respond_to?(:nprocessors)

View File

@ -1,5 +1,5 @@
# Rake DSL functions.
require 'rake/file_utils_ext'
require "rake/file_utils_ext"
module Rake

View File

@ -1,5 +1,5 @@
require 'rake/ext/core'
require 'pathname'
require "rake/ext/core"
require "pathname"
class Pathname
@ -7,7 +7,7 @@ class Pathname
# Return a new Pathname with <tt>String#ext</tt> applied to it.
#
# This Pathname extension comes from Rake
def ext(newext='')
def ext(newext="")
Pathname.new(Rake.from_pathname(self).ext(newext))
end
end

View File

@ -1,4 +1,4 @@
require 'rake/ext/core'
require "rake/ext/core"
class String
@ -10,9 +10,9 @@ class String
# +ext+ is a user added method for the String class.
#
# This String extension comes from Rake
def ext(newext='')
return self.dup if ['.', '..'].include? self
if newext != ''
def ext(newext="")
return self.dup if [".", ".."].include? self
if newext != ""
newext = "." + newext unless newext =~ /^\./
end
self.chomp(File.extname(self)) << newext
@ -26,8 +26,8 @@ class String
def pathmap_explode
head, tail = File.split(self)
return [self] if head == self
return [tail] if head == '.' || tail == '/'
return [head, tail] if head == '/'
return [tail] if head == "." || tail == "/"
return [head, tail] if head == "/"
return head.pathmap_explode + [tail]
end
protected :pathmap_explode
@ -57,15 +57,15 @@ class String
# This String extension comes from Rake
def pathmap_replace(patterns, &block)
result = self
patterns.split(';').each do |pair|
pattern, replacement = pair.split(',')
patterns.split(";").each do |pair|
pattern, replacement = pair.split(",")
pattern = Regexp.new(pattern)
if replacement == '*' && block_given?
if replacement == "*" && block_given?
result = result.sub(pattern, &block)
elsif replacement
result = result.sub(pattern, replacement)
else
result = result.sub(pattern, '')
result = result.sub(pattern, "")
end
end
result
@ -136,32 +136,32 @@ class String
# This String extension comes from Rake
def pathmap(spec=nil, &block)
return self if spec.nil?
result = ''
result = ""
spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
case frag
when '%f'
when "%f"
result << File.basename(self)
when '%n'
when "%n"
result << File.basename(self).ext
when '%d'
when "%d"
result << File.dirname(self)
when '%x'
when "%x"
result << File.extname(self)
when '%X'
when "%X"
result << self.ext
when '%p'
when "%p"
result << self
when '%s'
when "%s"
result << (File::ALT_SEPARATOR || File::SEPARATOR)
when '%-'
when "%-"
# do nothing
when '%%'
when "%%"
result << "%"
when /%(-?\d+)d/
result << pathmap_partial($1.to_i)
when /^%\{([^}]*)\}(\d*[dpfnxX])/
patterns, operator = $1, $2
result << pathmap('%' + operator).pathmap_replace(patterns, &block)
result << pathmap("%" + operator).pathmap_replace(patterns, &block)
when /^%/
fail ArgumentError, "Unknown pathmap specifier #{frag} in '#{spec}'"
else

View File

@ -1,5 +1,5 @@
require 'rake/file_task'
require 'rake/early_time'
require "rake/file_task"
require "rake/early_time"
module Rake

View File

@ -1,6 +1,6 @@
require 'rake/cloneable'
require 'rake/file_utils_ext'
require 'rake/ext/string'
require "rake/cloneable"
require "rake/file_utils_ext"
require "rake/ext/string"
module Rake
@ -280,7 +280,7 @@ module Rake
# array.collect { |item| item.ext(newext) }
#
# +ext+ is a user added method for the Array class.
def ext(newext='')
def ext(newext="")
collect { |fn| fn.ext(newext) }
end
@ -342,7 +342,7 @@ module Rake
# Convert a FileList to a string by joining all elements with a space.
def to_s
resolve
self.join(' ')
self.join(" ")
end
# Add matching glob patterns.
@ -416,7 +416,7 @@ module Rake
# Yield each file or directory component.
def each_dir_parent(dir) # :nodoc:
old_length = nil
while dir != '.' && dir.length != old_length
while dir != "." && dir.length != old_length
yield(dir)
old_length = dir.length
dir = File.dirname(dir)

View File

@ -1,5 +1,5 @@
require 'rake/task.rb'
require 'rake/early_time'
require "rake/task.rb"
require "rake/early_time"
module Rake

View File

@ -1,18 +1,18 @@
require 'rbconfig'
require 'fileutils'
require "rbconfig"
require "fileutils"
#--
# This a FileUtils extension that defines several additional commands to be
# added to the FileUtils utility functions.
module FileUtils
# Path to the currently running Ruby program
RUBY = ENV['RUBY'] || File.join(
RbConfig::CONFIG['bindir'],
RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']).
RUBY = ENV["RUBY"] || File.join(
RbConfig::CONFIG["bindir"],
RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]).
sub(/.*\s.*/m, '"\&"')
OPT_TABLE['sh'] = %w(noop verbose)
OPT_TABLE['ruby'] = %w(noop verbose)
OPT_TABLE["sh"] = %w(noop verbose)
OPT_TABLE["ruby"] = %w(noop verbose)
# Run the system command +cmd+. If multiple arguments are given the command
# is run directly (without the shell, same semantics as Kernel::exec and
@ -132,8 +132,8 @@ module FileUtils
#
def split_all(path)
head, tail = File.split(path)
return [tail] if head == '.' || tail == '/'
return [head, tail] if head == '/'
return [tail] if head == "." || tail == "/"
return [head, tail] if head == "/"
return split_all(head) + [tail]
end
end

View File

@ -1,4 +1,4 @@
require 'rake/file_utils'
require "rake/file_utils"
module Rake
#
@ -22,10 +22,10 @@ module Rake
opts = FileUtils.options_of name
default_options = []
if opts.include?("verbose")
default_options << ':verbose => FileUtilsExt.verbose_flag'
default_options << ":verbose => FileUtilsExt.verbose_flag"
end
if opts.include?("noop")
default_options << ':noop => FileUtilsExt.nowrite_flag'
default_options << ":noop => FileUtilsExt.nowrite_flag"
end
next if default_options.empty?

View File

@ -9,7 +9,7 @@ module Rake
end
def to_s
'<LATE TIME>'
"<LATE TIME>"
end
end

View File

@ -24,7 +24,7 @@ module Rake
lines = File.read fn
lines.gsub!(/\\ /, SPACE_MARK)
lines.gsub!(/#[^\n]*\n/m, "")
lines.gsub!(/\\\n/, ' ')
lines.gsub!(/\\\n/, " ")
lines.each_line do |line|
process_line(line)
end
@ -34,7 +34,7 @@ module Rake
# Process one logical line of makefile data.
def process_line(line) # :nodoc:
file_tasks, args = line.split(':', 2)
file_tasks, args = line.split(":", 2)
return if args.nil?
dependents = args.split.map { |d| respace(d) }
file_tasks.scan(/\S+/) do |file_task|
@ -44,10 +44,10 @@ module Rake
end
def respace(str) # :nodoc:
str.tr SPACE_MARK, ' '
str.tr SPACE_MARK, " "
end
end
# Install the handler
Rake.application.add_loader('mf', MakefileLoader.new)
Rake.application.add_loader("mf", MakefileLoader.new)
end

View File

@ -1,8 +1,8 @@
# Define a package task library to aid in the definition of
# redistributable package files.
require 'rake'
require 'rake/tasklib'
require "rake"
require "rake/tasklib"
module Rake
@ -93,14 +93,14 @@ module Rake
@name = name
@version = version
@package_files = Rake::FileList.new
@package_dir = 'pkg'
@package_dir = "pkg"
@need_tar = false
@need_tar_gz = false
@need_tar_bz2 = false
@need_tar_xz = false
@need_zip = false
@tar_command = 'tar'
@zip_command = 'zip'
@tar_command = "tar"
@zip_command = "zip"
end
# Create the tasks defined by this task library.

View File

@ -4,7 +4,7 @@
#
# See FileTask#out_of_date? and Task#timestamp for more info.
require 'rake'
require "rake"
task :phony

View File

@ -1,4 +1,4 @@
require 'rake/application'
require "rake/application"
module Rake

View File

@ -1,4 +1,4 @@
require 'rake'
require "rake"
# Load the test files from the command line.
argv = ARGV.select do |argument|

View File

@ -12,7 +12,7 @@ module Rake
end
def message
super + ": [" + @targets.reverse.join(' => ') + "]"
super + ": [" + @targets.reverse.join(" => ") + "]"
end
end

View File

@ -1,4 +1,4 @@
require 'rake/invocation_exception_mixin'
require "rake/invocation_exception_mixin"
module Rake

View File

@ -17,7 +17,7 @@ module Rake
@hash = {}
@values = values
names.each_with_index { |name, i|
next if values[i].nil? || values[i] == ''
next if values[i].nil? || values[i] == ""
@hash[name.to_sym] = values[i]
}
end

View File

@ -15,7 +15,7 @@ module Rake
def create_rule(*args, &block) # :nodoc:
pattern, args, deps = resolve_args(args)
pattern = Regexp.new(Regexp.quote(pattern) + '$') if String === pattern
pattern = Regexp.new(Regexp.quote(pattern) + "$") if String === pattern
@rules << [pattern, args, deps, block]
end
@ -167,10 +167,10 @@ module Rake
task_name = task_name.to_s
if task_name =~ /^rake:/
scopes = Scope.make
task_name = task_name.sub(/^rake:/, '')
task_name = task_name.sub(/^rake:/, "")
elsif task_name =~ /^(\^+)/
scopes = initial_scope.trim($1.size)
task_name = task_name.sub(/^(\^+)/, '')
task_name = task_name.sub(/^(\^+)/, "")
else
scopes = initial_scope
end

View File

@ -1,4 +1,4 @@
require 'rake'
require "rake"
module Rake

View File

@ -1,5 +1,5 @@
require 'rake'
require 'rake/tasklib'
require "rake"
require "rake/tasklib"
module Rake
@ -98,7 +98,7 @@ module Rake
@name = @name.keys.first
end
yield self if block_given?
@pattern = 'test/test*.rb' if @pattern.nil? && @test_files.nil?
@pattern = "test/test*.rb" if @pattern.nil? && @test_files.nil?
define
end
@ -108,7 +108,7 @@ module Rake
task @name => Array(deps) do
FileUtilsExt.verbose(@verbose) do
puts "Use TESTOPTS=\"--verbose\" to pass --verbose" \
", etc. to runners." if ARGV.include? '--verbose'
", etc. to runners." if ARGV.include? "--verbose"
args =
"#{ruby_opts_string} #{run_code} " +
"#{file_list_string} #{option_list}"
@ -126,10 +126,10 @@ module Rake
end
def option_list # :nodoc:
(ENV['TESTOPTS'] ||
ENV['TESTOPT'] ||
ENV['TEST_OPTS'] ||
ENV['TEST_OPT'] ||
(ENV["TESTOPTS"] ||
ENV["TESTOPT"] ||
ENV["TEST_OPTS"] ||
ENV["TEST_OPT"] ||
@options ||
"")
end
@ -146,12 +146,12 @@ module Rake
end
def file_list_string # :nodoc:
file_list.map { |fn| "\"#{fn}\"" }.join(' ')
file_list.map { |fn| "\"#{fn}\"" }.join(" ")
end
def file_list # :nodoc:
if ENV['TEST']
FileList[ENV['TEST']]
if ENV["TEST"]
FileList[ENV["TEST"]]
else
result = []
result += @test_files.to_a if @test_files
@ -176,7 +176,7 @@ module Rake
end
def rake_loader # :nodoc:
find_file('rake/rake_test_loader') or
find_file("rake/rake_test_loader") or
fail "unable to find rake test loader"
end
@ -189,7 +189,7 @@ module Rake
end
def rake_include_arg # :nodoc:
spec = Gem.loaded_specs['rake']
spec = Gem.loaded_specs["rake"]
if spec.respond_to?(:default_gem?) && spec.default_gem?
""
else
@ -198,7 +198,7 @@ module Rake
end
def rake_lib_dir # :nodoc:
find_dir('rake') or
find_dir("rake") or
fail "unable to find rake lib"
end

View File

@ -1,4 +1,4 @@
require 'rake/private_reader'
require "rake/private_reader"
module Rake

View File

@ -1,6 +1,6 @@
require 'set'
require "set"
require 'rake/promise'
require "rake/promise"
module Rake

View File

@ -1,8 +1,8 @@
module Rake
VERSION = '11.2.2'
VERSION = "11.2.2"
module Version # :nodoc: all
MAJOR, MINOR, BUILD, *OTHER = Rake::VERSION.split '.'
MAJOR, MINOR, BUILD, *OTHER = Rake::VERSION.split "."
NUMBERS = [MAJOR, MINOR, BUILD, *OTHER]
end

View File

@ -1,4 +1,4 @@
require 'rbconfig'
require "rbconfig"
module Rake
# Win 32 interface methods for Rake. Windows specific functionality
@ -27,22 +27,22 @@ module Rake
#
# If the above are not defined, the return nil.
def win32_system_dir #:nodoc:
win32_shared_path = ENV['HOME']
if win32_shared_path.nil? && ENV['HOMEDRIVE'] && ENV['HOMEPATH']
win32_shared_path = ENV['HOMEDRIVE'] + ENV['HOMEPATH']
win32_shared_path = ENV["HOME"]
if win32_shared_path.nil? && ENV["HOMEDRIVE"] && ENV["HOMEPATH"]
win32_shared_path = ENV["HOMEDRIVE"] + ENV["HOMEPATH"]
end
win32_shared_path ||= ENV['APPDATA']
win32_shared_path ||= ENV['USERPROFILE']
win32_shared_path ||= ENV["APPDATA"]
win32_shared_path ||= ENV["USERPROFILE"]
raise Win32HomeError,
"Unable to determine home path environment variable." if
win32_shared_path.nil? or win32_shared_path.empty?
normalize(File.join(win32_shared_path, 'Rake'))
normalize(File.join(win32_shared_path, "Rake"))
end
# Normalize a win32 path so that the slashes are all forward slashes.
def normalize(path)
path.gsub(/\\/, '/')
path.gsub(/\\/, "/")
end
end

View File

@ -1,13 +1,13 @@
$:.unshift File.expand_path('../../lib', __FILE__)
$:.unshift File.expand_path("../../lib", __FILE__)
gem 'minitest', '~> 5'
require 'minitest/autorun'
require 'rake'
require 'tmpdir'
gem "minitest", "~> 5"
require "minitest/autorun"
require "rake"
require "tmpdir"
require_relative 'support/file_creation'
require_relative 'support/ruby_runner'
require_relative 'support/rakefile_definitions'
require_relative "support/file_creation"
require_relative "support/ruby_runner"
require_relative "support/rakefile_definitions"
class Rake::TestCase < Minitest::Test
include FileCreation
@ -23,25 +23,25 @@ class Rake::TestCase < Minitest::Test
def setup
ARGV.clear
@verbose = ENV['VERBOSE']
@verbose = ENV["VERBOSE"]
@rake_root = File.expand_path '../../', __FILE__
@rake_exec = File.join @rake_root, 'exe', 'rake'
@rake_lib = File.join @rake_root, 'lib'
@rake_root = File.expand_path "../../", __FILE__
@rake_exec = File.join @rake_root, "exe", "rake"
@rake_lib = File.join @rake_root, "lib"
@ruby_options = ["-I#{@rake_lib}", "-I."]
@orig_pwd = Dir.pwd
@orig_appdata = ENV['APPDATA']
@orig_home = ENV['HOME']
@orig_homedrive = ENV['HOMEDRIVE']
@orig_homepath = ENV['HOMEPATH']
@orig_rake_columns = ENV['RAKE_COLUMNS']
@orig_rake_system = ENV['RAKE_SYSTEM']
@orig_rakeopt = ENV['RAKEOPT']
@orig_userprofile = ENV['USERPROFILE']
ENV.delete 'RAKE_COLUMNS'
ENV.delete 'RAKE_SYSTEM'
ENV.delete 'RAKEOPT'
@orig_appdata = ENV["APPDATA"]
@orig_home = ENV["HOME"]
@orig_homedrive = ENV["HOMEDRIVE"]
@orig_homepath = ENV["HOMEPATH"]
@orig_rake_columns = ENV["RAKE_COLUMNS"]
@orig_rake_system = ENV["RAKE_SYSTEM"]
@orig_rakeopt = ENV["RAKEOPT"]
@orig_userprofile = ENV["USERPROFILE"]
ENV.delete "RAKE_COLUMNS"
ENV.delete "RAKE_SYSTEM"
ENV.delete "RAKEOPT"
tmpdir = Dir.chdir Dir.tmpdir do Dir.pwd end
@tempdir = File.join tmpdir, "test_rake_#{$$}"
@ -60,18 +60,18 @@ class Rake::TestCase < Minitest::Test
FileUtils.rm_rf @tempdir
if @orig_appdata
ENV['APPDATA'] = @orig_appdata
ENV["APPDATA"] = @orig_appdata
else
ENV.delete 'APPDATA'
ENV.delete "APPDATA"
end
ENV['HOME'] = @orig_home
ENV['HOMEDRIVE'] = @orig_homedrive
ENV['HOMEPATH'] = @orig_homepath
ENV['RAKE_COLUMNS'] = @orig_rake_columns
ENV['RAKE_SYSTEM'] = @orig_rake_system
ENV['RAKEOPT'] = @orig_rakeopt
ENV['USERPROFILE'] = @orig_userprofile
ENV["HOME"] = @orig_home
ENV["HOMEDRIVE"] = @orig_homedrive
ENV["HOMEPATH"] = @orig_homepath
ENV["RAKE_COLUMNS"] = @orig_rake_columns
ENV["RAKE_SYSTEM"] = @orig_rake_system
ENV["RAKEOPT"] = @orig_rakeopt
ENV["USERPROFILE"] = @orig_userprofile
end
def ignore_deprecations
@ -82,11 +82,11 @@ class Rake::TestCase < Minitest::Test
end
def rake_system_dir
@system_dir = 'system'
@system_dir = "system"
FileUtils.mkdir_p @system_dir
open File.join(@system_dir, 'sys1.rake'), 'w' do |io|
open File.join(@system_dir, "sys1.rake"), "w" do |io|
io << <<-SYS
task "sys1" do
puts "SYS1"
@ -94,11 +94,11 @@ end
SYS
end
ENV['RAKE_SYSTEM'] = @system_dir
ENV["RAKE_SYSTEM"] = @system_dir
end
def rakefile(contents)
open 'Rakefile', 'w' do |io|
open "Rakefile", "w" do |io|
io << contents
end
end
@ -108,11 +108,11 @@ end
end
def jruby17?
jruby? && (JRUBY_VERSION < '9.0.0.0')
jruby? && (JRUBY_VERSION < "9.0.0.0")
end
def jruby9?
jruby? && (JRUBY_VERSION >= '9.0.0.0')
jruby? && (JRUBY_VERSION >= "9.0.0.0")
end
include RakefileDefinitions

View File

@ -158,16 +158,16 @@ task :clean do
end
DRYRUN
FileUtils.touch 'temp_main'
FileUtils.touch 'temp_two'
FileUtils.touch "temp_main"
FileUtils.touch "temp_two"
end
def rakefile_extra
rakefile 'task :default'
rakefile "task :default"
FileUtils.mkdir_p 'rakelib'
FileUtils.mkdir_p "rakelib"
open File.join('rakelib', 'extra.rake'), 'w' do |io|
open File.join("rakelib", "extra.rake"), "w" do |io|
io << <<-EXTRA_RAKE
# Added for testing
@ -236,7 +236,7 @@ import "deps.mf"
puts "FIRST"
IMPORTS
open 'deps.mf', 'w' do |io|
open "deps.mf", "w" do |io|
io << <<-DEPS
default: other
DEPS
@ -361,14 +361,14 @@ end
end
def rakefile_nosearch
FileUtils.touch 'dummy'
FileUtils.touch "dummy"
end
def rakefile_rakelib
FileUtils.mkdir_p 'rakelib'
FileUtils.mkdir_p "rakelib"
Dir.chdir 'rakelib' do
open 'test1.rb', 'w' do |io|
Dir.chdir "rakelib" do
open "test1.rb", "w" do |io|
io << <<-TEST1
task :default do
puts "TEST1"
@ -376,7 +376,7 @@ end
TEST1
end
open 'test2.rake', 'w' do |io|
open "test2.rake", "w" do |io|
io << <<-TEST1
task :default do
puts "TEST2"
@ -387,15 +387,15 @@ end
end
def rakefile_rbext
open 'rakefile.rb', 'w' do |io|
open "rakefile.rb", "w" do |io|
io << 'task :default do puts "OK" end'
end
end
def rakefile_unittest
rakefile '# Empty Rakefile for Unit Test'
rakefile "# Empty Rakefile for Unit Test"
readme = File.join 'subdir', 'README'
readme = File.join "subdir", "README"
FileUtils.mkdir_p File.dirname readme
FileUtils.touch readme
@ -458,14 +458,14 @@ end
task :default => :test
TEST_SIGNAL
open 'a_test.rb', 'w' do |io|
open "a_test.rb", "w" do |io|
io << 'puts "ATEST"' << "\n"
io << '$stdout.flush' << "\n"
io << "$stdout.flush" << "\n"
io << 'Process.kill("TERM", $$)' << "\n"
end
open 'b_test.rb', 'w' do |io|
open "b_test.rb", "w" do |io|
io << 'puts "BTEST"' << "\n"
io << '$stdout.flush' << "\n"
io << "$stdout.flush" << "\n"
end
end
@ -478,7 +478,7 @@ Rake::TestTask.new(:test) do |t|
t.test_files = ['a_test.rb']
end
TEST_TASK
open 'a_test.rb', 'w' do |io|
open "a_test.rb", "w" do |io|
io << "require 'minitest/autorun'\n"
io << "class ExitTaskTest < Minitest::Test\n"
io << " def test_exit\n"
@ -489,7 +489,7 @@ end
end
def rakefile_stand_alone_filelist
open 'stand_alone_filelist.rb', 'w' do |io|
open "stand_alone_filelist.rb", "w" do |io|
io << "require 'rake/file_list'\n"
io << "FL = Rake::FileList['*.rb']\n"
io << "puts FL\n"

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'rake/private_reader'
require File.expand_path("../helper", __FILE__)
require "rake/private_reader"
class TestPrivateAttrs < Rake::TestCase

View File

@ -1,18 +1,18 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRake < Rake::TestCase
def test_each_dir_parent
assert_equal ['a'], alldirs('a')
assert_equal ['a/b', 'a'], alldirs('a/b')
assert_equal ['/a/b', '/a', '/'], alldirs('/a/b')
assert_equal ["a"], alldirs("a")
assert_equal ["a/b", "a"], alldirs("a/b")
assert_equal ["/a/b", "/a", "/"], alldirs("/a/b")
if File.dirname("c:/foo") == "c:"
# Under Unix
assert_equal ['c:/a/b', 'c:/a', 'c:'], alldirs('c:/a/b')
assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
assert_equal ["c:/a/b", "c:/a", "c:"], alldirs("c:/a/b")
assert_equal ["c:a/b", "c:a"], alldirs("c:a/b")
else
# Under Windows
assert_equal ['c:/a/b', 'c:/a', 'c:/'], alldirs('c:/a/b')
assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
assert_equal ["c:/a/b", "c:/a", "c:/"], alldirs("c:/a/b")
assert_equal ["c:a/b", "c:a"], alldirs("c:a/b")
end
end

View File

@ -1,5 +1,5 @@
#encoding: UTF-8
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeApplication < Rake::TestCase
@ -31,13 +31,13 @@ class TestRakeApplication < Rake::TestCase
assert_empty out
assert_match 'rake aborted!', err
assert_match "rake aborted!", err
assert_match __method__.to_s, err
end
def test_display_exception_details_bad_encoding
begin
raise 'El Niño is coming!'.force_encoding('US-ASCII')
raise "El Niño is coming!".force_encoding("US-ASCII")
rescue => ex
end
@ -46,18 +46,18 @@ class TestRakeApplication < Rake::TestCase
end
assert_empty out
assert_match 'El Niño is coming!', err.force_encoding('UTF-8')
assert_match "El Niño is coming!", err.force_encoding("UTF-8")
end
def test_display_exception_details_cause
skip 'Exception#cause not implemented' unless
skip "Exception#cause not implemented" unless
Exception.method_defined? :cause
begin
raise 'cause a'
raise "cause a"
rescue
begin
raise 'cause b'
raise "cause b"
rescue => ex
end
end
@ -68,21 +68,21 @@ class TestRakeApplication < Rake::TestCase
assert_empty out
assert_match 'cause a', err
assert_match 'cause b', err
assert_match "cause a", err
assert_match "cause b", err
end
def test_display_exception_details_cause_loop
skip 'Exception#cause not implemented' unless
skip "Exception#cause not implemented" unless
Exception.method_defined? :cause
skip if jruby9? # https://github.com/jruby/jruby/issues/3654
begin
begin
raise 'cause a'
raise "cause a"
rescue => a
begin
raise 'cause b'
raise "cause b"
rescue
raise a
end
@ -96,8 +96,8 @@ class TestRakeApplication < Rake::TestCase
assert_empty out
assert_match 'cause a', err
assert_match 'cause b', err
assert_match "cause a", err
assert_match "cause b", err
end
def test_display_tasks
@ -194,7 +194,7 @@ class TestRakeApplication < Rake::TestCase
@app.options.show_task_pattern = //
@app.last_description = "COMMENT"
@app.define_task(Rake::Task, "t")
@app['t'].locations << "HERE:1"
@app["t"].locations << "HERE:1"
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
assert_match(/^rake t +[^:]+:\d+ *$/, out)
end
@ -206,7 +206,7 @@ class TestRakeApplication < Rake::TestCase
end
def test_not_finding_rakefile
@app.instance_eval { @rakefiles = ['NEVER_FOUND'] }
@app.instance_eval { @rakefiles = ["NEVER_FOUND"] }
assert(! @app.instance_eval do have_rakefile end)
assert_nil @app.rakefile
end
@ -240,7 +240,7 @@ class TestRakeApplication < Rake::TestCase
def test_load_rakefile_from_subdir
rakefile_unittest
Dir.chdir 'subdir'
Dir.chdir "subdir"
@app.instance_eval do
handle_options
@ -254,7 +254,7 @@ class TestRakeApplication < Rake::TestCase
def test_load_rakefile_prints_rakefile_directory_from_subdir
rakefile_unittest
Dir.chdir 'subdir'
Dir.chdir "subdir"
app = Rake::Application.new
app.options.rakelib = []
@ -270,7 +270,7 @@ class TestRakeApplication < Rake::TestCase
def test_load_rakefile_doesnt_print_rakefile_directory_from_subdir_if_silent
rakefile_unittest
Dir.chdir 'subdir'
Dir.chdir "subdir"
_, err = capture_io do
@app.instance_eval do
@ -286,7 +286,7 @@ class TestRakeApplication < Rake::TestCase
def test_load_rakefile_not_found
ARGV.clear
Dir.chdir @tempdir
ENV['RAKE_SYSTEM'] = 'not_exist'
ENV["RAKE_SYSTEM"] = "not_exist"
@app.instance_eval do
handle_options
@ -317,7 +317,7 @@ class TestRakeApplication < Rake::TestCase
assert_equal @system_dir, @app.system_dir
assert_nil @app.rakefile
rescue SystemExit
flunk 'failed to load rakefile'
flunk "failed to load rakefile"
end
def test_load_from_calculated_system_rakefile
@ -326,7 +326,7 @@ class TestRakeApplication < Rake::TestCase
"__STD_SYS_DIR__"
end
ENV['RAKE_SYSTEM'] = nil
ENV["RAKE_SYSTEM"] = nil
@app.instance_eval do
handle_options
@ -338,22 +338,22 @@ class TestRakeApplication < Rake::TestCase
assert_equal "__STD_SYS_DIR__", @app.system_dir
rescue SystemExit
flunk 'failed to find system rakefile'
flunk "failed to find system rakefile"
end
def test_terminal_columns
old_rake_columns = ENV['RAKE_COLUMNS']
old_rake_columns = ENV["RAKE_COLUMNS"]
ENV['RAKE_COLUMNS'] = '42'
ENV["RAKE_COLUMNS"] = "42"
app = Rake::Application.new
assert_equal 42, app.terminal_columns
ensure
if old_rake_columns
ENV['RAKE_COLUMNS'] = old_rake_columns
ENV["RAKE_COLUMNS"] = old_rake_columns
else
ENV.delete 'RAKE_COLUMNS'
ENV.delete "RAKE_COLUMNS"
end
end
@ -389,7 +389,7 @@ class TestRakeApplication < Rake::TestCase
def test_handle_options_should_not_strip_options_from_argv
assert !@app.options.trace
valid_option = '--trace'
valid_option = "--trace"
setup_command_line(valid_option)
@app.handle_options
@ -450,7 +450,7 @@ class TestRakeApplication < Rake::TestCase
def test_display_task_run
ran = false
setup_command_line('-f', '-s', '--tasks', '--rakelib=""')
setup_command_line("-f", "-s", "--tasks", '--rakelib=""')
@app.last_description = "COMMENT"
@app.define_task(Rake::Task, "default")
out, = capture_io { @app.run }
@ -462,7 +462,7 @@ class TestRakeApplication < Rake::TestCase
def test_display_prereqs
ran = false
setup_command_line('-f', '-s', '--prereqs', '--rakelib=""')
setup_command_line("-f", "-s", "--prereqs", '--rakelib=""')
@app.last_description = "COMMENT"
t = @app.define_task(Rake::Task, "default")
t.enhance([:a, :b])
@ -478,7 +478,7 @@ class TestRakeApplication < Rake::TestCase
def test_bad_run
@app.intern(Rake::Task, "default").enhance { fail }
setup_command_line('-f', '-s', '--rakelib=""')
setup_command_line("-f", "-s", '--rakelib=""')
_, err = capture_io {
assert_raises(SystemExit){ @app.run }
}
@ -489,7 +489,7 @@ class TestRakeApplication < Rake::TestCase
def test_bad_run_with_trace
@app.intern(Rake::Task, "default").enhance { fail }
setup_command_line('-f', '-s', '-t')
setup_command_line("-f", "-s", "-t")
_, err = capture_io {
assert_raises(SystemExit) { @app.run }
}
@ -500,7 +500,7 @@ class TestRakeApplication < Rake::TestCase
def test_bad_run_with_backtrace
@app.intern(Rake::Task, "default").enhance { fail }
setup_command_line('-f', '-s', '--backtrace')
setup_command_line("-f", "-s", "--backtrace")
_, err = capture_io {
assert_raises(SystemExit) {
@app.run
@ -517,7 +517,7 @@ class TestRakeApplication < Rake::TestCase
@app.intern(Rake::Task, "default").enhance {
raise CustomError, "intentional"
}
setup_command_line('-f', '-s')
setup_command_line("-f", "-s")
_, err = capture_io {
assert_raises(SystemExit) {
@app.run
@ -530,7 +530,7 @@ class TestRakeApplication < Rake::TestCase
@app.intern(Rake::Task, "default").enhance {
fail "intentional"
}
setup_command_line('-f', '-s')
setup_command_line("-f", "-s")
_, err = capture_io {
assert_raises(SystemExit) {
@app.run
@ -554,7 +554,7 @@ class TestRakeApplication < Rake::TestCase
raise custom_error, "Secondary Error"
end
}
setup_command_line('-f', '-s')
setup_command_line("-f", "-s")
_ ,err = capture_io {
assert_raises(SystemExit) {
@app.run
@ -570,7 +570,7 @@ class TestRakeApplication < Rake::TestCase
def test_run_with_bad_options
@app.intern(Rake::Task, "default").enhance { fail }
setup_command_line('-f', '-s', '--xyzzy')
setup_command_line("-f", "-s", "--xyzzy")
assert_raises(SystemExit) {
capture_io { @app.run }
}
@ -582,7 +582,7 @@ class TestRakeApplication < Rake::TestCase
out, err = capture_io do
e = assert_raises SystemExit do
@app.standard_exception_handling do
raise OptionParser::InvalidOption, 'blah'
raise OptionParser::InvalidOption, "blah"
end
end
@ -597,7 +597,7 @@ class TestRakeApplication < Rake::TestCase
out, err = capture_io do
e = assert_raises SystemExit do
@app.standard_exception_handling do
raise 'blah'
raise "blah"
end
end
@ -644,7 +644,7 @@ class TestRakeApplication < Rake::TestCase
loader.instance_variable_set :@load_called, false
def loader.load arg
raise ArgumentError, arg unless arg == 'x.dummy'
raise ArgumentError, arg unless arg == "x.dummy"
@load_called = true
end

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
TESTING_REQUIRE = []
@ -7,7 +7,7 @@ class TestRakeApplicationOptions < Rake::TestCase
def setup
super
@testkey = ENV['TESTKEY']
@testkey = ENV["TESTKEY"]
clear_argv
Rake::FileUtilsExt.verbose_flag = false
Rake::FileUtilsExt.nowrite_flag = false
@ -15,7 +15,7 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def teardown
ENV['TESTKEY'] = @testkey
ENV["TESTKEY"] = @testkey
clear_argv
Rake::FileUtilsExt.verbose_flag = false
Rake::FileUtilsExt.nowrite_flag = false
@ -35,20 +35,20 @@ class TestRakeApplicationOptions < Rake::TestCase
assert_nil opts.load_system
assert_nil opts.always_multitask
assert_nil opts.nosearch
assert_equal ['rakelib'], opts.rakelib
assert_equal ["rakelib"], opts.rakelib
assert_nil opts.show_prereqs
assert_nil opts.show_task_pattern
assert_nil opts.show_tasks
assert_nil opts.silent
assert_nil opts.trace
assert_nil opts.thread_pool_size
assert_equal ['rakelib'], opts.rakelib
assert_equal ["rakelib"], opts.rakelib
assert ! Rake::FileUtilsExt.verbose_flag
assert ! Rake::FileUtilsExt.nowrite_flag
end
def test_dry_run
flags('--dry-run', '-n') do |opts|
flags("--dry-run", "-n") do |opts|
assert opts.dryrun
assert opts.trace
assert Rake::FileUtilsExt.verbose_flag
@ -57,14 +57,14 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_describe
flags('--describe') do |opts|
flags("--describe") do |opts|
assert_equal :describe, opts.show_tasks
assert_equal(//.to_s, opts.show_task_pattern.to_s)
end
end
def test_describe_with_pattern
flags('--describe=X') do |opts|
flags("--describe=X") do |opts|
assert_equal :describe, opts.show_tasks
assert_equal(/X/.to_s, opts.show_task_pattern.to_s)
end
@ -72,7 +72,7 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_execute
$xyzzy = 0
flags('--execute=$xyzzy=1', '-e $xyzzy=1') do
flags("--execute=$xyzzy=1", "-e $xyzzy=1") do
assert_equal 1, $xyzzy
assert_equal :exit, @exit
$xyzzy = 0
@ -81,7 +81,7 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_execute_and_continue
$xyzzy = 0
flags('--execute-continue=$xyzzy=1', '-E $xyzzy=1') do
flags("--execute-continue=$xyzzy=1", "-E $xyzzy=1") do
assert_equal 1, $xyzzy
refute_equal :exit, @exit
$xyzzy = 0
@ -92,7 +92,7 @@ class TestRakeApplicationOptions < Rake::TestCase
$xyzzy = 0
out, = capture_io do
flags('--execute-print=$xyzzy="pugh"', '-p $xyzzy="pugh"') do
assert_equal 'pugh', $xyzzy
assert_equal "pugh", $xyzzy
assert_equal :exit, @exit
$xyzzy = 0
end
@ -103,7 +103,7 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_help
out, = capture_io do
flags '--help', '-H', '-h'
flags "--help", "-H", "-h"
end
assert_match(/\Arake/, out)
@ -116,62 +116,62 @@ class TestRakeApplicationOptions < Rake::TestCase
flags([]) do |opts|
assert_nil opts.thread_pool_size
end
flags(['--jobs', '0'], ['-j', '0']) do |opts|
flags(["--jobs", "0"], ["-j", "0"]) do |opts|
assert_equal 0, opts.thread_pool_size
end
flags(['--jobs', '1'], ['-j', '1']) do |opts|
flags(["--jobs", "1"], ["-j", "1"]) do |opts|
assert_equal 0, opts.thread_pool_size
end
flags(['--jobs', '4'], ['-j', '4']) do |opts|
flags(["--jobs", "4"], ["-j", "4"]) do |opts|
assert_equal 3, opts.thread_pool_size
end
flags(['--jobs', 'asdas'], ['-j', 'asdas']) do |opts|
flags(["--jobs", "asdas"], ["-j", "asdas"]) do |opts|
assert_equal Rake.suggested_thread_count-1, opts.thread_pool_size
end
flags('--jobs', '-j') do |opts|
flags("--jobs", "-j") do |opts|
assert opts.thread_pool_size > 1_000_000, "thread pool size should be huge (was #{opts.thread_pool_size})"
end
end
def test_libdir
flags(['--libdir', 'xx'], ['-I', 'xx'], ['-Ixx']) do
$:.include?('xx')
flags(["--libdir", "xx"], ["-I", "xx"], ["-Ixx"]) do
$:.include?("xx")
end
ensure
$:.delete('xx')
$:.delete("xx")
end
def test_multitask
flags('--multitask', '-m') do |opts|
flags("--multitask", "-m") do |opts|
assert_equal opts.always_multitask, true
end
end
def test_rakefile
flags(['--rakefile', 'RF'], ['--rakefile=RF'], ['-f', 'RF'], ['-fRF']) do
assert_equal ['RF'], @app.instance_eval { @rakefiles }
flags(["--rakefile", "RF"], ["--rakefile=RF"], ["-f", "RF"], ["-fRF"]) do
assert_equal ["RF"], @app.instance_eval { @rakefiles }
end
end
def test_rakelib
dirs = %w(A B C).join(File::PATH_SEPARATOR)
flags(
['--rakelibdir', dirs],
["--rakelibdir", dirs],
["--rakelibdir=#{dirs}"],
['-R', dirs],
["-R", dirs],
["-R#{dirs}"]) do |opts|
assert_equal ['A', 'B', 'C'], opts.rakelib
assert_equal ["A", "B", "C"], opts.rakelib
end
end
def test_require
$LOAD_PATH.unshift @tempdir
open 'reqfile.rb', 'w' do |io| io << 'TESTING_REQUIRE << 1' end
open 'reqfile2.rb', 'w' do |io| io << 'TESTING_REQUIRE << 2' end
open 'reqfile3.rake', 'w' do |io| io << 'TESTING_REQUIRE << 3' end
open "reqfile.rb", "w" do |io| io << "TESTING_REQUIRE << 1" end
open "reqfile2.rb", "w" do |io| io << "TESTING_REQUIRE << 2" end
open "reqfile3.rake", "w" do |io| io << "TESTING_REQUIRE << 3" end
flags(['--require', 'reqfile'], '-rreqfile2', '-rreqfile3')
flags(["--require", "reqfile"], "-rreqfile2", "-rreqfile3")
assert_includes TESTING_REQUIRE, 1
assert_includes TESTING_REQUIRE, 2
@ -184,7 +184,7 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_missing_require
ex = assert_raises(LoadError) do
flags(['--require', 'test/missing']) do |opts|
flags(["--require", "test/missing"]) do |opts|
end
end
assert_match(/such file/, ex.message)
@ -192,47 +192,47 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_prereqs
flags('--prereqs', '-P') do |opts|
flags("--prereqs", "-P") do |opts|
assert opts.show_prereqs
end
end
def test_quiet
Rake::FileUtilsExt.verbose_flag = true
flags('--quiet', '-q') do |opts|
flags("--quiet", "-q") do |opts|
assert ! Rake::FileUtilsExt.verbose_flag, "verbose flag should be false"
assert ! opts.silent, "should not be silent"
end
end
def test_no_search
flags('--nosearch', '--no-search', '-N') do |opts|
flags("--nosearch", "--no-search", "-N") do |opts|
assert opts.nosearch
end
end
def test_silent
Rake::FileUtilsExt.verbose_flag = true
flags('--silent', '-s') do |opts|
flags("--silent", "-s") do |opts|
assert ! Rake::FileUtilsExt.verbose_flag, "verbose flag should be false"
assert opts.silent, "should be silent"
end
end
def test_system
flags('--system', '-g') do |opts|
flags("--system", "-g") do |opts|
assert opts.load_system
end
end
def test_no_system
flags('--no-system', '-G') do |opts|
flags("--no-system", "-G") do |opts|
assert opts.ignore_system
end
end
def test_trace
flags('--trace', '-t') do |opts|
flags("--trace", "-t") do |opts|
assert opts.trace, "should enable trace option"
assert opts.backtrace, "should enabled backtrace option"
assert_equal $stderr, opts.trace_output
@ -242,7 +242,7 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_trace_with_stdout
flags('--trace=stdout', '-tstdout') do |opts|
flags("--trace=stdout", "-tstdout") do |opts|
assert opts.trace, "should enable trace option"
assert opts.backtrace, "should enabled backtrace option"
assert_equal $stdout, opts.trace_output
@ -252,7 +252,7 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_trace_with_stderr
flags('--trace=stderr', '-tstderr') do |opts|
flags("--trace=stderr", "-tstderr") do |opts|
assert opts.trace, "should enable trace option"
assert opts.backtrace, "should enabled backtrace option"
assert_equal $stderr, opts.trace_output
@ -263,23 +263,23 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_trace_with_error
ex = assert_raises(Rake::CommandLineOptionError) do
flags('--trace=xyzzy') do |opts| end
flags("--trace=xyzzy") do |opts| end
end
assert_match(/un(known|recognized).*\btrace\b.*xyzzy/i, ex.message)
end
def test_trace_with_following_task_name
flags(['--trace', 'taskname'], ['-t', 'taskname']) do |opts|
flags(["--trace", "taskname"], ["-t", "taskname"]) do |opts|
assert opts.trace, "should enable trace option"
assert opts.backtrace, "should enabled backtrace option"
assert_equal $stderr, opts.trace_output
assert Rake::FileUtilsExt.verbose_flag
assert_equal ['taskname'], @app.top_level_tasks
assert_equal ["taskname"], @app.top_level_tasks
end
end
def test_backtrace
flags('--backtrace') do |opts|
flags("--backtrace") do |opts|
assert opts.backtrace, "should enable backtrace option"
assert_equal $stderr, opts.trace_output
assert ! opts.trace, "should not enable trace option"
@ -287,7 +287,7 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_backtrace_with_stdout
flags('--backtrace=stdout') do |opts|
flags("--backtrace=stdout") do |opts|
assert opts.backtrace, "should enable backtrace option"
assert_equal $stdout, opts.trace_output
assert ! opts.trace, "should not enable trace option"
@ -295,7 +295,7 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_backtrace_with_stderr
flags('--backtrace=stderr') do |opts|
flags("--backtrace=stderr") do |opts|
assert opts.backtrace, "should enable backtrace option"
assert_equal $stderr, opts.trace_output
assert ! opts.trace, "should not enable trace option"
@ -304,38 +304,38 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_backtrace_with_error
ex = assert_raises(Rake::CommandLineOptionError) do
flags('--backtrace=xyzzy') do |opts| end
flags("--backtrace=xyzzy") do |opts| end
end
assert_match(/un(known|recognized).*\bbacktrace\b.*xyzzy/i, ex.message)
end
def test_backtrace_with_following_task_name
flags(['--backtrace', 'taskname']) do |opts|
flags(["--backtrace", "taskname"]) do |opts|
assert ! opts.trace, "should enable trace option"
assert opts.backtrace, "should enabled backtrace option"
assert_equal $stderr, opts.trace_output
assert_equal ['taskname'], @app.top_level_tasks
assert_equal ["taskname"], @app.top_level_tasks
end
end
def test_trace_rules
flags('--rules') do |opts|
flags("--rules") do |opts|
assert opts.trace_rules
end
end
def test_tasks
flags('--tasks', '-T') do |opts|
flags("--tasks", "-T") do |opts|
assert_equal :tasks, opts.show_tasks
assert_equal(//.to_s, opts.show_task_pattern.to_s)
assert_equal nil, opts.show_all_tasks
end
flags(['--tasks', 'xyz'], ['-Txyz']) do |opts|
flags(["--tasks", "xyz"], ["-Txyz"]) do |opts|
assert_equal :tasks, opts.show_tasks
assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
assert_equal nil, opts.show_all_tasks
end
flags(['--tasks', 'xyz', '--comments']) do |opts|
flags(["--tasks", "xyz", "--comments"]) do |opts|
assert_equal :tasks, opts.show_tasks
assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
assert_equal false, opts.show_all_tasks
@ -343,17 +343,17 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_where
flags('--where', '-W') do |opts|
flags("--where", "-W") do |opts|
assert_equal :lines, opts.show_tasks
assert_equal(//.to_s, opts.show_task_pattern.to_s)
assert_equal true, opts.show_all_tasks
end
flags(['--where', 'xyz'], ['-Wxyz']) do |opts|
flags(["--where", "xyz"], ["-Wxyz"]) do |opts|
assert_equal :lines, opts.show_tasks
assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
assert_equal true, opts.show_all_tasks
end
flags(['--where', 'xyz', '--comments'], ['-Wxyz', '--comments']) do |opts|
flags(["--where", "xyz", "--comments"], ["-Wxyz", "--comments"]) do |opts|
assert_equal :lines, opts.show_tasks
assert_equal(/xyz/.to_s, opts.show_task_pattern.to_s)
assert_equal false, opts.show_all_tasks
@ -361,14 +361,14 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_no_deprecated_messages
flags('--no-deprecation-warnings', '-X') do |opts|
flags("--no-deprecation-warnings", "-X") do |opts|
assert opts.ignore_deprecate
end
end
def test_verbose
capture_io do
flags('--verbose', '-v') do |opts|
flags("--verbose", "-v") do |opts|
assert Rake::FileUtilsExt.verbose_flag, "verbose should be true"
assert ! opts.silent, "opts should not be silent"
end
@ -377,7 +377,7 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_version
out, _ = capture_io do
flags '--version', '-V'
flags "--version", "-V"
end
assert_match(/\bversion\b/, out)
@ -388,7 +388,7 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_bad_option
_, err = capture_io do
ex = assert_raises(OptionParser::InvalidOption) do
flags('--bad-option')
flags("--bad-option")
end
if ex.message =~ /^While/ # Ruby 1.9 error message
@ -399,7 +399,7 @@ class TestRakeApplicationOptions < Rake::TestCase
end
end
assert_equal '', err
assert_equal "", err
end
def test_task_collection
@ -413,26 +413,26 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_environment_definition
ENV.delete('TESTKEY')
ENV.delete("TESTKEY")
command_line("TESTKEY=12")
assert_equal '12', ENV['TESTKEY']
assert_equal "12", ENV["TESTKEY"]
end
def test_multiline_environment_definition
ENV.delete('TESTKEY')
ENV.delete("TESTKEY")
command_line("TESTKEY=a\nb\n")
assert_equal "a\nb\n", ENV['TESTKEY']
assert_equal "a\nb\n", ENV["TESTKEY"]
end
def test_environment_and_tasks_together
ENV.delete('TESTKEY')
ENV.delete("TESTKEY")
command_line("a", "b", "TESTKEY=12")
assert_equal ["a", "b"], @tasks.sort
assert_equal '12', ENV['TESTKEY']
assert_equal "12", ENV["TESTKEY"]
end
def test_rake_explicit_task_library
Rake.add_rakelib 'app/task', 'other'
Rake.add_rakelib "app/task", "other"
libs = Rake.application.options.rakelib

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'open3'
require File.expand_path("../helper", __FILE__)
require "open3"
class TestBacktraceSuppression < Rake::TestCase
def test_bin_rake_suppressed
@ -11,7 +11,7 @@ class TestBacktraceSuppression < Rake::TestCase
end
def test_system_dir_suppressed
path = RbConfig::CONFIG['rubylibprefix']
path = RbConfig::CONFIG["rubylibprefix"]
skip if path.nil?
path = File.expand_path path
@ -23,7 +23,7 @@ class TestBacktraceSuppression < Rake::TestCase
end
def test_near_system_dir_isnt_suppressed
path = RbConfig::CONFIG['rubylibprefix']
path = RbConfig::CONFIG["rubylibprefix"]
skip if path.nil?
path = File.expand_path path
@ -41,7 +41,7 @@ class TestRakeBacktrace < Rake::TestCase
def setup
super
skip 'tmpdir is suppressed in backtrace' if
skip "tmpdir is suppressed in backtrace" if
Rake::Backtrace::SUPPRESS_PATTERN =~ Dir.pwd
end

View File

@ -1,13 +1,13 @@
require File.expand_path('../helper', __FILE__)
require 'rake/clean'
require File.expand_path("../helper", __FILE__)
require "rake/clean"
class TestRakeClean < Rake::TestCase
def test_clean
load 'rake/clean.rb', true
load "rake/clean.rb", true
assert Rake::Task['clean'], "Should define clean"
assert Rake::Task['clobber'], "Should define clobber"
assert Rake::Task['clobber'].prerequisites.include?("clean"),
assert Rake::Task["clean"], "Should define clean"
assert Rake::Task["clobber"], "Should define clobber"
assert Rake::Task["clobber"].prerequisites.include?("clean"),
"Clobber should require clean"
end

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeCpuCounter < Rake::TestCase
@ -10,7 +10,7 @@ class TestRakeCpuCounter < Rake::TestCase
def test_count
num = @cpu_counter.count
skip 'cannot count CPU' if num == nil
skip "cannot count CPU" if num == nil
assert_kind_of Numeric, num
assert_operator num, :>=, 1
end

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
require File.expand_path("../helper", __FILE__)
require "fileutils"
class TestRakeDefinitions < Rake::TestCase
include Rake
@ -69,7 +69,7 @@ class TestRakeDefinitions < Rake::TestCase
create_existing_file
task y: [EXISTINGFILE] do |t| runs << t.name end
Task[:y].invoke
assert_equal runs, ['y']
assert_equal runs, ["y"]
end
private # ----------------------------------------------------------

View File

@ -1,6 +1,6 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
require 'pathname'
require File.expand_path("../helper", __FILE__)
require "fileutils"
require "pathname"
class TestRakeDirectoryTask < Rake::TestCase
include Rake
@ -19,7 +19,7 @@ class TestRakeDirectoryTask < Rake::TestCase
assert_equal "DESC", Task["a/b/c"].comment
verbose(false) {
Task['a/b'].invoke
Task["a/b"].invoke
}
assert File.exist?("a/b")
@ -29,20 +29,20 @@ class TestRakeDirectoryTask < Rake::TestCase
def test_directory_colon
directory "a:b"
assert_equal FileCreationTask, Task['a:b'].class
assert_equal FileCreationTask, Task["a:b"].class
end unless Rake::Win32.windows?
if Rake::Win32.windows?
def test_directory_win32
desc "WIN32 DESC"
directory 'c:/a/b/c'
assert_equal FileTask, Task['c:'].class
assert_equal FileCreationTask, Task['c:/a'].class
assert_equal FileCreationTask, Task['c:/a/b'].class
assert_equal FileCreationTask, Task['c:/a/b/c'].class
assert_nil Task['c:/'].comment
assert_equal "WIN32 DESC", Task['c:/a/b/c'].comment
assert_nil Task['c:/a/b'].comment
directory "c:/a/b/c"
assert_equal FileTask, Task["c:"].class
assert_equal FileCreationTask, Task["c:/a"].class
assert_equal FileCreationTask, Task["c:/a/b"].class
assert_equal FileCreationTask, Task["c:/a/b/c"].class
assert_nil Task["c:/"].comment
assert_equal "WIN32 DESC", Task["c:/a/b/c"].comment
assert_nil Task["c:/a/b"].comment
end
end
@ -68,7 +68,7 @@ class TestRakeDirectoryTask < Rake::TestCase
assert_equal FileCreationTask, Task["a/b/c"].class
verbose(false) {
Task['a/b/c'].invoke
Task["a/b/c"].invoke
}
assert File.directory?("a/b/c")

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeDsl < Rake::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeEarlyTime < Rake::TestCase
def test_create

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'stringio'
require File.expand_path("../helper", __FILE__)
require "stringio"
class TestRakeExtension < Rake::TestCase

View File

@ -1,12 +1,12 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
require File.expand_path("../helper", __FILE__)
require "fileutils"
######################################################################
class TestRakeFileCreationTask < Rake::TestCase
include Rake
include Rake::DSL
DUMMY_DIR = 'dummy_dir'
DUMMY_DIR = "dummy_dir"
def setup
super

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'pathname'
require File.expand_path("../helper", __FILE__)
require "pathname"
class TestRakeFileList < Rake::TestCase
FileList = Rake::FileList
@ -22,9 +22,9 @@ class TestRakeFileList < Rake::TestCase
FileUtils.touch "abc.x"
FileUtils.touch "existing"
open 'xyzzy.txt', 'w' do |io|
io.puts 'x'
io.puts 'XYZZY'
open "xyzzy.txt", "w" do |io|
io.puts "x"
io.puts "XYZZY"
end
end
@ -90,21 +90,21 @@ class TestRakeFileList < Rake::TestCase
def test_append
fl = FileList.new
fl << "a.rb" << "b.rb"
assert_equal ['a.rb', 'b.rb'], fl
assert_equal ["a.rb", "b.rb"], fl
end
def test_append_pathname
fl = FileList.new
fl << Pathname.new("a.rb")
assert_equal ['a.rb'], fl
assert_equal ["a.rb"], fl
end
def test_add_many
fl = FileList.new
fl.include %w(a d c)
fl.include('x', 'y')
assert_equal ['a', 'd', 'c', 'x', 'y'], fl
assert_equal ['a', 'd', 'c', 'x', 'y'], fl.resolve
fl.include("x", "y")
assert_equal ["a", "d", "c", "x", "y"], fl
assert_equal ["a", "d", "c", "x", "y"], fl.resolve
end
def test_add_return
@ -117,7 +117,7 @@ class TestRakeFileList < Rake::TestCase
def test_match
fl = FileList.new
fl.include '*.c'
fl.include "*.c"
assert_equal %w[abc.c x.c xyz.c], fl.sort
end
@ -125,18 +125,18 @@ class TestRakeFileList < Rake::TestCase
def test_add_matching
fl = FileList.new
fl << "a.java"
fl.include '*.c'
fl.include "*.c"
assert_equal %w[a.java abc.c x.c xyz.c], fl.sort
end
def test_multiple_patterns
fl = FileList.new
fl.include('*.z', '*foo*')
fl.include("*.z", "*foo*")
assert_equal [], fl
fl.include('*.c', '*xist*')
fl.include("*.c", "*xist*")
assert_equal %w[x.c xyz.c abc.c existing].sort, fl.sort
end
@ -164,7 +164,7 @@ class TestRakeFileList < Rake::TestCase
end
def test_exclude
fl = FileList['x.c', 'abc.c', 'xyz.c', 'existing']
fl = FileList["x.c", "abc.c", "xyz.c", "existing"]
fl.each { |fn| touch fn, verbose: false }
x = fl.exclude(%r{^x.+\.})
@ -173,57 +173,57 @@ class TestRakeFileList < Rake::TestCase
assert_equal %w(x.c abc.c existing), fl
assert_equal fl.object_id, x.object_id
fl.exclude('*.c')
fl.exclude("*.c")
assert_equal ['existing'], fl
assert_equal ["existing"], fl
fl.exclude('existing')
fl.exclude("existing")
assert_equal [], fl
end
def test_exclude_pathname
fl = FileList['x.c', 'abc.c', 'other']
fl = FileList["x.c", "abc.c", "other"]
fl.each { |fn| touch fn, verbose: false }
fl.exclude(Pathname.new('*.c'))
fl.exclude(Pathname.new("*.c"))
assert_equal ['other'], fl
assert_equal ["other"], fl
end
def test_excluding_via_block
fl = FileList['a.c', 'b.c', 'xyz.c']
fl.exclude { |fn| fn.pathmap('%n') == 'xyz' }
fl = FileList["a.c", "b.c", "xyz.c"]
fl.exclude { |fn| fn.pathmap("%n") == "xyz" }
assert fl.excluded_from_list?("xyz.c"), "Should exclude xyz.c"
assert_equal ['a.c', 'b.c'], fl
assert_equal ["a.c", "b.c"], fl
end
def test_exclude_return_on_create
fl = FileList['*'].exclude(/.*\.[hcx]$/)
fl = FileList["*"].exclude(/.*\.[hcx]$/)
assert_equal %w[cfiles existing xyzzy.txt], fl.sort
assert_equal FileList, fl.class
end
def test_exclude_with_string_return_on_create
fl = FileList['*'].exclude('abc.c')
fl = FileList["*"].exclude("abc.c")
assert_equal %w[abc.h abc.x cfiles existing x.c xyz.c xyzzy.txt], fl.sort
assert_equal FileList, fl.class
end
def test_exclude_curly_bracket_pattern
skip 'brace pattern matches not supported' unless defined? File::FNM_EXTGLOB
fl = FileList['*'].exclude('{abc,xyz}.c')
skip "brace pattern matches not supported" unless defined? File::FNM_EXTGLOB
fl = FileList["*"].exclude("{abc,xyz}.c")
assert_equal %w[abc.h abc.x cfiles existing x.c xyzzy.txt], fl
end
def test_exclude_an_array
fl = FileList['*'].exclude(['existing', '*.c'])
fl = FileList["*"].exclude(["existing", "*.c"])
assert_equal %w[abc.h abc.x cfiles xyzzy.txt], fl
end
def test_exclude_a_filelist
excluded = FileList['existing', '*.c']
fl = FileList['*'].exclude(excluded)
excluded = FileList["existing", "*.c"]
fl = FileList["*"].exclude(excluded)
assert_equal %w[abc.h abc.x cfiles xyzzy.txt], fl
end
@ -238,9 +238,9 @@ class TestRakeFileList < Rake::TestCase
def test_unique
fl = FileList.new
fl << "x.c" << "a.c" << "b.rb" << "a.c"
assert_equal ['x.c', 'a.c', 'b.rb', 'a.c'], fl
assert_equal ["x.c", "a.c", "b.rb", "a.c"], fl
fl.uniq!
assert_equal ['x.c', 'a.c', 'b.rb'], fl
assert_equal ["x.c", "a.c", "b.rb"], fl
end
def test_to_string
@ -251,15 +251,15 @@ class TestRakeFileList < Rake::TestCase
end
def test_to_array
fl = FileList['a.java', 'b.java']
assert_equal ['a.java', 'b.java'], fl.to_a
fl = FileList["a.java", "b.java"]
assert_equal ["a.java", "b.java"], fl.to_a
assert_equal Array, fl.to_a.class
assert_equal ['a.java', 'b.java'], fl.to_ary
assert_equal ["a.java", "b.java"], fl.to_ary
assert_equal Array, fl.to_ary.class
end
def test_to_s_pending
fl = FileList['abc.*']
fl = FileList["abc.*"]
result = fl.to_s
assert_match(%r{abc\.c}, result)
assert_match(%r{abc\.h}, result)
@ -268,7 +268,7 @@ class TestRakeFileList < Rake::TestCase
end
def test_inspect_pending
fl = FileList['abc.*']
fl = FileList["abc.*"]
result = fl.inspect
assert_match(%r{"abc\.c"}, result)
assert_match(%r{"abc\.h"}, result)
@ -289,24 +289,24 @@ class TestRakeFileList < Rake::TestCase
end
def test_claim_to_be_a_kind_of_array
fl = FileList['*.c']
fl = FileList["*.c"]
assert fl.is_a?(Array)
assert fl.kind_of?(Array)
end
def test_claim_to_be_a_kind_of_filelist
fl = FileList['*.c']
fl = FileList["*.c"]
assert fl.is_a?(FileList)
assert fl.kind_of?(FileList)
end
def test_claim_to_be_a_filelist_instance
fl = FileList['*.c']
fl = FileList["*.c"]
assert fl.instance_of?(FileList)
end
def test_dont_claim_to_be_an_array_instance
fl = FileList['*.c']
fl = FileList["*.c"]
assert ! fl.instance_of?(Array)
end
@ -343,7 +343,7 @@ class TestRakeFileList < Rake::TestCase
assert_equal ".onerc.net", ".onerc.dot".ext("net")
assert_equal ".onerc.net", ".onerc".ext("net")
assert_equal ".a/.onerc.net", ".a/.onerc".ext("net")
assert_equal "one", "one.two".ext('')
assert_equal "one", "one.two".ext("")
assert_equal "one", "one.two".ext
assert_equal ".one", ".one.two".ext
assert_equal ".one", ".one".ext
@ -357,8 +357,8 @@ class TestRakeFileList < Rake::TestCase
end
def test_filelist_ext
assert_equal FileList['one.c', '.one.c'],
FileList['one.net', '.one'].ext('c')
assert_equal FileList["one.c", ".one.c"],
FileList["one.net", ".one"].ext("c")
end
def test_gsub
@ -376,12 +376,12 @@ class TestRakeFileList < Rake::TestCase
end
def test_egrep_returns_0_if_no_matches
files = FileList['test/lib/*_test.rb'].exclude("test/lib/filelist_test.rb")
files = FileList["test/lib/*_test.rb"].exclude("test/lib/filelist_test.rb")
assert_equal 0, files.egrep(/XYZZY/) { }
end
def test_egrep_with_output
files = FileList['*.txt']
files = FileList["*.txt"]
out, = capture_io do
files.egrep(/XYZZY/)
@ -391,7 +391,7 @@ class TestRakeFileList < Rake::TestCase
end
def test_egrep_with_block
files = FileList['*.txt']
files = FileList["*.txt"]
found = nil
files.egrep(/XYZZY/) do |fn, ln, line|
@ -402,7 +402,7 @@ class TestRakeFileList < Rake::TestCase
end
def test_egrep_with_error
files = FileList['*.txt']
files = FileList["*.txt"]
_, err = capture_io do
files.egrep(/XYZZY/) do |fn, ln, line |
@ -414,20 +414,20 @@ class TestRakeFileList < Rake::TestCase
end
def test_existing
fl = FileList['abc.c', 'notthere.c']
fl = FileList["abc.c", "notthere.c"]
assert_equal ["abc.c"], fl.existing
assert fl.existing.is_a?(FileList)
end
def test_existing!
fl = FileList['abc.c', 'notthere.c']
fl = FileList["abc.c", "notthere.c"]
result = fl.existing!
assert_equal ["abc.c"], fl
assert_equal fl.object_id, result.object_id
end
def test_ignore_special
f = FileList['*']
f = FileList["*"]
assert ! f.include?("CVS"), "Should not contain CVS"
assert ! f.include?(".svn"), "Should not contain .svn"
assert ! f.include?(".dummy"), "Should not contain dot files"
@ -437,7 +437,7 @@ class TestRakeFileList < Rake::TestCase
end
def test_clear_ignore_patterns
f = FileList['*', '.svn']
f = FileList["*", ".svn"]
f.clear_exclude
assert f.include?("abc.c")
assert f.include?("xyz.c")
@ -470,34 +470,34 @@ class TestRakeFileList < Rake::TestCase
end
def test_basic_array_functions
f = FileList['b', 'c', 'a']
assert_equal 'b', f.first
assert_equal 'b', f[0]
assert_equal 'a', f.last
assert_equal 'a', f[2]
assert_equal 'a', f[-1]
assert_equal ['a', 'b', 'c'], f.sort
f = FileList["b", "c", "a"]
assert_equal "b", f.first
assert_equal "b", f[0]
assert_equal "a", f.last
assert_equal "a", f[2]
assert_equal "a", f[-1]
assert_equal ["a", "b", "c"], f.sort
f.sort!
assert_equal ['a', 'b', 'c'], f
assert_equal ["a", "b", "c"], f
end
def test_flatten
assert_equal ['a', 'x.c', 'xyz.c', 'abc.c'].sort,
['a', FileList['*.c']].flatten.sort
assert_equal ["a", "x.c", "xyz.c", "abc.c"].sort,
["a", FileList["*.c"]].flatten.sort
end
def test_clone_and_dup
a = FileList['a', 'b', 'c']
a = FileList["a", "b", "c"]
c = a.clone
d = a.dup
a << 'd'
assert_equal ['a', 'b', 'c', 'd'], a
assert_equal ['a', 'b', 'c'], c
assert_equal ['a', 'b', 'c'], d
a << "d"
assert_equal ["a", "b", "c", "d"], a
assert_equal ["a", "b", "c"], c
assert_equal ["a", "b", "c"], d
end
def test_dup_and_clone_replicate_taint
a = FileList['a', 'b', 'c']
a = FileList["a", "b", "c"]
a.taint
c = a.clone
d = a.dup
@ -506,27 +506,27 @@ class TestRakeFileList < Rake::TestCase
end
def test_duped_items_will_thaw
a = FileList['a', 'b', 'c']
a = FileList["a", "b", "c"]
a.freeze
d = a.dup
d << 'more'
assert_equal ['a', 'b', 'c', 'more'], d
d << "more"
assert_equal ["a", "b", "c", "more"], d
end
def test_cloned_items_stay_frozen
a = FileList['a', 'b', 'c']
a = FileList["a", "b", "c"]
a.freeze
c = a.clone
assert_raises(TypeError, RuntimeError) do
c << 'more'
c << "more"
end
end
def test_array_comparisons
fl = FileList['b', 'b']
a = ['b', 'a']
b = ['b', 'b']
c = ['b', 'c']
fl = FileList["b", "b"]
a = ["b", "a"]
b = ["b", "b"]
c = ["b", "c"]
assert_equal(1, fl <=> a)
assert_equal(0, fl <=> b)
assert_equal(-1, fl <=> c)
@ -536,8 +536,8 @@ class TestRakeFileList < Rake::TestCase
end
def test_array_equality
a = FileList['a', 'b']
b = ['a', 'b']
a = FileList["a", "b"]
b = ["a", "b"]
assert a == b
assert b == a
# assert a.eql?(b)
@ -547,115 +547,115 @@ class TestRakeFileList < Rake::TestCase
end
def test_enumeration_methods
a = FileList['a', 'b']
a = FileList["a", "b"]
b = a.map(&:upcase)
assert_equal ['A', 'B'], b
assert_equal ["A", "B"], b
assert_equal FileList, b.class
b = a.map(&:upcase)
assert_equal ['A', 'B'], b
assert_equal ["A", "B"], b
assert_equal FileList, b.class
b = a.sort
assert_equal ['a', 'b'], b
assert_equal ["a", "b"], b
assert_equal FileList, b.class
b = a.sort_by { |it| it }
assert_equal ['a', 'b'], b
assert_equal ["a", "b"], b
assert_equal FileList, b.class
b = a.select { |it| it == 'b' }
assert_equal ['b'], b
b = a.select { |it| it == "b" }
assert_equal ["b"], b
assert_equal FileList, b.class
b = a.select { |it| it.size == 1 }
assert_equal ['a', 'b'], b
assert_equal ["a", "b"], b
assert_equal FileList, b.class
b = a.reject { |it| it == 'b' }
assert_equal ['a'], b
b = a.reject { |it| it == "b" }
assert_equal ["a"], b
assert_equal FileList, b.class
b = a.grep(/./)
assert_equal ['a', 'b'], b
assert_equal ["a", "b"], b
assert_equal FileList, b.class
b = a.partition { |it| it == 'b' }
assert_equal [['b'], ['a']], b
b = a.partition { |it| it == "b" }
assert_equal [["b"], ["a"]], b
assert_equal Array, b.class
assert_equal FileList, b[0].class
assert_equal FileList, b[1].class
b = a.zip(['x', 'y']).to_a
assert_equal [['a', 'x'], ['b', 'y']], b
b = a.zip(["x", "y"]).to_a
assert_equal [["a", "x"], ["b", "y"]], b
assert_equal Array, b.class
assert_equal Array, b[0].class
assert_equal Array, b[1].class
end
def test_array_operators
a = ['a', 'b']
b = ['c', 'd']
f = FileList['x', 'y']
g = FileList['w', 'z']
a = ["a", "b"]
b = ["c", "d"]
f = FileList["x", "y"]
g = FileList["w", "z"]
r = f + g
assert_equal ['x', 'y', 'w', 'z'], r
assert_equal ["x", "y", "w", "z"], r
assert_equal FileList, r.class
r = a + g
assert_equal ['a', 'b', 'w', 'z'], r
assert_equal ["a", "b", "w", "z"], r
assert_equal Array, r.class
r = f + b
assert_equal ['x', 'y', 'c', 'd'], r
assert_equal ["x", "y", "c", "d"], r
assert_equal FileList, r.class
r = FileList['w', 'x', 'y', 'z'] - f
assert_equal ['w', 'z'], r
r = FileList["w", "x", "y", "z"] - f
assert_equal ["w", "z"], r
assert_equal FileList, r.class
r = FileList['w', 'x', 'y', 'z'] & f
assert_equal ['x', 'y'], r
r = FileList["w", "x", "y", "z"] & f
assert_equal ["x", "y"], r
assert_equal FileList, r.class
r = f * 2
assert_equal ['x', 'y', 'x', 'y'], r
assert_equal ["x", "y", "x", "y"], r
assert_equal FileList, r.class
r = f * ','
assert_equal 'x,y', r
r = f * ","
assert_equal "x,y", r
assert_equal String, r.class
r = f | ['a', 'x']
assert_equal ['a', 'x', 'y'].sort, r.sort
r = f | ["a", "x"]
assert_equal ["a", "x", "y"].sort, r.sort
assert_equal FileList, r.class
end
def test_other_array_returning_methods
f = FileList['a', nil, 'b']
f = FileList["a", nil, "b"]
r = f.compact
assert_equal ['a', 'b'], r
assert_equal ["a", "b"], r
assert_equal FileList, r.class
f = FileList['a', 'b']
r = f.concat(['x', 'y'])
assert_equal ['a', 'b', 'x', 'y'], r
f = FileList["a", "b"]
r = f.concat(["x", "y"])
assert_equal ["a", "b", "x", "y"], r
assert_equal FileList, r.class
f = FileList['a', ['b', 'c'], FileList['d', 'e']]
f = FileList["a", ["b", "c"], FileList["d", "e"]]
r = f.flatten
assert_equal ['a', 'b', 'c', 'd', 'e'], r
assert_equal ["a", "b", "c", "d", "e"], r
assert_equal FileList, r.class
f = FileList['a', 'b', 'a']
f = FileList["a", "b", "a"]
r = f.uniq
assert_equal ['a', 'b'], r
assert_equal ["a", "b"], r
assert_equal FileList, r.class
f = FileList['a', 'b', 'c', 'd']
f = FileList["a", "b", "c", "d"]
r = f.values_at(1, 3)
assert_equal ['b', 'd'], r
assert_equal ["b", "d"], r
assert_equal FileList, r.class
end
@ -675,13 +675,13 @@ class TestRakeFileList < Rake::TestCase
end
def test_file_utils_can_use_filelists
cfiles = FileList['*.c']
cfiles = FileList["*.c"]
cp cfiles, @cdir, verbose: false
assert File.exist?(File.join(@cdir, 'abc.c'))
assert File.exist?(File.join(@cdir, 'xyz.c'))
assert File.exist?(File.join(@cdir, 'x.c'))
assert File.exist?(File.join(@cdir, "abc.c"))
assert File.exist?(File.join(@cdir, "xyz.c"))
assert File.exist?(File.join(@cdir, "x.c"))
end
end

View File

@ -1,15 +1,15 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeFileListPathMap < Rake::TestCase
def test_file_list_supports_pathmap
assert_equal ['a', 'b'], FileList['dir/a.rb', 'dir/b.rb'].pathmap("%n")
assert_equal ["a", "b"], FileList["dir/a.rb", "dir/b.rb"].pathmap("%n")
end
def test_file_list_supports_pathmap_with_a_block
mapped = FileList['dir/a.rb', 'dir/b.rb'].pathmap("%{.*,*}n") do |name|
mapped = FileList["dir/a.rb", "dir/b.rb"].pathmap("%{.*,*}n") do |name|
name.upcase
end
assert_equal ['A', 'B'], mapped
assert_equal ["A", "B"], mapped
end
end

View File

@ -1,6 +1,6 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
require 'pathname'
require File.expand_path("../helper", __FILE__)
require "fileutils"
require "pathname"
class TestRakeFileTask < Rake::TestCase
include Rake
@ -96,11 +96,11 @@ class TestRakeFileTask < Rake::TestCase
end
def test_needed_eh_build_all
create_file 'a'
create_file "a"
file 'a'
file "a"
a_task = Task['a']
a_task = Task["a"]
refute a_task.needed?
@ -108,30 +108,30 @@ class TestRakeFileTask < Rake::TestCase
assert a_task.needed?
ensure
delete_file 'a'
delete_file "a"
end
def test_needed_eh_dependency
create_file 'a', Time.now
create_file 'b', Time.now - 60
create_file "a", Time.now
create_file "b", Time.now - 60
create_file 'c', Time.now
create_file 'd', Time.now - 60
create_file "c", Time.now
create_file "d", Time.now - 60
file 'b' => 'a'
file "b" => "a"
b_task = Task['b']
b_task = Task["b"]
assert b_task.needed?
file 'c' => 'd'
file "c" => "d"
c_task = Task['c']
c_task = Task["c"]
refute c_task.needed?
ensure
delete_file 'old'
delete_file 'new'
delete_file "old"
delete_file "new"
end
def test_needed_eh_exists

View File

@ -1,17 +1,17 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
require 'stringio'
require File.expand_path("../helper", __FILE__)
require "fileutils"
require "stringio"
class TestRakeFileUtils < Rake::TestCase
def setup
super
@rake_test_sh = ENV['RAKE_TEST_SH']
@rake_test_sh = ENV["RAKE_TEST_SH"]
end
def teardown
FileUtils::LN_SUPPORTED[0] = true
RakeFileUtils.verbose_flag = Rake::FileUtilsExt::DEFAULT
ENV['RAKE_TEST_SH'] = @rake_test_sh
ENV["RAKE_TEST_SH"] = @rake_test_sh
super
end
@ -43,7 +43,7 @@ class TestRakeFileUtils < Rake::TestCase
Rake::FileUtilsExt.safe_ln("a", "b", verbose: false)
assert_equal "TEST_LN\n", File.read('b')
assert_equal "TEST_LN\n", File.read("b")
end
class BadLink
@ -69,16 +69,16 @@ class TestRakeFileUtils < Rake::TestCase
FileUtils::LN_SUPPORTED[0] = true
c = BadLink.new(StandardError)
c.safe_ln "a", "b"
assert_equal ['a', 'b'], c.cp_args
assert_equal ["a", "b"], c.cp_args
c.safe_ln "x", "y"
assert_equal ['x', 'y'], c.cp_args
assert_equal ["x", "y"], c.cp_args
end
def test_safe_ln_failover_to_cp_on_not_implemented_error
FileUtils::LN_SUPPORTED[0] = true
c = BadLink.new(NotImplementedError)
c.safe_ln "a", "b"
assert_equal ['a', 'b'], c.cp_args
assert_equal ["a", "b"], c.cp_args
end
def test_safe_ln_fails_on_script_error
@ -135,7 +135,7 @@ class TestRakeFileUtils < Rake::TestCase
def test_sh_with_a_single_string_argument
check_expansion
ENV['RAKE_TEST_SH'] = 'someval'
ENV["RAKE_TEST_SH"] = "someval"
verbose(false) {
sh %{#{RUBY} check_expansion.rb #{env_var} someval}
}
@ -145,11 +145,11 @@ class TestRakeFileUtils < Rake::TestCase
check_environment
env = {
'RAKE_TEST_SH' => 'someval'
"RAKE_TEST_SH" => "someval"
}
verbose(false) {
sh env, RUBY, 'check_environment.rb', 'RAKE_TEST_SH', 'someval'
sh env, RUBY, "check_environment.rb", "RAKE_TEST_SH", "someval"
}
end
@ -157,22 +157,22 @@ class TestRakeFileUtils < Rake::TestCase
skip if jruby9? # https://github.com/jruby/jruby/issues/3653
check_no_expansion
ENV['RAKE_TEST_SH'] = 'someval'
ENV["RAKE_TEST_SH"] = "someval"
verbose(false) {
sh RUBY, 'check_no_expansion.rb', env_var, 'someval'
sh RUBY, "check_no_expansion.rb", env_var, "someval"
}
end
def test_sh_with_spawn_options
skip 'JRuby does not support spawn options' if jruby?
skip "JRuby does not support spawn options" if jruby?
echocommand
r, w = IO.pipe
verbose(false) {
sh RUBY, 'echocommand.rb', out: w
sh RUBY, "echocommand.rb", out: w
}
w.close
@ -217,7 +217,7 @@ class TestRakeFileUtils < Rake::TestCase
def test_sh_bad_option
# Skip on JRuby because option checking is performed by spawn via system
# now.
skip 'JRuby does not support spawn options' if jruby?
skip "JRuby does not support spawn options" if jruby?
shellcommand
@ -248,7 +248,7 @@ class TestRakeFileUtils < Rake::TestCase
}
end
assert_equal '', err
assert_equal "", err
end
def test_sh_verbose_flag_nil
@ -264,7 +264,7 @@ class TestRakeFileUtils < Rake::TestCase
def test_ruby_with_a_single_string_argument
check_expansion
ENV['RAKE_TEST_SH'] = 'someval'
ENV["RAKE_TEST_SH"] = "someval"
verbose(false) {
replace_ruby {
@ -275,10 +275,10 @@ class TestRakeFileUtils < Rake::TestCase
def test_sh_show_command
env = {
'RAKE_TEST_SH' => 'someval'
"RAKE_TEST_SH" => "someval"
}
cmd = [env, RUBY, 'some_file.rb', 'some argument']
cmd = [env, RUBY, "some_file.rb", "some argument"]
show_cmd = send :sh_show_command, cmd
@ -292,31 +292,31 @@ class TestRakeFileUtils < Rake::TestCase
check_no_expansion
ENV['RAKE_TEST_SH'] = 'someval'
ENV["RAKE_TEST_SH"] = "someval"
verbose(false) {
replace_ruby {
ruby 'check_no_expansion.rb', env_var, 'someval'
ruby "check_no_expansion.rb", env_var, "someval"
}
}
end
def test_split_all
assert_equal ['a'], Rake::FileUtilsExt.split_all('a')
assert_equal ['..'], Rake::FileUtilsExt.split_all('..')
assert_equal ['/'], Rake::FileUtilsExt.split_all('/')
assert_equal ['a', 'b'], Rake::FileUtilsExt.split_all('a/b')
assert_equal ['/', 'a', 'b'], Rake::FileUtilsExt.split_all('/a/b')
assert_equal ['..', 'a', 'b'], Rake::FileUtilsExt.split_all('../a/b')
assert_equal ["a"], Rake::FileUtilsExt.split_all("a")
assert_equal [".."], Rake::FileUtilsExt.split_all("..")
assert_equal ["/"], Rake::FileUtilsExt.split_all("/")
assert_equal ["a", "b"], Rake::FileUtilsExt.split_all("a/b")
assert_equal ["/", "a", "b"], Rake::FileUtilsExt.split_all("/a/b")
assert_equal ["..", "a", "b"], Rake::FileUtilsExt.split_all("../a/b")
end
def command(name, text)
open name, 'w', 0750 do |io|
open name, "w", 0750 do |io|
io << text
end
end
def check_no_expansion
command 'check_no_expansion.rb', <<-CHECK_EXPANSION
command "check_no_expansion.rb", <<-CHECK_EXPANSION
if ARGV[0] != ARGV[1]
exit 0
else
@ -326,7 +326,7 @@ end
end
def check_environment
command 'check_environment.rb', <<-CHECK_ENVIRONMENT
command "check_environment.rb", <<-CHECK_ENVIRONMENT
if ENV[ARGV[0]] != ARGV[1]
exit 1
else
@ -336,7 +336,7 @@ end
end
def check_expansion
command 'check_expansion.rb', <<-CHECK_EXPANSION
command "check_expansion.rb", <<-CHECK_EXPANSION
if ARGV[0] != ARGV[1]
exit 1
else
@ -346,7 +346,7 @@ end
end
def echocommand
command 'echocommand.rb', <<-ECHOCOMMAND
command "echocommand.rb", <<-ECHOCOMMAND
#!/usr/bin/env ruby
puts "echocommand.rb"
@ -366,7 +366,7 @@ exit 0
end
def shellcommand
command 'shellcommand.rb', <<-SHELLCOMMAND
command "shellcommand.rb", <<-SHELLCOMMAND
#!/usr/bin/env ruby
exit((ARGV[0] || "0").to_i)
@ -374,7 +374,7 @@ exit((ARGV[0] || "0").to_i)
end
def env_var
windows? ? '%RAKE_TEST_SH%' : '$RAKE_TEST_SH'
windows? ? "%RAKE_TEST_SH%" : "$RAKE_TEST_SH"
end
def windows?

View File

@ -1,6 +1,6 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
require 'open3'
require File.expand_path("../helper", __FILE__)
require "fileutils"
require "open3"
class TestRakeFunctional < Rake::TestCase
include RubyRunner
@ -11,9 +11,9 @@ class TestRakeFunctional < Rake::TestCase
if @verbose
puts
puts
puts '-' * 80
puts "-" * 80
puts @__name__
puts '-' * 80
puts "-" * 80
end
end
@ -28,7 +28,7 @@ class TestRakeFunctional < Rake::TestCase
def test_rake_error_on_bad_task
rakefile_default
rake '-t', 'xyz'
rake "-t", "xyz"
assert_match(/rake aborted/, @err)
end
@ -44,7 +44,7 @@ class TestRakeFunctional < Rake::TestCase
def test_env_available_at_task_scope
rakefile_default
rake 'TESTTASKSCOPE=1', 'task_scope'
rake "TESTTASKSCOPE=1", "task_scope"
assert_match(/^TASKSCOPE$/, @out)
end
@ -52,13 +52,13 @@ class TestRakeFunctional < Rake::TestCase
def test_task_override
rakefile_override
rake 't1'
rake "t1"
assert_match(/foo\nbar\n/, @out)
end
def test_multi_desc
ENV['RAKE_COLUMNS'] = '80'
ENV["RAKE_COLUMNS"] = "80"
rakefile_multidesc
rake "-T"
@ -99,7 +99,7 @@ class TestRakeFunctional < Rake::TestCase
def test_system
rake_system_dir
rake '-g', "sys1"
rake "-g", "sys1"
assert_match %r{^SYS1}, @out
end
@ -107,7 +107,7 @@ class TestRakeFunctional < Rake::TestCase
def test_system_excludes_rakelib_files_too
rake_system_dir
rake '-g', "sys1", '-T', 'extra'
rake "-g", "sys1", "-T", "extra"
refute_match %r{extra:extra}, @out
end
@ -116,7 +116,7 @@ class TestRakeFunctional < Rake::TestCase
rake_system_dir
rakefile_extra
rake '-T', 'extra', '--trace'
rake "-T", "extra", "--trace"
assert_match %r{extra:extra}, @out
end
@ -134,7 +134,7 @@ class TestRakeFunctional < Rake::TestCase
rake_system_dir
rakefile_extra
rake '-G', "sys1"
rake "-G", "sys1"
assert_match %r{^Don't know how to build task}, @err # emacs wart: '
end
@ -158,7 +158,7 @@ class TestRakeFunctional < Rake::TestCase
def test_nosearch_without_rakefile_and_no_system_fails
rakefile_nosearch
ENV['RAKE_SYSTEM'] = 'not_exist'
ENV["RAKE_SYSTEM"] = "not_exist"
rake "--nosearch"
@ -246,7 +246,7 @@ class TestRakeFunctional < Rake::TestCase
rake
FileUtils.rm_f 'temp_one'
FileUtils.rm_f "temp_one"
rake "--dry-run"
@ -259,7 +259,7 @@ class TestRakeFunctional < Rake::TestCase
rake
FileUtils.rm_f 'temp_one'
FileUtils.rm_f "temp_one"
rake "--trace"
@ -271,7 +271,7 @@ class TestRakeFunctional < Rake::TestCase
rake
assert File.exist?(File.join(@tempdir, 'dynamic_deps')),
assert File.exist?(File.join(@tempdir, "dynamic_deps")),
"'dynamic_deps' file should exist"
assert_match(/^FIRST$\s+^DYNAMIC$\s+^STATIC$\s+^OTHER$/, @out)
end
@ -289,7 +289,7 @@ class TestRakeFunctional < Rake::TestCase
rake
assert File.exist?(File.join(@tempdir, 'play.app')),
assert File.exist?(File.join(@tempdir, "play.app")),
"'play.app' file should exist"
end
@ -306,7 +306,7 @@ class TestRakeFunctional < Rake::TestCase
def test_dash_f_with_no_arg_foils_rakefile_lookup
rakefile_rakelib
rake '-I', 'rakelib', '-rtest1', '-f'
rake "-I", "rakelib", "-rtest1", "-f"
assert_match(/^TEST1$/, @out)
end
@ -314,7 +314,7 @@ class TestRakeFunctional < Rake::TestCase
def test_dot_rake_files_can_be_loaded_with_dash_r
rakefile_rakelib
rake '-I', 'rakelib', '-rtest2', '-f'
rake "-I", "rakelib", "-rtest2", "-f"
assert_empty @err
assert_match(/^TEST2$/, @out)
@ -394,14 +394,14 @@ class TestRakeFunctional < Rake::TestCase
def test_test_task_when_verbose_unless_verbose_passed_not_prompt_testopts
rakefile_test_task_verbose
rake 'unit'
rake "unit"
exp = /TESTOPTS="--verbose" to pass --verbose/
refute_match exp, @out
end
def test_test_task_when_verbose_passed_prompts_testopts
rakefile_test_task
rake '--verbose', 'unit'
rake "--verbose", "unit"
exp = /TESTOPTS="--verbose" to pass --verbose/
assert_match exp, @out
end
@ -449,12 +449,12 @@ class TestRakeFunctional < Rake::TestCase
def test_file_list_is_requirable_separately
skip if jruby9? # https://github.com/jruby/jruby/issues/3655
ruby '-rrake/file_list', '-e', 'puts Rake::FileList["a"].size'
ruby "-rrake/file_list", "-e", 'puts Rake::FileList["a"].size'
assert_equal "1\n", @out
end
def can_detect_signals?
system RUBY, '-e', 'Process.kill "TERM", $$'
system RUBY, "-e", 'Process.kill "TERM", $$'
status = $?
if @verbose
puts " SIG status = #{$?.inspect}"

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeInvocationChain < Rake::TestCase
include Rake
@ -29,7 +29,7 @@ class TestRakeInvocationChain < Rake::TestCase
def test_append_with_one_argument
chain = @empty.append("A")
assert_equal 'TOP => A', chain.to_s # HACK
assert_equal "TOP => A", chain.to_s # HACK
end
def test_append_one_circular

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeLateTime < Rake::TestCase
def test_late_time_comparisons
@ -13,6 +13,6 @@ class TestRakeLateTime < Rake::TestCase
end
def test_to_s
assert_equal '<LATE TIME>', Rake::LATE.to_s
assert_equal "<LATE TIME>", Rake::LATE.to_s
end
end

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestLinkedList < Rake::TestCase
include Rake

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'rake/loaders/makefile'
require File.expand_path("../helper", __FILE__)
require "rake/loaders/makefile"
class TestRakeMakefileLoader < Rake::TestCase
include Rake
@ -7,7 +7,7 @@ class TestRakeMakefileLoader < Rake::TestCase
def test_parse
Dir.chdir @tempdir
open 'sample.mf', 'w' do |io|
open "sample.mf", "w" do |io|
io << <<-'SAMPLE_MF'
# Comments
a: a1 a2 a3 a4
@ -28,19 +28,19 @@ g\ 0: g1 g\ 2 g\ 3 g4
Task.clear
loader = Rake::MakefileLoader.new
loader.load 'sample.mf'
loader.load "sample.mf"
%w(a b c d).each do |t|
assert Task.task_defined?(t), "#{t} should be a defined task"
end
assert_equal %w(a1 a2 a3 a4 a5 a6 a7).sort, Task['a'].prerequisites.sort
assert_equal %w(b1 b2 b3 b4 b5 b6 b7).sort, Task['b'].prerequisites.sort
assert_equal %w(c1).sort, Task['c'].prerequisites.sort
assert_equal %w(d1 d2).sort, Task['d'].prerequisites.sort
assert_equal %w(e1 f1).sort, Task['e'].prerequisites.sort
assert_equal %w(e1 f1).sort, Task['f'].prerequisites.sort
assert_equal %w(a1 a2 a3 a4 a5 a6 a7).sort, Task["a"].prerequisites.sort
assert_equal %w(b1 b2 b3 b4 b5 b6 b7).sort, Task["b"].prerequisites.sort
assert_equal %w(c1).sort, Task["c"].prerequisites.sort
assert_equal %w(d1 d2).sort, Task["d"].prerequisites.sort
assert_equal %w(e1 f1).sort, Task["e"].prerequisites.sort
assert_equal %w(e1 f1).sort, Task["f"].prerequisites.sort
assert_equal(
["g1", "g 2", "g 3", "g4"].sort,
Task['g 0'].prerequisites.sort)
Task["g 0"].prerequisites.sort)
assert_equal 7, Task.tasks.size
end
end

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'thread'
require File.expand_path("../helper", __FILE__)
require "thread"
class TestRakeMultiTask < Rake::TestCase
include Rake
@ -56,7 +56,7 @@ class TestRakeMultiTask < Rake::TestCase
def test_multitasks_with_parameters
task :a, [:arg] do |t, args| add_run(args[:arg]) end
multitask :b, [:arg] => [:a] do |t, args| add_run(args[:arg] + 'mt') end
multitask :b, [:arg] => [:a] do |t, args| add_run(args[:arg] + "mt") end
Task[:b].invoke "b"
assert @runs[0] == "b"
assert @runs[1] == "bmt"
@ -68,7 +68,7 @@ class TestRakeMultiTask < Rake::TestCase
multitask :fail_once do
fail_now = !failed
failed = true
raise 'failing once' if fail_now
raise "failing once" if fail_now
end
task a: :fail_once

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeNameSpace < Rake::TestCase
@ -44,8 +44,8 @@ class TestRakeNameSpace < Rake::TestCase
def test_scope
mgr = TM.new
scope = Rake::LinkedList.new 'b'
scope = scope.conj 'a'
scope = Rake::LinkedList.new "b"
scope = scope.conj "a"
ns = Rake::NameSpace.new mgr, scope

View File

@ -1,21 +1,21 @@
require File.expand_path('../helper', __FILE__)
require 'rake/packagetask'
require File.expand_path("../helper", __FILE__)
require "rake/packagetask"
class TestRakePackageTask < Rake::TestCase
def test_initialize
touch 'install.rb'
touch 'a.c'
touch 'b.c'
mkdir 'CVS'
touch 'a.rb~'
touch "install.rb"
touch "a.c"
touch "b.c"
mkdir "CVS"
touch "a.rb~"
pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
p.package_files << "install.rb"
p.package_files.include '*.c'
p.package_files.include "*.c"
p.package_files.exclude(/\bCVS\b/)
p.package_files.exclude(/~$/)
p.package_dir = 'pkg'
p.package_dir = "pkg"
p.need_tar = true
p.need_tar_gz = true
p.need_tar_bz2 = true
@ -25,34 +25,34 @@ class TestRakePackageTask < Rake::TestCase
assert_equal "pkg", pkg.package_dir
assert_includes pkg.package_files, 'a.c'
assert_includes pkg.package_files, "a.c"
assert_equal 'pkgr', pkg.name
assert_equal '1.2.3', pkg.version
assert_equal "pkgr", pkg.name
assert_equal "1.2.3", pkg.version
assert Rake::Task[:package]
assert Rake::Task['pkg/pkgr-1.2.3.tgz']
assert Rake::Task['pkg/pkgr-1.2.3.tar.gz']
assert Rake::Task['pkg/pkgr-1.2.3.tar.bz2']
assert Rake::Task['pkg/pkgr-1.2.3.tar.xz']
assert Rake::Task['pkg/pkgr-1.2.3.zip']
assert Rake::Task['pkg/pkgr-1.2.3']
assert Rake::Task["pkg/pkgr-1.2.3.tgz"]
assert Rake::Task["pkg/pkgr-1.2.3.tar.gz"]
assert Rake::Task["pkg/pkgr-1.2.3.tar.bz2"]
assert Rake::Task["pkg/pkgr-1.2.3.tar.xz"]
assert Rake::Task["pkg/pkgr-1.2.3.zip"]
assert Rake::Task["pkg/pkgr-1.2.3"]
assert Rake::Task[:clobber_package]
assert Rake::Task[:repackage]
end
def test_initialize_no_version
e = assert_raises RuntimeError do
Rake::PackageTask.new 'pkgr'
Rake::PackageTask.new "pkgr"
end
assert_equal 'Version required (or :noversion)', e.message
assert_equal "Version required (or :noversion)", e.message
end
def test_initialize_noversion
pkg = Rake::PackageTask.new 'pkgr', :noversion
pkg = Rake::PackageTask.new "pkgr", :noversion
assert_equal 'pkg', pkg.package_dir
assert_equal 'pkgr', pkg.name
assert_equal "pkg", pkg.package_dir
assert_equal "pkgr", pkg.name
assert_equal nil, pkg.version
end
@ -66,15 +66,15 @@ class TestRakePackageTask < Rake::TestCase
end
def test_package_name
pkg = Rake::PackageTask.new 'a', '1'
pkg = Rake::PackageTask.new "a", "1"
assert_equal 'a-1', pkg.package_name
assert_equal "a-1", pkg.package_name
end
def test_package_name_noversion
pkg = Rake::PackageTask.new 'a', :noversion
pkg = Rake::PackageTask.new "a", :noversion
assert_equal 'a', pkg.package_name
assert_equal "a", pkg.package_name
end
end

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakePathMap < Rake::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakePathMapExplode < Rake::TestCase
def setup
@ -14,20 +14,20 @@ class TestRakePathMapExplode < Rake::TestCase
end
def test_explode
assert_equal ['a'], 'a'.pathmap_explode
assert_equal ['a', 'b'], 'a/b'.pathmap_explode
assert_equal ['a', 'b', 'c'], 'a/b/c'.pathmap_explode
assert_equal ['/', 'a'], '/a'.pathmap_explode
assert_equal ['/', 'a', 'b'], '/a/b'.pathmap_explode
assert_equal ['/', 'a', 'b', 'c'], '/a/b/c'.pathmap_explode
assert_equal ["a"], "a".pathmap_explode
assert_equal ["a", "b"], "a/b".pathmap_explode
assert_equal ["a", "b", "c"], "a/b/c".pathmap_explode
assert_equal ["/", "a"], "/a".pathmap_explode
assert_equal ["/", "a", "b"], "/a/b".pathmap_explode
assert_equal ["/", "a", "b", "c"], "/a/b/c".pathmap_explode
if File::ALT_SEPARATOR
assert_equal ['c:.', 'a'], 'c:a'.pathmap_explode
assert_equal ['c:.', 'a', 'b'], 'c:a/b'.pathmap_explode
assert_equal ['c:.', 'a', 'b', 'c'], 'c:a/b/c'.pathmap_explode
assert_equal ['c:/', 'a'], 'c:/a'.pathmap_explode
assert_equal ['c:/', 'a', 'b'], 'c:/a/b'.pathmap_explode
assert_equal ['c:/', 'a', 'b', 'c'], 'c:/a/b/c'.pathmap_explode
assert_equal ["c:.", "a"], "c:a".pathmap_explode
assert_equal ["c:.", "a", "b"], "c:a/b".pathmap_explode
assert_equal ["c:.", "a", "b", "c"], "c:a/b/c".pathmap_explode
assert_equal ["c:/", "a"], "c:/a".pathmap_explode
assert_equal ["c:/", "a", "b"], "c:/a/b".pathmap_explode
assert_equal ["c:/", "a", "b", "c"], "c:/a/b/c".pathmap_explode
end
end
end

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakePathMapPartial < Rake::TestCase
def test_pathmap_partial

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'rake/ext/pathname'
require File.expand_path("../helper", __FILE__)
require "rake/ext/pathname"
class TestRakePathnameExtensions < Rake::TestCase
def test_ext_works_on_pathnames

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakePseudoStatus < Rake::TestCase
def test_with_zero_exit_status

View File

@ -1,16 +1,16 @@
require File.expand_path('../helper', __FILE__)
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'
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(@rake_lib, 'rake/rake_test_loader.rb')
load File.join(@rake_lib, "rake/rake_test_loader.rb")
assert_equal %w[-v], ARGV
ensure

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'open3'
require File.expand_path("../helper", __FILE__)
require "open3"
class TestRakeReduceCompat < Rake::TestCase
include RubyRunner

View File

@ -1,9 +1,9 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeRequire < Rake::TestCase
def setup
super
$LOAD_PATH.unshift '.' if jruby17?
$LOAD_PATH.unshift "." if jruby17?
end
def test_can_load_rake_library
@ -11,7 +11,7 @@ class TestRakeRequire < Rake::TestCase
app = Rake::Application.new
assert app.instance_eval {
rake_require("test2", ['rakelib'], [])
rake_require("test2", ["rakelib"], [])
}
end
@ -19,7 +19,7 @@ class TestRakeRequire < Rake::TestCase
rakefile_rakelib
app = Rake::Application.new
paths = ['rakelib']
paths = ["rakelib"]
loaded_files = []
app.rake_require("test2", paths, loaded_files)
@ -34,7 +34,7 @@ class TestRakeRequire < Rake::TestCase
app = Rake::Application.new
ex = assert_raises(LoadError) {
assert app.instance_eval {
rake_require("testx", ['rakelib'], [])
rake_require("testx", ["rakelib"], [])
}
}
assert_match(/(can *not|can't)\s+find/i, ex.message)

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
require File.expand_path("../helper", __FILE__)
require "fileutils"
class TestRakeRules < Rake::TestCase
include Rake
@ -22,8 +22,8 @@ class TestRakeRules < Rake::TestCase
create_file(FTNFILE)
delete_file(SRCFILE)
delete_file(OBJFILE)
rule(/\.o$/ => ['.c']) do @runs << :C end
rule(/\.o$/ => ['.f']) do @runs << :F end
rule(/\.o$/ => [".c"]) do @runs << :C end
rule(/\.o$/ => [".f"]) do @runs << :F end
t = Task[OBJFILE]
t.invoke
Task[OBJFILE].invoke
@ -34,15 +34,15 @@ class TestRakeRules < Rake::TestCase
create_file(FTNFILE)
delete_file(SRCFILE)
delete_file(OBJFILE)
rule(/\.o$/ => ['.f']) do @runs << :F end
rule(/\.o$/ => ['.c']) do @runs << :C end
rule(/\.o$/ => [".f"]) do @runs << :F end
rule(/\.o$/ => [".c"]) do @runs << :C end
Task[OBJFILE].invoke
assert_equal [:F], @runs
end
def test_create_with_source
create_file(SRCFILE)
rule(/\.o$/ => ['.c']) do |t|
rule(/\.o$/ => [".c"]) do |t|
@runs << t.name
assert_equal OBJFILE, t.name
assert_equal SRCFILE, t.source
@ -53,7 +53,7 @@ class TestRakeRules < Rake::TestCase
def test_single_dependent
create_file(SRCFILE)
rule(/\.o$/ => '.c') do |t|
rule(/\.o$/ => ".c") do |t|
@runs << t.name
end
Task[OBJFILE].invoke
@ -62,7 +62,7 @@ class TestRakeRules < Rake::TestCase
def test_rule_can_be_created_by_string
create_file(SRCFILE)
rule '.o' => ['.c'] do |t|
rule ".o" => [".c"] do |t|
@runs << t.name
end
Task[OBJFILE].invoke
@ -71,7 +71,7 @@ class TestRakeRules < Rake::TestCase
def test_rule_prereqs_can_be_created_by_string
create_file(SRCFILE)
rule '.o' => '.c' do |t|
rule ".o" => ".c" do |t|
@runs << t.name
end
Task[OBJFILE].invoke
@ -80,7 +80,7 @@ class TestRakeRules < Rake::TestCase
def test_plain_strings_as_dependents_refer_to_files
create_file(SRCFILE)
rule '.o' => SRCFILE do |t|
rule ".o" => SRCFILE do |t|
@runs << t.name
end
Task[OBJFILE].invoke
@ -89,8 +89,8 @@ class TestRakeRules < Rake::TestCase
def test_file_names_beginning_with_dot_can_be_tricked_into_referring_to_file
verbose(false) do
create_file('.foo')
rule '.o' => "./.foo" do |t|
create_file(".foo")
rule ".o" => "./.foo" do |t|
@runs << t.name
end
Task[OBJFILE].invoke
@ -102,7 +102,7 @@ class TestRakeRules < Rake::TestCase
verbose(false) do
create_file(".foo")
rule '.o' => lambda { ".foo" } do |t|
rule ".o" => lambda { ".foo" } do |t|
@runs << "#{t.name} - #{t.source}"
end
Task[OBJFILE].invoke
@ -113,7 +113,7 @@ class TestRakeRules < Rake::TestCase
def test_file_names_containing_percent_can_be_wrapped_in_lambda
verbose(false) do
create_file("foo%x")
rule '.o' => lambda { "foo%x" } do |t|
rule ".o" => lambda { "foo%x" } do |t|
@runs << "#{t.name} - #{t.source}"
end
Task[OBJFILE].invoke
@ -124,7 +124,7 @@ class TestRakeRules < Rake::TestCase
def test_non_extension_rule_name_refers_to_file
verbose(false) do
create_file("abc.c")
rule "abc" => '.c' do |t|
rule "abc" => ".c" do |t|
@runs << t.name
end
Task["abc"].invoke
@ -135,7 +135,7 @@ class TestRakeRules < Rake::TestCase
def test_pathmap_automatically_applies_to_name
verbose(false) do
create_file("zzabc.c")
rule ".o" => 'zz%{x,a}n.c' do |t|
rule ".o" => "zz%{x,a}n.c" do |t|
@runs << "#{t.name} - #{t.source}"
end
Task["xbc.o"].invoke
@ -146,7 +146,7 @@ class TestRakeRules < Rake::TestCase
def test_plain_strings_are_just_filenames
verbose(false) do
create_file("plainname")
rule ".o" => 'plainname' do |t|
rule ".o" => "plainname" do |t|
@runs << "#{t.name} - #{t.source}"
end
Task["xbc.o"].invoke
@ -158,7 +158,7 @@ class TestRakeRules < Rake::TestCase
create_file(SRCFILE)
create_file(SRCFILE2)
delete_file(OBJFILE)
rule '.o' => '.c' do |t|
rule ".o" => ".c" do |t|
@runs << t.source
end
file OBJFILE => [SRCFILE2]
@ -168,16 +168,16 @@ class TestRakeRules < Rake::TestCase
def test_close_matches_on_name_do_not_trigger_rule
create_file("x.c")
rule '.o' => ['.c'] do |t|
rule ".o" => [".c"] do |t|
@runs << t.name
end
assert_raises(RuntimeError) { Task['x.obj'].invoke }
assert_raises(RuntimeError) { Task['x.xyo'].invoke }
assert_raises(RuntimeError) { Task["x.obj"].invoke }
assert_raises(RuntimeError) { Task["x.xyo"].invoke }
end
def test_rule_rebuilds_obj_when_source_is_newer
create_timed_files(OBJFILE, SRCFILE)
rule(/\.o$/ => ['.c']) do
rule(/\.o$/ => [".c"]) do
@runs << :RULE
end
Task[OBJFILE].invoke
@ -204,15 +204,15 @@ class TestRakeRules < Rake::TestCase
end
def test_rule_with_two_sources_builds_both_sources
task 'x.aa'
task 'x.bb'
rule '.a' => '.aa' do
task "x.aa"
task "x.bb"
rule ".a" => ".aa" do
@runs << "A"
end
rule '.b' => '.bb' do
rule ".b" => ".bb" do
@runs << "B"
end
rule ".c" => ['.a', '.b'] do
rule ".c" => [".a", ".b"] do
@runs << "C"
end
Task["x.c"].invoke
@ -262,11 +262,11 @@ class TestRakeRules < Rake::TestCase
rule %r(classes/.*\.class) => [
proc { |fn| fn.pathmap("%{classes,src}d/%n.java") }
] do |task|
assert_equal task.name, 'classes/jw/X.class'
assert_equal task.source, 'src/jw/X.java'
assert_equal task.name, "classes/jw/X.class"
assert_equal task.source, "src/jw/X.java"
@runs << :RULE
end
Task['classes/jw/X.class'].invoke
Task["classes/jw/X.class"].invoke
assert_equal [:RULE], @runs
ensure
rm_r("src", verbose: false) rescue nil
@ -276,11 +276,11 @@ class TestRakeRules < Rake::TestCase
ran = false
mkdir_p("flatten")
create_file("flatten/a.txt")
task 'flatten/b.data' do |t|
task "flatten/b.data" do |t|
ran = true
touch t.name, verbose: false
end
rule '.html' =>
rule ".html" =>
proc { |fn|
[
fn.ext("txt"),
@ -288,7 +288,7 @@ class TestRakeRules < Rake::TestCase
]
} do |task|
end
Task['flatten/a.html'].invoke
Task["flatten/a.html"].invoke
assert ran, "Should have triggered flattened dependency"
ensure
rm_r("flatten", verbose: false) rescue nil
@ -297,18 +297,18 @@ class TestRakeRules < Rake::TestCase
def test_recursive_rules_will_work_as_long_as_they_terminate
actions = []
create_file("abc.xml")
rule '.y' => '.xml' do actions << 'y' end
rule '.c' => '.y' do actions << 'c'end
rule '.o' => '.c' do actions << 'o'end
rule '.exe' => '.o' do actions << 'exe'end
rule ".y" => ".xml" do actions << "y" end
rule ".c" => ".y" do actions << "c"end
rule ".o" => ".c" do actions << "o"end
rule ".exe" => ".o" do actions << "exe"end
Task["abc.exe"].invoke
assert_equal ['y', 'c', 'o', 'exe'], actions
assert_equal ["y", "c", "o", "exe"], actions
end
def test_recursive_rules_that_dont_terminate_will_overflow
create_file("a.a")
prev = 'a'
('b'..'z').each do |letter|
prev = "a"
("b".."z").each do |letter|
rule ".#{letter}" => ".#{prev}" do |t| puts "#{t.name}" end
prev = letter
end
@ -320,43 +320,43 @@ class TestRakeRules < Rake::TestCase
def test_rules_with_bad_dependents_will_fail
rule "a" => [1] do |t| puts t.name end
assert_raises(RuntimeError) do Task['a'].invoke end
assert_raises(RuntimeError) do Task["a"].invoke end
end
def test_string_rule_with_args
delete_file(OBJFILE)
create_file(SRCFILE)
rule '.o', [:a] => SRCFILE do |t, args|
assert_equal 'arg', args.a
rule ".o", [:a] => SRCFILE do |t, args|
assert_equal "arg", args.a
end
Task[OBJFILE].invoke('arg')
Task[OBJFILE].invoke("arg")
end
def test_regex_rule_with_args
delete_file(OBJFILE)
create_file(SRCFILE)
rule(/.o$/, [:a] => SRCFILE) do |t, args|
assert_equal 'arg', args.a
assert_equal "arg", args.a
end
Task[OBJFILE].invoke('arg')
Task[OBJFILE].invoke("arg")
end
def test_string_rule_with_args_and_lambda_prereq
delete_file(OBJFILE)
create_file(SRCFILE)
rule '.o', [:a] => [lambda{SRCFILE}]do |t, args|
assert_equal 'arg', args.a
rule ".o", [:a] => [lambda{SRCFILE}]do |t, args|
assert_equal "arg", args.a
end
Task[OBJFILE].invoke('arg')
Task[OBJFILE].invoke("arg")
end
def test_regex_rule_with_args_and_lambda_prereq
delete_file(OBJFILE)
create_file(SRCFILE)
rule(/.o$/, [:a] => [lambda{SRCFILE}]) do |t, args|
assert_equal 'arg', args.a
assert_equal "arg", args.a
end
Task[OBJFILE].invoke('arg')
Task[OBJFILE].invoke("arg")
end
def test_rule_with_method_prereq
@ -365,7 +365,7 @@ class TestRakeRules < Rake::TestCase
def obj.find_prereq
".foo"
end
rule '.o' => obj.method(:find_prereq) do |t|
rule ".o" => obj.method(:find_prereq) do |t|
@runs << "#{t.name} - #{t.source}"
end
Task[OBJFILE].invoke
@ -378,7 +378,7 @@ class TestRakeRules < Rake::TestCase
def obj.find_prereq(task_name)
task_name.ext(".c")
end
rule '.o' => obj.method(:find_prereq) do |t|
rule ".o" => obj.method(:find_prereq) do |t|
@runs << "#{t.name} - #{t.source}"
end
Task[OBJFILE].invoke

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeScope < Rake::TestCase
include Rake

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
require File.expand_path("../helper", __FILE__)
require "fileutils"
class TestRakeTask < Rake::TestCase
include Rake
@ -122,7 +122,7 @@ class TestRakeTask < Rake::TestCase
def test_clear_prerequisites
t = task("t" => ["a", "b"])
assert_equal ['a', 'b'], t.prerequisites
assert_equal ["a", "b"], t.prerequisites
t.clear_prerequisites
assert_equal [], t.prerequisites
end
@ -301,7 +301,7 @@ class TestRakeTask < Rake::TestCase
task :b
task :c
assert_in_delta Time.now, a.timestamp, 0.1, 'computer too slow?'
assert_in_delta Time.now, a.timestamp, 0.1, "computer too slow?"
end
def test_timestamp_returns_latest_prereq_timestamp
@ -313,7 +313,7 @@ class TestRakeTask < Rake::TestCase
def b.timestamp() Time.now + 10 end
def c.timestamp() Time.now + 5 end
assert_in_delta now, a.timestamp, 0.1, 'computer too slow?'
assert_in_delta now, a.timestamp, 0.1, "computer too slow?"
end
def test_always_multitask
@ -336,7 +336,7 @@ class TestRakeTask < Rake::TestCase
t_c.invoke
# task should always run in order
assert_equal ['a', 'b', 'c'], result
assert_equal ["a", "b", "c"], result
[t_a, t_b, t_c].each(&:reenable)
result.clear
@ -345,7 +345,7 @@ class TestRakeTask < Rake::TestCase
t_c.invoke
# with multitask, task 'b' should grab the mutex first
assert_equal ['b', 'a', 'c'], result
assert_equal ["b", "a", "c"], result
end
def test_investigation_output

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeTaskArgumentParsing < Rake::TestCase
def setup
@ -95,21 +95,21 @@ class TestRakeTaskArgumentParsing < Rake::TestCase
end
def test_no_rakeopt
ARGV << '--trace'
ARGV << "--trace"
app = Rake::Application.new
app.init
assert !app.options.silent
end
def test_rakeopt_with_blank_options
ARGV << '--trace'
ARGV << "--trace"
app = Rake::Application.new
app.init
assert !app.options.silent
end
def test_rakeopt_with_silent_options
ENV['RAKEOPT'] = '-s'
ENV["RAKEOPT"] = "-s"
app = Rake::Application.new
app.init

View File

@ -1,10 +1,10 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
######################################################################
class TestRakeTaskArguments < Rake::TestCase
def teardown
ENV.delete('rev')
ENV.delete('VER')
ENV.delete("rev")
ENV.delete("VER")
super
end
@ -20,7 +20,7 @@ class TestRakeTaskArguments < Rake::TestCase
end
def test_blank_values_in_args
ta = Rake::TaskArguments.new([:a, :b, :c], ['', :two, ''])
ta = Rake::TaskArguments.new([:a, :b, :c], ["", :two, ""])
assert_equal({b: :two}, ta.to_hash)
end
@ -69,15 +69,15 @@ class TestRakeTaskArguments < Rake::TestCase
def test_args_do_not_reference_env_values
ta = Rake::TaskArguments.new(["aa"], [1])
ENV['rev'] = "1.2"
ENV['VER'] = "2.3"
ENV["rev"] = "1.2"
ENV["VER"] = "2.3"
assert_nil ta.rev
assert_nil ta.ver
end
def test_creating_new_argument_scopes
parent = Rake::TaskArguments.new(['p'], [1])
child = parent.new_scope(['c', 'p'])
parent = Rake::TaskArguments.new(["p"], [1])
child = parent.new_scope(["c", "p"])
assert_equal({p: 1}, child.to_hash)
assert_equal 1, child.p
assert_equal 1, child["p"]
@ -86,16 +86,16 @@ class TestRakeTaskArguments < Rake::TestCase
end
def test_child_hides_parent_arg_names
parent = Rake::TaskArguments.new(['aa'], [1])
child = Rake::TaskArguments.new(['aa'], [2], parent)
parent = Rake::TaskArguments.new(["aa"], [1])
child = Rake::TaskArguments.new(["aa"], [2], parent)
assert_equal 2, child.aa
end
def test_default_arguments_values_can_be_merged
ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
ta.with_defaults({ aa: 'default_val' })
assert_equal 'default_val', ta[:aa]
assert_equal 'original_val', ta[:bb]
ta.with_defaults({ aa: "default_val" })
assert_equal "default_val", ta[:aa]
assert_equal "original_val", ta[:bb]
end
def test_default_arguments_that_dont_match_names_are_ignored
@ -109,8 +109,8 @@ class TestRakeTaskArguments < Rake::TestCase
_, args = app.parse_task_string("task[1,two,more]")
ta = Rake::TaskArguments.new([], args)
assert_equal [], ta.names
assert_equal ['1', 'two', 'more'], ta.to_a
assert_equal ['1', 'two', 'more'], ta.extras
assert_equal ["1", "two", "more"], ta.to_a
assert_equal ["1", "two", "more"], ta.extras
end
def test_all_and_extra_arguments_with_named_arguments
@ -120,8 +120,8 @@ class TestRakeTaskArguments < Rake::TestCase
assert_equal [:first, :second], ta.names
assert_equal "1", ta[:first]
assert_equal "two", ta[:second]
assert_equal ['1', 'two', 'more', 'still more'], ta.to_a
assert_equal ['more', 'still more'], ta.extras
assert_equal ["1", "two", "more", "still more"], ta.to_a
assert_equal ["more", "still more"], ta.extras
end
def test_extra_args_with_less_than_named_arguments
@ -132,7 +132,7 @@ class TestRakeTaskArguments < Rake::TestCase
assert_equal "1", ta[:first]
assert_equal "two", ta[:second]
assert_equal nil, ta[:third]
assert_equal ['1', 'two'], ta.to_a
assert_equal ["1", "two"], ta.to_a
assert_equal [], ta.extras
end

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeTaskManager < Rake::TestCase
@ -21,7 +21,7 @@ class TestRakeTaskManager < Rake::TestCase
def test_index
e = assert_raises RuntimeError do
@tm['bad']
@tm["bad"]
end
assert_equal "Don't know how to build task 'bad' (see --tasks)", e.message
@ -41,7 +41,7 @@ class TestRakeTaskManager < Rake::TestCase
end
def test_define_namespaced_task
t = @tm.define_task(Rake::Task, 'n:a:m:e:t')
t = @tm.define_task(Rake::Task, "n:a:m:e:t")
assert_equal Rake::Scope.make("e", "m", "a", "n"), t.scope
assert_equal "n:a:m:e:t", t.name
assert_equal @tm, t.application
@ -50,7 +50,7 @@ class TestRakeTaskManager < Rake::TestCase
def test_define_namespace_in_namespace
t = nil
@tm.in_namespace("n") do
t = @tm.define_task(Rake::Task, 'a:m:e:t')
t = @tm.define_task(Rake::Task, "a:m:e:t")
end
assert_equal Rake::Scope.make("e", "m", "a", "n"), t.scope
assert_equal "n:a:m:e:t", t.name
@ -84,7 +84,7 @@ class TestRakeTaskManager < Rake::TestCase
end
def test_name_lookup_with_implicit_file_tasks
FileUtils.touch 'README.rdoc'
FileUtils.touch "README.rdoc"
t = @tm["README.rdoc"]
@ -141,8 +141,8 @@ class TestRakeTaskManager < Rake::TestCase
assert_equal Rake::Scope.make, @tm.current_scope
assert_equal Rake::Scope.make, xx.scope
assert_equal Rake::Scope.make('a'), aa.scope
assert_equal Rake::Scope.make('b', 'a'), bb.scope
assert_equal Rake::Scope.make("a"), aa.scope
assert_equal Rake::Scope.make("b", "a"), bb.scope
end
def test_lookup_with_explicit_scopes

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeTaskManagerArgumentResolution < Rake::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeTaskWithArguments < Rake::TestCase
include Rake

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'rake/testtask'
require File.expand_path("../helper", __FILE__)
require "rake/testtask"
class TestRakeTestTask < Rake::TestCase
include Rake
@ -8,8 +8,8 @@ class TestRakeTestTask < Rake::TestCase
tt = Rake::TestTask.new do |t| end
refute_nil tt
assert_equal :test, tt.name
assert_equal ['lib'], tt.libs
assert_equal 'test/test*.rb', tt.pattern
assert_equal ["lib"], tt.libs
assert_equal "test/test*.rb", tt.pattern
assert_equal false, tt.verbose
assert_equal true, tt.warning
assert_equal [], tt.deps
@ -33,8 +33,8 @@ class TestRakeTestTask < Rake::TestCase
def test_initialize_override
tt = Rake::TestTask.new(example: :bar) do |t|
t.description = "Run example tests"
t.libs = ['src', 'ext']
t.pattern = 'test/tc_*.rb'
t.libs = ["src", "ext"]
t.pattern = "test/tc_*.rb"
t.warning = true
t.verbose = true
t.deps = [:env]
@ -42,8 +42,8 @@ class TestRakeTestTask < Rake::TestCase
refute_nil tt
assert_equal "Run example tests", tt.description
assert_equal :example, tt.name
assert_equal ['src', 'ext'], tt.libs
assert_equal 'test/tc_*.rb', tt.pattern
assert_equal ["src", "ext"], tt.libs
assert_equal "test/tc_*.rb", tt.pattern
assert_equal true, tt.warning
assert_equal true, tt.verbose
assert_equal [:env], tt.deps
@ -52,14 +52,14 @@ class TestRakeTestTask < Rake::TestCase
end
def test_file_list_env_test
ENV['TEST'] = 'testfile.rb'
ENV["TEST"] = "testfile.rb"
tt = Rake::TestTask.new do |t|
t.pattern = '*'
t.pattern = "*"
end
assert_equal ["testfile.rb"], tt.file_list.to_a
ensure
ENV.delete 'TEST'
ENV.delete "TEST"
end
def test_libs_equals
@ -78,22 +78,22 @@ class TestRakeTestTask < Rake::TestCase
t.warning = false
end
assert_equal '', test_task.ruby_opts_string
assert_equal "", test_task.ruby_opts_string
end
def test_pattern_equals
tt = Rake::TestTask.new do |t|
t.pattern = '*.rb'
t.pattern = "*.rb"
end
assert_equal ['*.rb'], tt.file_list.to_a
assert_equal ["*.rb"], tt.file_list.to_a
end
def test_pattern_equals_test_files_equals
tt = Rake::TestTask.new do |t|
t.test_files = FileList['a.rb', 'b.rb']
t.pattern = '*.rb'
t.test_files = FileList["a.rb", "b.rb"]
t.pattern = "*.rb"
end
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
def test_run_code_direct
@ -105,9 +105,9 @@ class TestRakeTestTask < Rake::TestCase
end
def test_run_code_rake
spec = Gem::Specification.new 'rake', 0
spec.loaded_from = File.join Gem::Specification.dirs.last, 'rake-0.gemspec'
rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], spec
spec = Gem::Specification.new "rake", 0
spec.loaded_from = File.join Gem::Specification.dirs.last, "rake-0.gemspec"
rake, Gem.loaded_specs["rake"] = Gem.loaded_specs["rake"], spec
test_task = Rake::TestTask.new do |t|
t.loader = :rake
@ -115,15 +115,15 @@ class TestRakeTestTask < Rake::TestCase
assert_match(/\A-I".*?" ".*?"\Z/, test_task.run_code)
ensure
Gem.loaded_specs['rake'] = rake
Gem.loaded_specs["rake"] = rake
end
def test_test_files_equals
tt = Rake::TestTask.new do |t|
t.test_files = FileList['a.rb', 'b.rb']
t.test_files = FileList["a.rb", "b.rb"]
end
assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
assert_equal ["a.rb", "b.rb"], tt.file_list.to_a
end
def test_task_prerequisites
@ -131,7 +131,7 @@ class TestRakeTestTask < Rake::TestCase
Rake::TestTask.new child: :parent
task = Rake::Task[:child]
assert_includes task.prerequisites, 'parent'
assert_includes task.prerequisites, "parent"
end
def test_task_prerequisites_multi
@ -140,8 +140,8 @@ class TestRakeTestTask < Rake::TestCase
Rake::TestTask.new child: [:parent, :parent2]
task = Rake::Task[:child]
assert_includes task.prerequisites, 'parent'
assert_includes task.prerequisites, 'parent2'
assert_includes task.prerequisites, "parent"
assert_includes task.prerequisites, "parent2"
end
def test_task_prerequisites_deps
@ -152,6 +152,6 @@ class TestRakeTestTask < Rake::TestCase
end
task = Rake::Task[:child]
assert_includes task.prerequisites, 'parent'
assert_includes task.prerequisites, "parent"
end
end

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'rake/thread_pool'
require File.expand_path("../helper", __FILE__)
require "rake/thread_pool"
class TestRakeTestThreadPool < Rake::TestCase
include Rake

View File

@ -1,4 +1,4 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeTopLevelFunctions < Rake::TestCase
@ -26,19 +26,19 @@ class TestRakeTopLevelFunctions < Rake::TestCase
namespace("xyz", &block)
expected = [
[[:in_namespace, 'xyz'], block]
[[:in_namespace, "xyz"], block]
]
assert_equal expected, @app.called
end
def test_import
import('x', 'y', 'z')
import("x", "y", "z")
expected = [
[[:add_import, 'x'], nil],
[[:add_import, 'y'], nil],
[[:add_import, 'z'], nil],
[[:add_import, "x"], nil],
[[:add_import, "y"], nil],
[[:add_import, "z"], nil],
]
assert_equal expected, @app.called

View File

@ -1,50 +1,50 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
class TestRakeWin32 < Rake::TestCase
Win32 = Rake::Win32
def test_win32_system_dir_uses_home_if_defined
ENV['HOME'] = 'C:\\HP'
ENV["HOME"] = 'C:\\HP'
assert_equal "C:/HP/Rake", Win32.win32_system_dir
end
def test_win32_system_dir_uses_homedrive_homepath_when_no_home_defined
ENV['HOME'] = nil
ENV['HOMEDRIVE'] = 'C:'
ENV['HOMEPATH'] = '\\HP'
ENV["HOME"] = nil
ENV["HOMEDRIVE"] = "C:"
ENV["HOMEPATH"] = '\\HP'
assert_equal "C:/HP/Rake", Win32.win32_system_dir
end
def test_win32_system_dir_uses_appdata_when_no_home_or_home_combo
ENV['APPDATA'] = "C:\\Documents and Settings\\HP\\Application Data"
ENV['HOME'] = nil
ENV['HOMEDRIVE'] = nil
ENV['HOMEPATH'] = nil
ENV["APPDATA"] = "C:\\Documents and Settings\\HP\\Application Data"
ENV["HOME"] = nil
ENV["HOMEDRIVE"] = nil
ENV["HOMEPATH"] = nil
assert_equal "C:/Documents and Settings/HP/Application Data/Rake",
Win32.win32_system_dir
end
def test_win32_system_dir_fallback_to_userprofile_otherwise
ENV['HOME'] = nil
ENV['HOMEDRIVE'] = nil
ENV['HOMEPATH'] = nil
ENV['APPDATA'] = nil
ENV['USERPROFILE'] = "C:\\Documents and Settings\\HP"
ENV["HOME"] = nil
ENV["HOMEDRIVE"] = nil
ENV["HOMEPATH"] = nil
ENV["APPDATA"] = nil
ENV["USERPROFILE"] = "C:\\Documents and Settings\\HP"
assert_equal "C:/Documents and Settings/HP/Rake", Win32.win32_system_dir
end
def test_win32_system_dir_nil_of_no_env_vars
ENV['APPDATA'] = nil
ENV['HOME'] = nil
ENV['HOMEDRIVE'] = nil
ENV['HOMEPATH'] = nil
ENV['RAKE_SYSTEM'] = nil
ENV['USERPROFILE'] = nil
ENV["APPDATA"] = nil
ENV["HOME"] = nil
ENV["HOMEDRIVE"] = nil
ENV["HOMEPATH"] = nil
ENV["RAKE_SYSTEM"] = nil
ENV["USERPROFILE"] = nil
assert_raises(Rake::Win32::Win32HomeError) do
Win32.win32_system_dir
@ -54,15 +54,15 @@ class TestRakeWin32 < Rake::TestCase
def test_win32_backtrace_with_different_case
ex = nil
begin
raise 'test exception'
raise "test exception"
rescue => ex
end
ex.set_backtrace ['abc', 'rakefile']
ex.set_backtrace ["abc", "rakefile"]
rake = Rake::Application.new
rake.options.trace = true
rake.instance_variable_set(:@rakefile, 'Rakefile')
rake.instance_variable_set(:@rakefile, "Rakefile")
_, err = capture_io { rake.display_error_message(ex) }

View File

@ -1,6 +1,6 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path("../helper", __FILE__)
require 'rake/thread_history_display'
require "rake/thread_history_display"
class TestThreadHistoryDisplay < Rake::TestCase
def setup

View File

@ -1,5 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'stringio'
require File.expand_path("../helper", __FILE__)
require "stringio"
class TestTraceOutput < Rake::TestCase
include Rake::TraceOutput