summaryrefslogtreecommitdiff
path: root/test/rake/test_rake_reduce_compat.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-15 21:59:37 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-15 21:59:37 +0000
commit9c66bad9f3d522d50d4a45ef8a3a92abbf93229f (patch)
tree8fc1ae219e41bdd711442b1d35149da4f45dfa8a /test/rake/test_rake_reduce_compat.rb
parentbfc95c6e1639edc909338ef4d20d990caf6f630e (diff)
* lib/rake*: Updated to rake 0.9.3
* test/rake*: ditto * bin/rake: ditto * NEWS: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_rake_reduce_compat.rb')
-rw-r--r--test/rake/test_rake_reduce_compat.rb65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/rake/test_rake_reduce_compat.rb b/test/rake/test_rake_reduce_compat.rb
new file mode 100644
index 00000000000..12872614db9
--- /dev/null
+++ b/test/rake/test_rake_reduce_compat.rb
@@ -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