summaryrefslogtreecommitdiff
path: root/test/rake
diff options
context:
space:
mode:
Diffstat (limited to 'test/rake')
-rw-r--r--test/rake/helper.rb4
-rw-r--r--test/rake/support/rakefile_definitions.rb2
-rw-r--r--test/rake/test_rake_application.rb22
-rw-r--r--test/rake/test_rake_definitions.rb5
-rw-r--r--test/rake/test_rake_file_task.rb12
-rw-r--r--test/rake/test_rake_late_time.rb18
-rw-r--r--test/rake/test_rake_thread_pool.rb1
7 files changed, 41 insertions, 23 deletions
diff --git a/test/rake/helper.rb b/test/rake/helper.rb
index 526eb306fe..ac1205a642 100644
--- a/test/rake/helper.rb
+++ b/test/rake/helper.rb
@@ -2,7 +2,7 @@ require 'rubygems'
$:.unshift File.expand_path('../../lib', __FILE__)
begin
- gem 'minitest', '~> 4'
+ gem 'minitest', '~> 5'
rescue Gem::LoadError
end
@@ -21,7 +21,7 @@ rescue NoMethodError, LoadError
require 'test/support/rakefile_definitions'
end
-class Rake::TestCase < MiniTest::Unit::TestCase
+class Rake::TestCase < Minitest::Test
include FileCreation
include Rake::DSL
diff --git a/test/rake/support/rakefile_definitions.rb b/test/rake/support/rakefile_definitions.rb
index d4311425f1..a637c7e943 100644
--- a/test/rake/support/rakefile_definitions.rb
+++ b/test/rake/support/rakefile_definitions.rb
@@ -460,7 +460,7 @@ end
TEST_TASK
open 'a_test.rb', 'w' do |io|
io << "require 'minitest/autorun'\n"
- io << "class ExitTaskTest < MiniTest::Unit::TestCase\n"
+ io << "class ExitTaskTest < Minitest::Test\n"
io << " def test_exit\n"
io << " assert false, 'this should fail'\n"
io << " end\n"
diff --git a/test/rake/test_rake_application.rb b/test/rake/test_rake_application.rb
index f52040471b..19e5005989 100644
--- a/test/rake/test_rake_application.rb
+++ b/test/rake/test_rake_application.rb
@@ -10,9 +10,9 @@ class TestRakeApplication < Rake::TestCase
end
def setup_command_line(*options)
- ARGV.clear
+ @app.argv.clear
options.each do |option|
- ARGV << option
+ @app.argv << option
end
end
@@ -268,7 +268,7 @@ class TestRakeApplication < Rake::TestCase
end
def test_load_rakefile_not_found
- ARGV.clear
+ @app.argv.clear
Dir.chdir @tempdir
ENV['RAKE_SYSTEM'] = 'not_exist'
@@ -378,7 +378,7 @@ class TestRakeApplication < Rake::TestCase
@app.handle_options
- assert !ARGV.include?(valid_option)
+ assert !@app.argv.include?(valid_option)
assert @app.options.trace
end
@@ -406,14 +406,14 @@ class TestRakeApplication < Rake::TestCase
setup_command_line("--trace", "sometask")
@app.handle_options
- assert ARGV.include?("sometask")
+ assert @app.argv.include?("sometask")
assert @app.options.trace
end
def test_good_run
ran = false
- ARGV << '--rakelib=""'
+ @app.argv << '--rakelib=""'
@app.options.silent = true
@@ -468,7 +468,7 @@ class TestRakeApplication < Rake::TestCase
}
assert_match(/see full trace/i, err)
ensure
- ARGV.clear
+ @app.argv.clear
end
def test_bad_run_with_trace
@@ -479,7 +479,7 @@ class TestRakeApplication < Rake::TestCase
}
refute_match(/see full trace/i, err)
ensure
- ARGV.clear
+ @app.argv.clear
end
def test_bad_run_with_backtrace
@@ -492,7 +492,7 @@ class TestRakeApplication < Rake::TestCase
}
refute_match(/see full trace/, err)
ensure
- ARGV.clear
+ @app.argv.clear
end
CustomError = Class.new(RuntimeError)
@@ -549,7 +549,7 @@ class TestRakeApplication < Rake::TestCase
end
assert_match(/Secondary Error/, err)
ensure
- ARGV.clear
+ @app.argv.clear
end
def test_run_with_bad_options
@@ -559,7 +559,7 @@ class TestRakeApplication < Rake::TestCase
capture_io { @app.run }
}
ensure
- ARGV.clear
+ @app.argv.clear
end
def test_standard_exception_handling_invalid_option
diff --git a/test/rake/test_rake_definitions.rb b/test/rake/test_rake_definitions.rb
index 4b2de9d1d2..ee474cb7c8 100644
--- a/test/rake/test_rake_definitions.rb
+++ b/test/rake/test_rake_definitions.rb
@@ -59,6 +59,11 @@ class TestRakeDefinitions < Rake::TestCase
assert_raises(RuntimeError) { Task[:x].invoke }
end
+ def test_falsey_dependencies
+ task :x => nil
+ assert_equal [], Task[:x].prerequisites
+ end
+
def test_implicit_file_dependencies
runs = []
create_existing_file
diff --git a/test/rake/test_rake_file_task.rb b/test/rake/test_rake_file_task.rb
index a6a9fa2c51..a249511442 100644
--- a/test/rake/test_rake_file_task.rb
+++ b/test/rake/test_rake_file_task.rb
@@ -24,6 +24,7 @@ class TestRakeFileTask < Rake::TestCase
File.delete(ftask.name) rescue nil
assert ftask.needed?, "file should be needed"
+ assert_equal Rake::LATE, ftask.timestamp
open(ftask.name, "w") { |f| f.puts "HI" }
@@ -84,19 +85,14 @@ class TestRakeFileTask < Rake::TestCase
end
def test_existing_file_depends_on_non_existing_file
- @ran = false
-
create_file(OLDFILE)
delete_file(NEWFILE)
- file NEWFILE do
- @ran = true
- end
-
- file OLDFILE => NEWFILE
+ file NEWFILE do |t| @runs << t.name end
+ file OLDFILE => NEWFILE do |t| @runs << t.name end
Task[OLDFILE].invoke
- assert @ran
+ assert_equal [NEWFILE, OLDFILE], @runs
end
def test_needed_eh_build_all
diff --git a/test/rake/test_rake_late_time.rb b/test/rake/test_rake_late_time.rb
new file mode 100644
index 0000000000..4b910a7085
--- /dev/null
+++ b/test/rake/test_rake_late_time.rb
@@ -0,0 +1,18 @@
+require File.expand_path('../helper', __FILE__)
+
+class TestRakeLateTime < Rake::TestCase
+ def test_late_time_comparisons
+ late = Rake::LATE
+ assert_equal late, late
+ assert late >= Time.now
+ assert late > Time.now
+ assert late != Time.now
+ assert Time.now < late
+ assert Time.now <= late
+ assert Time.now != late
+ end
+
+ def test_to_s
+ assert_equal '<LATE TIME>', Rake::LATE.to_s
+ end
+end
diff --git a/test/rake/test_rake_thread_pool.rb b/test/rake/test_rake_thread_pool.rb
index 421c38d90d..35a1fe9d1c 100644
--- a/test/rake/test_rake_thread_pool.rb
+++ b/test/rake/test_rake_thread_pool.rb
@@ -1,6 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'rake/thread_pool'
-require 'test/unit/assertions'
class TestRakeTestThreadPool < Rake::TestCase
include Rake