diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-02 19:07:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-02 19:07:55 +0000 |
commit | 8da109fa1ec17fb4096470fe97135f41cdd3345b (patch) | |
tree | c5a08c8c9abae9b7f0514f680f56553a7a03656a /test/rake/test_test_task.rb | |
parent | b43ab1d7f1a8bc1a6fbca4d193c37fb0c6d28281 (diff) | |
download | ruby-8da109fa1ec17fb4096470fe97135f41cdd3345b.tar.gz ruby-8da109fa1ec17fb4096470fe97135f41cdd3345b.tar.xz ruby-8da109fa1ec17fb4096470fe97135f41cdd3345b.zip |
* lib/rake: updated to rake code to rake-0.8.7 source code base.
* lib/rake/loaders/makefile.rb (Rake::MakefileLoader#process_line):
respace dependencies too.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_test_task.rb')
-rw-r--r-- | test/rake/test_test_task.rb | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/test/rake/test_test_task.rb b/test/rake/test_test_task.rb new file mode 100644 index 000000000..1ba04ba9b --- /dev/null +++ b/test/rake/test_test_task.rb @@ -0,0 +1,81 @@ +require 'tmpdir' +require 'test/unit' +require 'rake/testtask' + +class TestTestTask < Test::Unit::TestCase + include Rake + + def setup + @oldwd = Dir.pwd + @tmpwd = Dir.mktmpdir + Dir.chdir(@tmpwd) + Task.clear + ENV.delete('TEST') + open('install.rb', 'w') {} + end + + def teardown + FileUtils.rm_rf("testdata") + Dir.chdir(@oldwd) + FileUtils.rm_rf(@tmpwd) + end + + def test_no_task + assert ! Task.task_defined?(:test) + end + + def test_defaults + tt = Rake::TestTask.new do |t| end + assert_not_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_non_defaults + tt = Rake::TestTask.new(:example) do |t| + t.libs = ['src', 'ext'] + t.pattern = 'test/tc_*.rb' + t.verbose = true + end + assert_not_nil tt + 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_pattern + tt = Rake::TestTask.new do |t| + t.pattern = '*.rb' + end + assert_equal ['install.rb'], tt.file_list.to_a + end + + def test_env_test + ENV['TEST'] = 'testfile.rb' + tt = Rake::TestTask.new do |t| + t.pattern = '*' + end + assert_equal ["testfile.rb"], tt.file_list.to_a + end + + def test_test_files + 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 + + def test_both_pattern_and_test_files + tt = Rake::TestTask.new do |t| + t.test_files = FileList['a.rb', 'b.rb'] + t.pattern = '*.rb' + end + assert_equal ['a.rb', 'b.rb', 'install.rb'], tt.file_list.to_a + end + +end |