summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 02:34:37 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 02:34:37 +0000
commit4f7a6aafa57bf57ce4b0b5e323548f0a6385d527 (patch)
tree497051dace17ac69043fa6edbb2585f6da03fe24 /test
parent7764dd935737aed303b3d61928ad36f4b67ae8ed (diff)
* lib/rake/*: Updated to rake 0.9.6
* doc/rake/*: ditto * test/rake/*: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/rake/test_rake_directory_task.rb2
-rw-r--r--test/rake/test_rake_functional.rb15
-rw-r--r--test/rake/test_rake_task.rb14
-rw-r--r--test/rake/test_rake_task_with_arguments.rb10
4 files changed, 25 insertions, 16 deletions
diff --git a/test/rake/test_rake_directory_task.rb b/test/rake/test_rake_directory_task.rb
index d1154f90d5..8ae7537b50 100644
--- a/test/rake/test_rake_directory_task.rb
+++ b/test/rake/test_rake_directory_task.rb
@@ -43,7 +43,7 @@ class TestRakeDirectoryTask < Rake::TestCase
runlist = []
t1 = directory("a/b/c" => :t2) { |t| runlist << t.name }
- t2 = task(:t2) { |t| runlist << t.name }
+ task(:t2) { |t| runlist << t.name }
verbose(false) {
t1.invoke
diff --git a/test/rake/test_rake_functional.rb b/test/rake/test_rake_functional.rb
index d540e2ab29..23249b97fb 100644
--- a/test/rake/test_rake_functional.rb
+++ b/test/rake/test_rake_functional.rb
@@ -438,9 +438,10 @@ class TestRakeFunctional < Rake::TestCase
end
def test_failing_test_sets_exit_status
+ skip if uncertain_exit_status?
rakefile_failing_test_task
rake
- assert_equal 1, @exit.exitstatus
+ assert @exit.exitstatus > 0, "should be non-zero"
end
def test_stand_alone_filelist
@@ -449,11 +450,19 @@ class TestRakeFunctional < Rake::TestCase
run_ruby @ruby_options + ["stand_alone_filelist.rb"]
assert_match(/^stand_alone_filelist\.rb$/, @out)
- assert_equal 0, @exit.exitstatus
+ assert_equal 0, @exit.exitstatus unless uncertain_exit_status?
end
private
+ # We are unable to accurately verify that Rake returns a proper
+ # error exit status using popen3 in Ruby 1.8.7 and JRuby. This
+ # predicate function can be used to skip tests or assertions as
+ # needed.
+ def uncertain_exit_status?
+ RUBY_VERSION < "1.9" || defined?(JRUBY_VERSION)
+ end
+
# Run a shell Ruby command with command line options (using the
# default test options). Output is captured in @out and @err
def ruby(*option_list)
@@ -474,9 +483,9 @@ class TestRakeFunctional < Rake::TestCase
inn, out, err, wait = Open3.popen3(RUBY, *option_list)
inn.close
+ @exit = wait ? wait.value : $?
@out = out.read
@err = err.read
- @exit = wait.value
puts "OUTPUT: [#{@out}]" if @verbose
puts "ERROR: [#{@err}]" if @verbose
diff --git a/test/rake/test_rake_task.rb b/test/rake/test_rake_task.rb
index 836e930ee4..7d844ac22b 100644
--- a/test/rake/test_rake_task.rb
+++ b/test/rake/test_rake_task.rb
@@ -40,8 +40,8 @@ class TestRakeTask < Rake::TestCase
def test_invoke
runlist = []
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
- t2 = task(:t2) { |t| runlist << t.name }
- t3 = task(:t3) { |t| runlist << t.name }
+ task(:t2) { |t| runlist << t.name }
+ task(:t3) { |t| runlist << t.name }
assert_equal ["t2", "t3"], t1.prerequisites
t1.invoke
assert_equal ["t2", "t3", "t1"], runlist
@@ -88,8 +88,8 @@ class TestRakeTask < Rake::TestCase
def test_no_double_invoke
runlist = []
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
- t2 = task(:t2 => [:t3]) { |t| runlist << t.name }
- t3 = task(:t3) { |t| runlist << t.name }
+ task(:t2 => [:t3]) { |t| runlist << t.name }
+ task(:t3) { |t| runlist << t.name }
t1.invoke
assert_equal ["t3", "t2", "t1"], runlist
end
@@ -204,7 +204,7 @@ class TestRakeTask < Rake::TestCase
def test_prerequiste_tasks_fails_if_prerequisites_are_undefined
a = task :a => ["b", "c"]
- b = task :b
+ task :b
assert_raises(RuntimeError) do
a.prerequisite_tasks
end
@@ -223,8 +223,8 @@ class TestRakeTask < Rake::TestCase
def test_timestamp_returns_now_if_all_prereqs_have_no_times
a = task :a => ["b", "c"]
- b = task :b
- c = task :c
+ task :b
+ task :c
assert_in_delta Time.now, a.timestamp, 0.1, 'computer too slow?'
end
diff --git a/test/rake/test_rake_task_with_arguments.rb b/test/rake/test_rake_task_with_arguments.rb
index c0fc1b7633..cf4c157256 100644
--- a/test/rake/test_rake_task_with_arguments.rb
+++ b/test/rake/test_rake_task_with_arguments.rb
@@ -45,7 +45,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
def test_illegal_keys_in_task_name_hash
ignore_deprecations do
assert_raises RuntimeError do
- t = task(:t, :x, :y => 1, :needs => [:pre])
+ task(:t, :x, :y => 1, :needs => [:pre])
end
end
end
@@ -136,14 +136,14 @@ class TestRakeTaskWithArguments < Rake::TestCase
def test_named_args_are_passed_to_prereqs
value = nil
- pre = task(:pre, :rev) { |t, args| value = args.rev }
+ task(:pre, :rev) { |t, args| value = args.rev }
t = task(:t, [:name, :rev] => [:pre])
t.invoke("bill", "1.2")
assert_equal "1.2", value
end
def test_args_not_passed_if_no_prereq_names_on_task
- pre = task(:pre) { |t, args|
+ task(:pre) { |t, args|
assert_equal({}, args.to_hash)
assert_equal "bill", args.name
}
@@ -152,7 +152,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
end
def test_args_not_passed_if_no_prereq_names_on_multitask
- pre = task(:pre) { |t, args|
+ task(:pre) { |t, args|
assert_equal({}, args.to_hash)
assert_equal "bill", args.name
}
@@ -161,7 +161,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
end
def test_args_not_passed_if_no_arg_names
- pre = task(:pre, :rev) { |t, args|
+ task(:pre, :rev) { |t, args|
assert_equal({}, args.to_hash)
}
t = task(:t => [:pre])