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_file_creation_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_file_creation_task.rb')
| -rw-r--r-- | test/rake/test_file_creation_task.rb | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/rake/test_file_creation_task.rb b/test/rake/test_file_creation_task.rb new file mode 100644 index 000000000..1e5b17754 --- /dev/null +++ b/test/rake/test_file_creation_task.rb @@ -0,0 +1,60 @@ +require 'test/unit' +require 'fileutils' +require 'rake' +require_relative 'filecreation' + +###################################################################### +class TestFileCreationTask < Test::Unit::TestCase + include Rake + include FileCreation + + DUMMY_DIR = 'testdata/dummy_dir' + + def setup + Task.clear + end + + def teardown + FileUtils.rm_rf DUMMY_DIR + end + + def test_file_needed + create_dir DUMMY_DIR + fc_task = Task[DUMMY_DIR] + assert_equal DUMMY_DIR, fc_task.name + FileUtils.rm_rf fc_task.name + assert fc_task.needed?, "file should be needed" + FileUtils.mkdir fc_task.name + assert_equal nil, fc_task.prerequisites.collect{|n| Task[n].timestamp}.max + assert ! fc_task.needed?, "file should not be needed" + end + + def test_directory + directory DUMMY_DIR + fc_task = Task[DUMMY_DIR] + assert_equal DUMMY_DIR, fc_task.name + assert FileCreationTask === fc_task + end + + def test_no_retriggers_on_filecreate_task + create_timed_files(OLDFILE, NEWFILE) + t1 = Rake.application.intern(FileCreationTask, OLDFILE).enhance([NEWFILE]) + t2 = Rake.application.intern(FileCreationTask, NEWFILE) + assert ! t2.needed?, "Should not need to build new file" + assert ! t1.needed?, "Should not need to rebuild old file because of new" + end + + def test_no_retriggers_on_file_task + create_timed_files(OLDFILE, NEWFILE) + t1 = Rake.application.intern(FileCreationTask, OLDFILE).enhance([NEWFILE]) + t2 = Rake.application.intern(FileCreationTask, NEWFILE) + assert ! t2.needed?, "Should not need to build new file" + assert ! t1.needed?, "Should not need to rebuild old file because of new" + end + + def test_very_early_timestamp + t1 = Rake.application.intern(FileCreationTask, OLDFILE) + assert t1.timestamp < Time.now + assert t1.timestamp < Time.now - 1000000 + end +end |
