mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
39da1b6369
commit
3a47cf3395
212 changed files with 846 additions and 846 deletions
|
@ -1,11 +1,11 @@
|
|||
module InEnvironment
|
||||
private
|
||||
|
||||
|
||||
# Create an environment for a test. At the completion of the yielded
|
||||
# block, the environment is restored to its original conditions.
|
||||
def in_environment(settings)
|
||||
original_settings = set_env(settings)
|
||||
yield
|
||||
yield
|
||||
ensure
|
||||
set_env(original_settings) if original_settings
|
||||
end
|
||||
|
|
|
@ -123,7 +123,7 @@ class Rake::TestApplication < Test::Unit::TestCase
|
|||
|
||||
def test_load_rakefile
|
||||
in_environment("PWD" => File.join(BASEDIR, "data/unittest")) do
|
||||
@app.instance_eval do
|
||||
@app.instance_eval do
|
||||
handle_options
|
||||
options.silent = true
|
||||
load_rakefile
|
||||
|
@ -151,8 +151,8 @@ class Rake::TestApplication < Test::Unit::TestCase
|
|||
handle_options
|
||||
options.silent = true
|
||||
end
|
||||
ex = assert_raise(RuntimeError) do
|
||||
@app.instance_eval do raw_load_rakefile end
|
||||
ex = assert_raise(RuntimeError) do
|
||||
@app.instance_eval do raw_load_rakefile end
|
||||
end
|
||||
assert_match(/no rakefile found/i, ex.message)
|
||||
end
|
||||
|
@ -313,7 +313,7 @@ class Rake::TestApplicationOptions < Test::Unit::TestCase
|
|||
RakeFileUtils.verbose_flag = false
|
||||
RakeFileUtils.nowrite_flag = false
|
||||
end
|
||||
|
||||
|
||||
def clear_argv
|
||||
while ! ARGV.empty?
|
||||
ARGV.pop
|
||||
|
@ -519,7 +519,7 @@ class Rake::TestApplicationOptions < Test::Unit::TestCase
|
|||
assert_equal :exit, @exit
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_classic_namespace
|
||||
flags(['--classic-namespace'], ['-C', '-T', '-P', '-n', '-s', '-t']) do |opts|
|
||||
assert opts.classic_namespace
|
||||
|
@ -534,7 +534,7 @@ class Rake::TestApplicationOptions < Test::Unit::TestCase
|
|||
def test_bad_option
|
||||
capture_stderr do
|
||||
ex = assert_raise(OptionParser::InvalidOption) do
|
||||
flags('--bad-option')
|
||||
flags('--bad-option')
|
||||
end
|
||||
if ex.message =~ /^While/ # Ruby 1.9 error message
|
||||
assert_match(/while parsing/i, ex.message)
|
||||
|
@ -549,12 +549,12 @@ class Rake::TestApplicationOptions < Test::Unit::TestCase
|
|||
command_line("a", "b")
|
||||
assert_equal ["a", "b"], @tasks.sort
|
||||
end
|
||||
|
||||
|
||||
def test_default_task_collection
|
||||
command_line()
|
||||
assert_equal ["default"], @tasks
|
||||
end
|
||||
|
||||
|
||||
def test_environment_definition
|
||||
ENV.delete('TESTKEY')
|
||||
command_line("a", "TESTKEY=12")
|
||||
|
@ -562,12 +562,12 @@ class Rake::TestApplicationOptions < Test::Unit::TestCase
|
|||
assert '12', ENV['TESTKEY']
|
||||
end
|
||||
|
||||
private
|
||||
private
|
||||
|
||||
def flags(*sets)
|
||||
sets.each do |set|
|
||||
ARGV.clear
|
||||
@out = capture_stdout {
|
||||
@out = capture_stdout {
|
||||
@exit = catch(:system_exit) { opts = command_line(*set) }
|
||||
}
|
||||
yield(@app.options) if block_given?
|
||||
|
@ -593,31 +593,31 @@ class Rake::TestTaskArgumentParsing < Test::Unit::TestCase
|
|||
def setup
|
||||
@app = Rake::Application.new
|
||||
end
|
||||
|
||||
|
||||
def test_name_only
|
||||
name, args = @app.parse_task_string("name")
|
||||
assert_equal "name", name
|
||||
assert_equal [], args
|
||||
end
|
||||
|
||||
|
||||
def test_empty_args
|
||||
name, args = @app.parse_task_string("name[]")
|
||||
assert_equal "name", name
|
||||
assert_equal [], args
|
||||
end
|
||||
|
||||
|
||||
def test_one_argument
|
||||
name, args = @app.parse_task_string("name[one]")
|
||||
assert_equal "name", name
|
||||
assert_equal ["one"], args
|
||||
end
|
||||
|
||||
|
||||
def test_two_arguments
|
||||
name, args = @app.parse_task_string("name[one,two]")
|
||||
assert_equal "name", name
|
||||
assert_equal ["one", "two"], args
|
||||
end
|
||||
|
||||
|
||||
def test_can_handle_spaces_between_args
|
||||
name, args = @app.parse_task_string("name[one, two,\tthree , \tfour]")
|
||||
assert_equal "name", name
|
||||
|
|
|
@ -6,7 +6,7 @@ require_relative 'filecreation'
|
|||
######################################################################
|
||||
class Rake::TestDefinitions < Test::Unit::TestCase
|
||||
include Rake
|
||||
|
||||
|
||||
EXISTINGFILE = "testdata/existing"
|
||||
|
||||
def setup
|
||||
|
@ -78,4 +78,4 @@ class Rake::TestDefinitions < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class Rake::TestEarlyTime < Test::Unit::TestCase
|
|||
assert t1 < t2
|
||||
assert t2 > t1
|
||||
assert t1 == t1
|
||||
assert t2 == t2
|
||||
assert t2 == t2
|
||||
end
|
||||
|
||||
def test_to_s
|
||||
|
|
|
@ -16,14 +16,14 @@ class Rake::TestExtension < Test::Unit::TestCase
|
|||
$stderr = old_err
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class Sample
|
||||
extend Redirect
|
||||
|
||||
def duplicate_method
|
||||
:original
|
||||
end
|
||||
|
||||
|
||||
OK_ERRS = error_redirect do
|
||||
rake_extension("a") do
|
||||
def ok_method
|
||||
|
|
|
@ -77,7 +77,7 @@ class Rake::TestFileTask < Test::Unit::TestCase
|
|||
# deleting the file target on failure is always the proper thing to
|
||||
# do. I'm willing to hear input on this topic.
|
||||
def ztest_file_deletes_on_failure
|
||||
task :obj
|
||||
task :obj
|
||||
file NEWFILE => [:obj] do |t|
|
||||
FileUtils.touch NEWFILE
|
||||
fail "Ooops"
|
||||
|
|
|
@ -89,7 +89,7 @@ class Rake::TestFileList < Test::Unit::TestCase
|
|||
h = f.include("y")
|
||||
assert_equal f.object_id, h.object_id
|
||||
end
|
||||
|
||||
|
||||
def test_match
|
||||
fl = FileList.new
|
||||
fl.include(File.expand_path('../test*.rb', __FILE__))
|
||||
|
@ -155,7 +155,7 @@ class Rake::TestFileList < Test::Unit::TestCase
|
|||
fl.exclude('testdata/existing')
|
||||
assert_equal [], fl
|
||||
end
|
||||
|
||||
|
||||
def test_excluding_via_block
|
||||
fl = FileList['testdata/a.c', 'testdata/b.c', 'testdata/xyz.c']
|
||||
fl.exclude { |fn| fn.pathmap('%n') == 'xyz' }
|
||||
|
@ -235,24 +235,24 @@ class Rake::TestFileList < Test::Unit::TestCase
|
|||
assert_equal ["testdata/abc.o", "testdata/x.o", "testdata/xyz.o"].sort,
|
||||
f3.sort
|
||||
end
|
||||
|
||||
|
||||
def test_claim_to_be_a_kind_of_array
|
||||
fl = FileList['testdata/*.c']
|
||||
assert fl.is_a?(Array)
|
||||
assert fl.kind_of?(Array)
|
||||
end
|
||||
|
||||
|
||||
def test_claim_to_be_a_kind_of_filelist
|
||||
fl = FileList['testdata/*.c']
|
||||
assert fl.is_a?(FileList)
|
||||
assert fl.kind_of?(FileList)
|
||||
end
|
||||
|
||||
|
||||
def test_claim_to_be_a_filelist_instance
|
||||
fl = FileList['testdata/*.c']
|
||||
assert fl.instance_of?(FileList)
|
||||
end
|
||||
|
||||
|
||||
def test_dont_claim_to_be_an_array_instance
|
||||
fl = FileList['testdata/*.c']
|
||||
assert ! fl.instance_of?(Array)
|
||||
|
@ -590,12 +590,12 @@ class Rake::TestFileList < Test::Unit::TestCase
|
|||
assert_equal ['b', 'd'], r
|
||||
assert_equal FileList, r.class
|
||||
end
|
||||
|
||||
|
||||
def test_file_utils_can_use_filelists
|
||||
cfiles = FileList['testdata/*.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'))
|
||||
|
@ -603,7 +603,7 @@ class Rake::TestFileList < Test::Unit::TestCase
|
|||
|
||||
def create_test_data
|
||||
verbose(false) do
|
||||
|
||||
|
||||
mkdir "testdata" unless File.exist? "testdata"
|
||||
mkdir "testdata/CVS" rescue nil
|
||||
mkdir "testdata/.svn" rescue nil
|
||||
|
@ -621,5 +621,5 @@ class Rake::TestFileList < Test::Unit::TestCase
|
|||
touch "testdata/existing"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ class Rake::TestFileUtils < Test::Unit::TestCase
|
|||
@oldruby = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def teardown
|
||||
FileUtils.rm_rf("testdata")
|
||||
FileUtils::LN_SUPPORTED[0] = true
|
||||
|
@ -28,7 +28,7 @@ class Rake::TestFileUtils < Test::Unit::TestCase
|
|||
FileUtils.class_eval {const_set(:RUBY, ruby)}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_rm_one_file
|
||||
create_file("testdata/a")
|
||||
FileUtils.rm_rf "testdata/a"
|
||||
|
@ -165,7 +165,7 @@ class Rake::TestFileUtils < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_sh_failure
|
||||
assert_raise(RuntimeError) {
|
||||
assert_raise(RuntimeError) {
|
||||
verbose(false) { Sh.run "#{RUBY} #{File.expand_path('../shellcommand.rb', __FILE__)} 1" }
|
||||
}
|
||||
end
|
||||
|
@ -241,7 +241,7 @@ class Rake::TestFileUtils < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
def redirect_stderr
|
||||
old_err = $stderr
|
||||
$stderr = StringIO.new
|
||||
|
@ -258,5 +258,5 @@ class Rake::TestFileUtils < Test::Unit::TestCase
|
|||
def env_var
|
||||
windows? ? '%RAKE_TEST_SH%' : '$RAKE_TEST_SH'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -40,4 +40,4 @@ class Rake::TestMultiTask < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class Rake::TestPathMap < Test::Unit::TestCase
|
|||
|
||||
def test_n_returns_basename_without_extension
|
||||
assert_equal "abc", "abc.rb".pathmap("%n")
|
||||
assert_equal "abc", "abc".pathmap("%n")
|
||||
assert_equal "abc", "abc".pathmap("%n")
|
||||
assert_equal "abc", "this/is/a/dir/abc.rb".pathmap("%n")
|
||||
assert_equal "abc", "/this/is/a/dir/abc.rb".pathmap("%n")
|
||||
assert_equal "abc", "/this/is/a/dir/abc".pathmap("%n")
|
||||
|
|
|
@ -35,5 +35,5 @@ class Rake::TestRake < Test::Unit::TestCase
|
|||
def test_original_dir_reports_current_dir
|
||||
assert_equal Dir.pwd, Rake.original_dir
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -76,7 +76,7 @@ class Rake::TestTaskArguments < Test::Unit::TestCase
|
|||
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' })
|
||||
|
|
|
@ -135,7 +135,7 @@ class Rake::TestTaskManager < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
assert_equal t1, @tm[:t, []]
|
||||
assert_equal t2, @tm[:t, ["a"]]
|
||||
assert_equal t2, @tm[:t, ["a"]]
|
||||
assert_equal t3, @tm[:t, ["a", "b"]]
|
||||
assert_equal s, @tm[:s, ["a", "b"]]
|
||||
assert_equal s, @tm[:s, ["a"]]
|
||||
|
@ -153,7 +153,7 @@ class Rake::TestTaskManager < Test::Unit::TestCase
|
|||
@tm["a:x"].invoke
|
||||
assert_equal ["next z"], values
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
class Rake::TestTaskManagerArgumentResolution < Test::Unit::TestCase
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'rake/testtask'
|
|||
|
||||
class Rake::TestTestTask < Test::Unit::TestCase
|
||||
include Rake
|
||||
|
||||
|
||||
def setup
|
||||
@oldwd = Dir.pwd
|
||||
@tmpwd = Dir.mktmpdir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue