This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
forked from ruby/rake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'reduce-compat-option' of git://github.com/quix/rake int…
…o reduce-compat-option * 'reduce-compat-option' of git://github.com/quix/rake: new --reduce-compat option removes Module#const_missing and DeprecatedObjectDSL
- Loading branch information
Showing
5 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
require File.expand_path('../helper', __FILE__) | ||
require 'open3' | ||
|
||
class TestRakeReduceCompat < Rake::TestCase | ||
# TODO: factor out similar code in test_rake_functional.rb | ||
def rake(*args) | ||
lib = File.join(@orig_PWD, "lib") | ||
bin_rake = File.join(@orig_PWD, "bin", "rake") | ||
Open3.popen3(RUBY, "-I", lib, bin_rake, *args) { |_, out, _, _| out.read } | ||
end | ||
|
||
def invoke_normal(task_name) | ||
rake task_name.to_s | ||
end | ||
|
||
def invoke_reduce_compat(task_name) | ||
rake "--reduce-compat", task_name.to_s | ||
end | ||
|
||
def test_no_deprecated_dsl | ||
rakefile %q{ | ||
task :check_task do | ||
Module.new { p defined?(task) } | ||
end | ||
task :check_file do | ||
Module.new { p defined?(file) } | ||
end | ||
} | ||
|
||
assert_equal %{"method"}, invoke_normal(:check_task).chomp | ||
assert_equal %{"method"}, invoke_normal(:check_file).chomp | ||
|
||
assert_equal "nil", invoke_reduce_compat(:check_task).chomp | ||
assert_equal "nil", invoke_reduce_compat(:check_file).chomp | ||
end | ||
|
||
def test_no_classic_namespace | ||
rakefile %q{ | ||
task :check_task do | ||
begin | ||
Task | ||
print "present" | ||
rescue NameError | ||
print "absent" | ||
end | ||
end | ||
task :check_file_task do | ||
begin | ||
FileTask | ||
print "present" | ||
rescue NameError | ||
print "absent" | ||
end | ||
end | ||
} | ||
|
||
assert_equal "present", invoke_normal(:check_task) | ||
assert_equal "present", invoke_normal(:check_file_task) | ||
|
||
assert_equal "absent", invoke_reduce_compat(:check_task) | ||
assert_equal "absent", invoke_reduce_compat(:check_file_task) | ||
end | ||
end |