summaryrefslogtreecommitdiff
path: root/test/rake/test_rake_test_task.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-04 12:31:31 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-04 12:31:31 +0000
commitc4ee0df8ba2cf7cc6aaa785c8df20a91b1719021 (patch)
tree06beca468cce4a75a3e9890d18aa001ef2c41e54 /test/rake/test_rake_test_task.rb
parent8c0b2a286080609613b6b007e030ff7c7adaa23c (diff)
* lib/rake/*: Gemify rake [fix GH-862][Feature #11025]
* test/rake/*: ditto. * tool/rbinstall.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_rake_test_task.rb')
-rw-r--r--test/rake/test_rake_test_task.rb146
1 files changed, 0 insertions, 146 deletions
diff --git a/test/rake/test_rake_test_task.rb b/test/rake/test_rake_test_task.rb
deleted file mode 100644
index 5c4be797c6f..00000000000
--- a/test/rake/test_rake_test_task.rb
+++ /dev/null
@@ -1,146 +0,0 @@
-require File.expand_path('../helper', __FILE__)
-require 'rake/testtask'
-
-class TestRakeTestTask < Rake::TestCase
- include Rake
-
- def test_initialize
- tt = Rake::TestTask.new do |t| end
- refute_nil tt
- assert_equal :test, tt.name
- assert_equal ['lib'], tt.libs
- assert_equal 'test/test*.rb', tt.pattern
- assert_equal false, tt.verbose
- assert Task.task_defined?(:test)
- end
-
- def test_initialize_override
- tt = Rake::TestTask.new(:example) do |t|
- t.description = "Run example tests"
- t.libs = ['src', 'ext']
- t.pattern = 'test/tc_*.rb'
- t.verbose = true
- end
- refute_nil tt
- assert_equal "Run example tests", tt.description
- assert_equal :example, tt.name
- assert_equal ['src', 'ext'], tt.libs
- assert_equal 'test/tc_*.rb', tt.pattern
- assert_equal true, tt.verbose
- assert Task.task_defined?(:example)
- end
-
- def test_file_list_env_test
- ENV['TEST'] = 'testfile.rb'
- tt = Rake::TestTask.new do |t|
- t.pattern = '*'
- end
-
- assert_equal ["testfile.rb"], tt.file_list.to_a
- ensure
- ENV.delete 'TEST'
- end
-
- def test_libs_equals
- test_task = Rake::TestTask.new do |t|
- t.libs << ["A", "B"]
- end
-
- path = %w[lib A B].join File::PATH_SEPARATOR
-
- assert_equal "-I\"#{path}\"", test_task.ruby_opts_string
- end
-
- def test_libs_equals_empty
- test_task = Rake::TestTask.new do |t|
- t.libs = []
- end
-
- assert_equal '', test_task.ruby_opts_string
- end
-
- def test_pattern_equals
- tt = Rake::TestTask.new do |t|
- t.pattern = '*.rb'
- end
- assert_equal ['*.rb'], tt.file_list.to_a
- end
-
- def test_pattern_equals_test_files_equals
- tt = Rake::TestTask.new do |t|
- t.test_files = FileList['a.rb', 'b.rb']
- t.pattern = '*.rb'
- end
- assert_equal ['a.rb', 'b.rb', '*.rb'], tt.file_list.to_a
- end
-
- def test_run_code_direct
- test_task = Rake::TestTask.new do |t|
- t.loader = :direct
- end
-
- assert_equal '-e "ARGV.each{|f| require f}"', test_task.run_code
- end
-
- def test_run_code_rake
- spec = Gem::Specification.new 'rake', 0
- spec.loaded_from = File.join Gem::Specification.dirs.last, 'rake-0.gemspec'
- rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], spec
-
- test_task = Rake::TestTask.new do |t|
- t.loader = :rake
- end
-
- assert_match(/\A-I".*?" ".*?"\Z/, test_task.run_code)
- ensure
- Gem.loaded_specs['rake'] = rake
- end
-
- def test_run_code_rake_default_gem
- skip 'this ruby does not have default gems' unless
- Gem::Specification.method_defined? :default_specifications_dir
-
- default_spec = Gem::Specification.new 'rake', 0
- default_spec.loaded_from = File.join Gem::Specification.default_specifications_dir, 'rake-0.gemspec'
- begin
- rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], default_spec
-
- test_task = Rake::TestTask.new do |t|
- t.loader = :rake
- end
-
- assert_match(/\A(-I".*?" *)* ".*?"\Z/, test_task.run_code)
- ensure
- Gem.loaded_specs['rake'] = rake
- end
- end
-
- def test_run_code_testrb_ruby_1_8_2
- test_task = Rake::TestTask.new do |t|
- t.loader = :testrb
- end
-
- def test_task.ruby_version() '1.8.2' end
-
- assert_match(/^-S testrb +".*"$/, test_task.run_code)
- end
-
- def test_run_code_testrb_ruby_1_8_6
- test_task = Rake::TestTask.new do |t|
- t.loader = :testrb
- end
-
- def test_task.ruby_version() '1.8.6' end
-
- assert_match(/^-S testrb +$/, test_task.run_code)
- end
-
- def test_test_files_equals
- tt = Rake::TestTask.new do |t|
- t.test_files = FileList['a.rb', 'b.rb']
- end
-
- assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
- end
-
-end