rake 10.0.4 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/doc/command_line_usage.rdoc +1 -1
- data/doc/rakefile.rdoc +27 -13
- data/doc/release_notes/rake-10.1.0.rdoc +61 -0
- data/install.rb +5 -15
- data/lib/rake/alt_system.rb +3 -4
- data/lib/rake/application.rb +115 -68
- data/lib/rake/backtrace.rb +9 -8
- data/lib/rake/clean.rb +27 -4
- data/lib/rake/contrib/ftptools.rb +6 -18
- data/lib/rake/contrib/sys.rb +2 -1
- data/lib/rake/dsl_definition.rb +2 -1
- data/lib/rake/ext/core.rb +2 -1
- data/lib/rake/ext/string.rb +1 -3
- data/lib/rake/file_list.rb +24 -18
- data/lib/rake/file_task.rb +1 -2
- data/lib/rake/file_utils.rb +9 -7
- data/lib/rake/file_utils_ext.rb +2 -1
- data/lib/rake/gempackagetask.rb +2 -1
- data/lib/rake/invocation_chain.rb +24 -18
- data/lib/rake/linked_list.rb +103 -0
- data/lib/rake/packagetask.rb +11 -6
- data/lib/rake/pseudo_status.rb +5 -0
- data/lib/rake/rdoctask.rb +2 -1
- data/lib/rake/ruby182_test_unit_fix.rb +4 -2
- data/lib/rake/runtest.rb +2 -2
- data/lib/rake/scope.rb +42 -0
- data/lib/rake/task.rb +47 -37
- data/lib/rake/task_arguments.rb +13 -2
- data/lib/rake/task_manager.rb +25 -24
- data/lib/rake/tasklib.rb +1 -1
- data/lib/rake/testtask.rb +10 -7
- data/lib/rake/thread_history_display.rb +1 -1
- data/lib/rake/thread_pool.rb +10 -4
- data/lib/rake/version.rb +3 -7
- data/lib/rake/win32.rb +3 -2
- data/lib/rake.rb +2 -0
- data/test/helper.rb +36 -470
- data/test/support/rakefile_definitions.rb +444 -0
- data/test/support/ruby_runner.rb +33 -0
- data/test/test_rake_application.rb +14 -12
- data/test/test_rake_application_options.rb +7 -5
- data/test/test_rake_backtrace.rb +38 -14
- data/test/test_rake_clean.rb +36 -4
- data/test/test_rake_definitions.rb +2 -3
- data/test/test_rake_file_creation_task.rb +2 -2
- data/test/test_rake_file_list.rb +23 -24
- data/test/test_rake_file_task.rb +4 -4
- data/test/test_rake_file_utils.rb +6 -2
- data/test/test_rake_ftp_file.rb +28 -13
- data/test/test_rake_functional.rb +6 -36
- data/test/test_rake_invocation_chain.rb +15 -3
- data/test/test_rake_linked_list.rb +84 -0
- data/test/test_rake_makefile_loader.rb +3 -1
- data/test/test_rake_multi_task.rb +2 -3
- data/test/test_rake_name_space.rb +1 -1
- data/test/test_rake_path_map.rb +23 -12
- data/test/test_rake_rake_test_loader.rb +2 -3
- data/test/test_rake_reduce_compat.rb +2 -6
- data/test/test_rake_rules.rb +47 -12
- data/test/test_rake_scope.rb +44 -0
- data/test/test_rake_task.rb +47 -11
- data/test/test_rake_task_arguments.rb +35 -2
- data/test/test_rake_task_manager.rb +16 -15
- data/test/test_rake_task_with_arguments.rb +2 -2
- data/test/test_rake_test_task.rb +1 -2
- data/test/test_rake_thread_pool.rb +36 -16
- data/test/test_thread_history_display.rb +16 -6
- data/test/test_trace_output.rb +2 -0
- metadata +10 -2
data/test/test_rake_clean.rb
CHANGED
|
@@ -2,13 +2,45 @@ require File.expand_path('../helper', __FILE__)
|
|
|
2
2
|
require 'rake/clean'
|
|
3
3
|
|
|
4
4
|
class TestRakeClean < Rake::TestCase
|
|
5
|
-
include Rake
|
|
6
5
|
def test_clean
|
|
7
6
|
load 'rake/clean.rb', true
|
|
8
7
|
|
|
9
|
-
assert Task['clean'], "Should define clean"
|
|
10
|
-
assert Task['clobber'], "Should define clobber"
|
|
11
|
-
assert Task['clobber'].prerequisites.include?("clean"),
|
|
8
|
+
assert Rake::Task['clean'], "Should define clean"
|
|
9
|
+
assert Rake::Task['clobber'], "Should define clobber"
|
|
10
|
+
assert Rake::Task['clobber'].prerequisites.include?("clean"),
|
|
12
11
|
"Clobber should require clean"
|
|
13
12
|
end
|
|
13
|
+
|
|
14
|
+
def test_cleanup
|
|
15
|
+
file_name = create_undeletable_file
|
|
16
|
+
|
|
17
|
+
out, _ = capture_io do
|
|
18
|
+
Rake::Cleaner.cleanup(file_name, verbose: false)
|
|
19
|
+
end
|
|
20
|
+
assert_match(/failed to remove/i, out)
|
|
21
|
+
|
|
22
|
+
ensure
|
|
23
|
+
remove_undeletable_file
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def create_undeletable_file
|
|
29
|
+
dir_name = File.join(@tempdir, "deletedir")
|
|
30
|
+
file_name = File.join(dir_name, "deleteme")
|
|
31
|
+
FileUtils.mkdir(dir_name)
|
|
32
|
+
FileUtils.touch(file_name)
|
|
33
|
+
FileUtils.chmod(0, file_name)
|
|
34
|
+
FileUtils.chmod(0, dir_name)
|
|
35
|
+
file_name
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def remove_undeletable_file
|
|
39
|
+
dir_name = File.join(@tempdir, "deletedir")
|
|
40
|
+
file_name = File.join(dir_name, "deleteme")
|
|
41
|
+
FileUtils.chmod(0777, dir_name)
|
|
42
|
+
FileUtils.chmod(0777, file_name)
|
|
43
|
+
Rake::Cleaner.cleanup(file_name, verbose: false)
|
|
44
|
+
Rake::Cleaner.cleanup(dir_name, verbose: false)
|
|
45
|
+
end
|
|
14
46
|
end
|
|
@@ -34,12 +34,12 @@ class TestRakeDefinitions < Rake::TestCase
|
|
|
34
34
|
t = Task[n1]
|
|
35
35
|
assert Task === t, "Should be a Task"
|
|
36
36
|
assert_equal n1.to_s, t.name
|
|
37
|
-
assert_equal [n2.to_s], t.prerequisites.
|
|
37
|
+
assert_equal [n2.to_s], t.prerequisites.map { |n| n.to_s }
|
|
38
38
|
t.invoke
|
|
39
39
|
t2 = Task[n2]
|
|
40
40
|
assert_equal FileList[], t2.prerequisites
|
|
41
41
|
t3 = Task[n3]
|
|
42
|
-
assert_equal [n1.to_s, n2.to_s], t3.prerequisites.
|
|
42
|
+
assert_equal [n1.to_s, n2.to_s], t3.prerequisites.map { |n| n.to_s }
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def test_incremental_definitions
|
|
@@ -77,4 +77,3 @@ class TestRakeDefinitions < Rake::TestCase
|
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
end
|
|
80
|
-
|
|
@@ -21,7 +21,7 @@ class TestRakeFileCreationTask < Rake::TestCase
|
|
|
21
21
|
FileUtils.rm_rf fc_task.name
|
|
22
22
|
assert fc_task.needed?, "file should be needed"
|
|
23
23
|
FileUtils.mkdir fc_task.name
|
|
24
|
-
assert_equal nil, fc_task.prerequisites.
|
|
24
|
+
assert_equal nil, fc_task.prerequisites.map { |n| Task[n].timestamp }.max
|
|
25
25
|
assert ! fc_task.needed?, "file should not be needed"
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -51,6 +51,6 @@ class TestRakeFileCreationTask < Rake::TestCase
|
|
|
51
51
|
def test_very_early_timestamp
|
|
52
52
|
t1 = Rake.application.intern(FileCreationTask, OLDFILE)
|
|
53
53
|
assert t1.timestamp < Time.now
|
|
54
|
-
assert t1.timestamp < Time.now -
|
|
54
|
+
assert t1.timestamp < Time.now - 1_000_000
|
|
55
55
|
end
|
|
56
56
|
end
|
data/test/test_rake_file_list.rb
CHANGED
|
@@ -166,7 +166,7 @@ class TestRakeFileList < Rake::TestCase
|
|
|
166
166
|
def test_excluding_via_block
|
|
167
167
|
fl = FileList['a.c', 'b.c', 'xyz.c']
|
|
168
168
|
fl.exclude { |fn| fn.pathmap('%n') == 'xyz' }
|
|
169
|
-
assert fl.
|
|
169
|
+
assert fl.excluded_from_list?("xyz.c"), "Should exclude xyz.c"
|
|
170
170
|
assert_equal ['a.c', 'b.c'], fl
|
|
171
171
|
end
|
|
172
172
|
|
|
@@ -404,24 +404,24 @@ class TestRakeFileList < Rake::TestCase
|
|
|
404
404
|
|
|
405
405
|
def test_exclude_with_alternate_file_seps
|
|
406
406
|
fl = FileList.new
|
|
407
|
-
assert fl.
|
|
408
|
-
assert fl.
|
|
409
|
-
assert fl.
|
|
410
|
-
assert fl.
|
|
411
|
-
assert fl.
|
|
412
|
-
assert fl.
|
|
407
|
+
assert fl.excluded_from_list?("x/CVS/y")
|
|
408
|
+
assert fl.excluded_from_list?("x\\CVS\\y")
|
|
409
|
+
assert fl.excluded_from_list?("x/.svn/y")
|
|
410
|
+
assert fl.excluded_from_list?("x\\.svn\\y")
|
|
411
|
+
assert fl.excluded_from_list?("x/core")
|
|
412
|
+
assert fl.excluded_from_list?("x\\core")
|
|
413
413
|
end
|
|
414
414
|
|
|
415
415
|
def test_add_default_exclude_list
|
|
416
416
|
fl = FileList.new
|
|
417
417
|
fl.exclude(/~\d+$/)
|
|
418
|
-
assert fl.
|
|
419
|
-
assert fl.
|
|
420
|
-
assert fl.
|
|
421
|
-
assert fl.
|
|
422
|
-
assert fl.
|
|
423
|
-
assert fl.
|
|
424
|
-
assert fl.
|
|
418
|
+
assert fl.excluded_from_list?("x/CVS/y")
|
|
419
|
+
assert fl.excluded_from_list?("x\\CVS\\y")
|
|
420
|
+
assert fl.excluded_from_list?("x/.svn/y")
|
|
421
|
+
assert fl.excluded_from_list?("x\\.svn\\y")
|
|
422
|
+
assert fl.excluded_from_list?("x/core")
|
|
423
|
+
assert fl.excluded_from_list?("x\\core")
|
|
424
|
+
assert fl.excluded_from_list?("x/abc~1")
|
|
425
425
|
end
|
|
426
426
|
|
|
427
427
|
def test_basic_array_functions
|
|
@@ -482,12 +482,12 @@ class TestRakeFileList < Rake::TestCase
|
|
|
482
482
|
a = ['b', 'a']
|
|
483
483
|
b = ['b', 'b']
|
|
484
484
|
c = ['b', 'c']
|
|
485
|
-
assert_equal(
|
|
486
|
-
assert_equal(
|
|
487
|
-
assert_equal(
|
|
488
|
-
assert_equal(
|
|
489
|
-
assert_equal(
|
|
490
|
-
assert_equal(
|
|
485
|
+
assert_equal(1, fl <=> a)
|
|
486
|
+
assert_equal(0, fl <=> b)
|
|
487
|
+
assert_equal(-1, fl <=> c)
|
|
488
|
+
assert_equal(-1, a <=> fl)
|
|
489
|
+
assert_equal(0, b <=> fl)
|
|
490
|
+
assert_equal(1, c <=> fl)
|
|
491
491
|
end
|
|
492
492
|
|
|
493
493
|
def test_array_equality
|
|
@@ -503,7 +503,7 @@ class TestRakeFileList < Rake::TestCase
|
|
|
503
503
|
|
|
504
504
|
def test_enumeration_methods
|
|
505
505
|
a = FileList['a', 'b']
|
|
506
|
-
b = a.
|
|
506
|
+
b = a.map { |it| it.upcase }
|
|
507
507
|
assert_equal ['A', 'B'], b
|
|
508
508
|
assert_equal FileList, b.class
|
|
509
509
|
|
|
@@ -519,7 +519,7 @@ class TestRakeFileList < Rake::TestCase
|
|
|
519
519
|
assert_equal ['a', 'b'], b
|
|
520
520
|
assert_equal FileList, b.class
|
|
521
521
|
|
|
522
|
-
b = a.
|
|
522
|
+
b = a.select { |it| it == 'b' }
|
|
523
523
|
assert_equal ['b'], b
|
|
524
524
|
assert_equal FileList, b.class
|
|
525
525
|
|
|
@@ -609,7 +609,7 @@ class TestRakeFileList < Rake::TestCase
|
|
|
609
609
|
assert_equal FileList, r.class
|
|
610
610
|
|
|
611
611
|
f = FileList['a', 'b', 'c', 'd']
|
|
612
|
-
r = f.values_at(1,3)
|
|
612
|
+
r = f.values_at(1, 3)
|
|
613
613
|
assert_equal ['b', 'd'], r
|
|
614
614
|
assert_equal FileList, r.class
|
|
615
615
|
end
|
|
@@ -625,4 +625,3 @@ class TestRakeFileList < Rake::TestCase
|
|
|
625
625
|
end
|
|
626
626
|
|
|
627
627
|
end
|
|
628
|
-
|
data/test/test_rake_file_task.rb
CHANGED
|
@@ -26,7 +26,7 @@ class TestRakeFileTask < Rake::TestCase
|
|
|
26
26
|
|
|
27
27
|
open(ftask.name, "w") { |f| f.puts "HI" }
|
|
28
28
|
|
|
29
|
-
assert_equal nil, ftask.prerequisites.
|
|
29
|
+
assert_equal nil, ftask.prerequisites.map { |n| Task[n].timestamp }.max
|
|
30
30
|
assert ! ftask.needed?, "file should not be needed"
|
|
31
31
|
ensure
|
|
32
32
|
File.delete(ftask.name) rescue nil
|
|
@@ -61,10 +61,10 @@ class TestRakeFileTask < Rake::TestCase
|
|
|
61
61
|
def test_file_times_old_depends_on_new
|
|
62
62
|
create_timed_files(OLDFILE, NEWFILE)
|
|
63
63
|
|
|
64
|
-
t1 = Rake.application.intern(FileTask,OLDFILE).enhance([NEWFILE])
|
|
64
|
+
t1 = Rake.application.intern(FileTask, OLDFILE).enhance([NEWFILE])
|
|
65
65
|
t2 = Rake.application.intern(FileTask, NEWFILE)
|
|
66
66
|
assert ! t2.needed?, "Should not need to build new file"
|
|
67
|
-
preq_stamp = t1.prerequisites.
|
|
67
|
+
preq_stamp = t1.prerequisites.map { |t| Task[t].timestamp }.max
|
|
68
68
|
assert_equal t2.timestamp, preq_stamp
|
|
69
69
|
assert t1.timestamp < preq_stamp, "T1 should be older"
|
|
70
70
|
assert t1.needed?, "Should need to rebuild old file because of new"
|
|
@@ -112,7 +112,7 @@ class TestRakeFileTask < Rake::TestCase
|
|
|
112
112
|
Task[NEWFILE].invoke
|
|
113
113
|
rescue Exception
|
|
114
114
|
end
|
|
115
|
-
assert(
|
|
115
|
+
assert(! File.exist?(NEWFILE), "NEWFILE should be deleted")
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
def load_phony
|
|
@@ -44,15 +44,19 @@ class TestRakeFileUtils < Rake::TestCase
|
|
|
44
44
|
class BadLink
|
|
45
45
|
include Rake::FileUtilsExt
|
|
46
46
|
attr_reader :cp_args
|
|
47
|
+
|
|
47
48
|
def initialize(klass)
|
|
48
49
|
@failure_class = klass
|
|
49
50
|
end
|
|
51
|
+
|
|
50
52
|
def cp(*args)
|
|
51
53
|
@cp_args = args
|
|
52
54
|
end
|
|
55
|
+
|
|
53
56
|
def ln(*args)
|
|
54
57
|
fail @failure_class, "ln not supported"
|
|
55
58
|
end
|
|
59
|
+
|
|
56
60
|
public :safe_ln
|
|
57
61
|
end
|
|
58
62
|
|
|
@@ -94,7 +98,7 @@ class TestRakeFileUtils < Rake::TestCase
|
|
|
94
98
|
assert_equal true, nowrite
|
|
95
99
|
nowrite false
|
|
96
100
|
assert_equal false, nowrite
|
|
97
|
-
nowrite(true){
|
|
101
|
+
nowrite(true) {
|
|
98
102
|
assert_equal true, nowrite
|
|
99
103
|
}
|
|
100
104
|
assert_equal false, nowrite
|
|
@@ -250,7 +254,7 @@ class TestRakeFileUtils < Rake::TestCase
|
|
|
250
254
|
assert_equal ['..', 'a', 'b'], Rake::FileUtilsExt.split_all('../a/b')
|
|
251
255
|
end
|
|
252
256
|
|
|
253
|
-
def command
|
|
257
|
+
def command(name, text)
|
|
254
258
|
open name, 'w', 0750 do |io|
|
|
255
259
|
io << text
|
|
256
260
|
end
|
data/test/test_rake_ftp_file.rb
CHANGED
|
@@ -5,10 +5,11 @@ require 'rake/contrib/ftptools'
|
|
|
5
5
|
|
|
6
6
|
class FakeDate
|
|
7
7
|
def self.today
|
|
8
|
-
Date.new(2003,10,3)
|
|
8
|
+
Date.new(2003, 10, 3)
|
|
9
9
|
end
|
|
10
|
+
|
|
10
11
|
def self.now
|
|
11
|
-
Time.local(2003,10,3,12,00,00)
|
|
12
|
+
Time.local(2003, 10, 3, 12, 00, 00)
|
|
12
13
|
end
|
|
13
14
|
end
|
|
14
15
|
|
|
@@ -17,43 +18,57 @@ class TestRakeFtpFile < Rake::TestCase
|
|
|
17
18
|
def setup
|
|
18
19
|
super
|
|
19
20
|
|
|
20
|
-
Rake::FtpFile.class_eval {
|
|
21
|
+
Rake::FtpFile.class_eval {
|
|
22
|
+
@date_class = FakeDate
|
|
23
|
+
@time_class = FakeDate
|
|
24
|
+
}
|
|
21
25
|
end
|
|
22
26
|
|
|
23
27
|
def test_general
|
|
24
|
-
file = Rake::FtpFile.new(
|
|
28
|
+
file = Rake::FtpFile.new(
|
|
29
|
+
"here",
|
|
30
|
+
"-rw-r--r-- 1 a279376 develop 121770 Mar 6 14:50 wiki.pl")
|
|
25
31
|
assert_equal "wiki.pl", file.name
|
|
26
32
|
assert_equal "here/wiki.pl", file.path
|
|
27
33
|
assert_equal "a279376", file.owner
|
|
28
34
|
assert_equal "develop", file.group
|
|
29
35
|
assert_equal 0644, file.mode
|
|
30
|
-
assert_equal
|
|
31
|
-
assert_equal Time.mktime(2003,3,6,14,50,0,0), file.time
|
|
36
|
+
assert_equal 121_770, file.size
|
|
37
|
+
assert_equal Time.mktime(2003, 3, 6, 14, 50, 0, 0), file.time
|
|
32
38
|
assert ! file.directory?
|
|
33
39
|
assert ! file.symlink?
|
|
34
40
|
end
|
|
35
41
|
|
|
36
42
|
def test_far_date
|
|
37
|
-
file = Rake::FtpFile.new(
|
|
38
|
-
|
|
43
|
+
file = Rake::FtpFile.new(
|
|
44
|
+
".",
|
|
45
|
+
"drwxr-xr-x 3 a279376 develop 4096 Nov 26 2001 vss")
|
|
46
|
+
assert_equal Time.mktime(2001, 11, 26, 0, 0, 0, 0), file.time
|
|
39
47
|
end
|
|
40
48
|
|
|
41
49
|
def test_close_date
|
|
42
|
-
file = Rake::FtpFile.new(
|
|
43
|
-
|
|
50
|
+
file = Rake::FtpFile.new(
|
|
51
|
+
".",
|
|
52
|
+
"drwxr-xr-x 3 a279376 develop 4096 Nov 26 15:35 vss")
|
|
53
|
+
assert_equal Time.mktime(2002, 11, 26, 15, 35, 0, 0), file.time
|
|
44
54
|
end
|
|
45
55
|
|
|
46
56
|
def test_directory
|
|
47
|
-
file = Rake::FtpFile.new(
|
|
57
|
+
file = Rake::FtpFile.new(
|
|
58
|
+
".",
|
|
59
|
+
"drwxrwxr-x 9 a279376 develop 4096 Mar 13 14:32 working")
|
|
48
60
|
assert file.directory?
|
|
49
61
|
assert !file.symlink?
|
|
50
62
|
end
|
|
51
63
|
|
|
52
64
|
def test_symlink
|
|
53
|
-
file = Rake::FtpFile.new(
|
|
65
|
+
file = Rake::FtpFile.new(
|
|
66
|
+
".",
|
|
67
|
+
"lrwxrwxrwx 1 a279376 develop 64 Mar 26 2002 " +
|
|
68
|
+
"xtrac -> /home/a279376/working/ics/development/java/" +
|
|
69
|
+
"com/fmr/fwp/ics/xtrac")
|
|
54
70
|
assert_equal 'xtrac', file.name
|
|
55
71
|
assert file.symlink?
|
|
56
72
|
assert !file.directory?
|
|
57
73
|
end
|
|
58
74
|
end
|
|
59
|
-
|
|
@@ -3,13 +3,11 @@ require 'fileutils'
|
|
|
3
3
|
require 'open3'
|
|
4
4
|
|
|
5
5
|
class TestRakeFunctional < Rake::TestCase
|
|
6
|
+
include RubyRunner
|
|
6
7
|
|
|
7
8
|
def setup
|
|
8
9
|
super
|
|
9
10
|
|
|
10
|
-
@ruby_options = ["-I#{@rake_lib}", "-I."]
|
|
11
|
-
@verbose = ENV['VERBOSE']
|
|
12
|
-
|
|
13
11
|
if @verbose
|
|
14
12
|
puts
|
|
15
13
|
puts
|
|
@@ -68,7 +66,7 @@ class TestRakeFunctional < Rake::TestCase
|
|
|
68
66
|
|
|
69
67
|
rake "--describe"
|
|
70
68
|
|
|
71
|
-
assert_match %r{^rake a\n *A
|
|
69
|
+
assert_match %r{^rake a\n *A\n *A2 *$}m, @out
|
|
72
70
|
assert_match %r{^rake b\n *B *$}m, @out
|
|
73
71
|
assert_match %r{^rake d\n *x{80}}m, @out
|
|
74
72
|
refute_match %r{^rake c\n}m, @out
|
|
@@ -420,8 +418,10 @@ class TestRakeFunctional < Rake::TestCase
|
|
|
420
418
|
status = $?
|
|
421
419
|
if @verbose
|
|
422
420
|
puts " SIG status = #{$?.inspect}"
|
|
423
|
-
puts " SIG status.respond_to?(:signaled?) =
|
|
424
|
-
|
|
421
|
+
puts " SIG status.respond_to?(:signaled?) = " +
|
|
422
|
+
"#{$?.respond_to?(:signaled?).inspect}"
|
|
423
|
+
puts " SIG status.signaled? = #{status.signaled?}" if
|
|
424
|
+
status.respond_to?(:signaled?)
|
|
425
425
|
end
|
|
426
426
|
status.respond_to?(:signaled?) && status.signaled?
|
|
427
427
|
end
|
|
@@ -463,34 +463,4 @@ class TestRakeFunctional < Rake::TestCase
|
|
|
463
463
|
RUBY_VERSION < "1.9" || defined?(JRUBY_VERSION)
|
|
464
464
|
end
|
|
465
465
|
|
|
466
|
-
# Run a shell Ruby command with command line options (using the
|
|
467
|
-
# default test options). Output is captured in @out and @err
|
|
468
|
-
def ruby(*option_list)
|
|
469
|
-
run_ruby(@ruby_options + option_list)
|
|
470
|
-
end
|
|
471
|
-
|
|
472
|
-
# Run a command line rake with the give rake options. Default
|
|
473
|
-
# command line ruby options are included. Output is captured in
|
|
474
|
-
# @out and @err
|
|
475
|
-
def rake(*rake_options)
|
|
476
|
-
run_ruby @ruby_options + [@rake_exec] + rake_options
|
|
477
|
-
end
|
|
478
|
-
|
|
479
|
-
# Low level ruby command runner ...
|
|
480
|
-
def run_ruby(option_list)
|
|
481
|
-
puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose
|
|
482
|
-
|
|
483
|
-
inn, out, err, wait = Open3.popen3(RUBY, *option_list)
|
|
484
|
-
inn.close
|
|
485
|
-
|
|
486
|
-
@exit = wait ? wait.value : $?
|
|
487
|
-
@out = out.read
|
|
488
|
-
@err = err.read
|
|
489
|
-
|
|
490
|
-
puts "OUTPUT: [#{@out}]" if @verbose
|
|
491
|
-
puts "ERROR: [#{@err}]" if @verbose
|
|
492
|
-
puts "EXIT: [#{@exit.inspect}]" if @verbose
|
|
493
|
-
puts "PWD: [#{Dir.pwd}]" if @verbose
|
|
494
|
-
end
|
|
495
|
-
|
|
496
466
|
end
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
require File.expand_path('../helper', __FILE__)
|
|
2
2
|
|
|
3
3
|
class TestRakeInvocationChain < Rake::TestCase
|
|
4
|
+
include Rake
|
|
4
5
|
|
|
5
6
|
def setup
|
|
6
7
|
super
|
|
7
8
|
|
|
8
|
-
@empty =
|
|
9
|
+
@empty = InvocationChain.empty
|
|
9
10
|
|
|
10
11
|
@first_member = "A"
|
|
11
12
|
@second_member = "B"
|
|
@@ -13,7 +14,19 @@ class TestRakeInvocationChain < Rake::TestCase
|
|
|
13
14
|
@two = @one.append(@second_member)
|
|
14
15
|
end
|
|
15
16
|
|
|
16
|
-
def
|
|
17
|
+
def test_conj_on_invocation_chains
|
|
18
|
+
list = InvocationChain.empty.conj("B").conj("A")
|
|
19
|
+
assert_equal InvocationChain.make("A", "B"), list
|
|
20
|
+
assert_equal InvocationChain, list.class
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_make_on_invocation_chains
|
|
24
|
+
assert_equal @empty, InvocationChain.make()
|
|
25
|
+
assert_equal @one, InvocationChain.make(@first_member)
|
|
26
|
+
assert_equal @two, InvocationChain.make(@second_member, @first_member)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_append_with_one_argument
|
|
17
30
|
chain = @empty.append("A")
|
|
18
31
|
|
|
19
32
|
assert_equal 'TOP => A', chain.to_s # HACK
|
|
@@ -49,4 +62,3 @@ class TestRakeInvocationChain < Rake::TestCase
|
|
|
49
62
|
end
|
|
50
63
|
|
|
51
64
|
end
|
|
52
|
-
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
class TestLinkedList < Rake::TestCase
|
|
4
|
+
include Rake
|
|
5
|
+
|
|
6
|
+
def test_empty_list
|
|
7
|
+
empty = LinkedList::EMPTY
|
|
8
|
+
assert empty.empty?, "should be empty"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_list_with_one_item
|
|
12
|
+
list = LinkedList.make(:one)
|
|
13
|
+
assert ! list.empty?, "should not be empty"
|
|
14
|
+
assert_equal :one, list.head
|
|
15
|
+
assert_equal LinkedList::EMPTY, list.tail
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_make_with_no_arguments
|
|
19
|
+
empty = LinkedList.make()
|
|
20
|
+
assert_equal LinkedList::EMPTY, empty
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_make_with_one_argument
|
|
24
|
+
list = LinkedList.make(:one)
|
|
25
|
+
assert ! list.empty?
|
|
26
|
+
assert_equal :one, list.head
|
|
27
|
+
assert_equal LinkedList::EMPTY, list.tail
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_make_with_two_arguments
|
|
31
|
+
list = LinkedList.make(:one, :two)
|
|
32
|
+
assert ! list.empty?
|
|
33
|
+
assert_equal :one, list.head
|
|
34
|
+
assert_equal :two, list.tail.head
|
|
35
|
+
assert_equal LinkedList::EMPTY, list.tail.tail
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_list_with_several_items
|
|
39
|
+
list = LinkedList.make(:one, :two, :three)
|
|
40
|
+
|
|
41
|
+
assert ! list.empty?, "should not be empty"
|
|
42
|
+
assert_equal :one, list.head
|
|
43
|
+
assert_equal :two, list.tail.head
|
|
44
|
+
assert_equal :three, list.tail.tail.head
|
|
45
|
+
assert_equal LinkedList::EMPTY, list.tail.tail.tail
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_lists_are_structurally_equivalent
|
|
49
|
+
list = LinkedList.make(1, 2, 3)
|
|
50
|
+
same = LinkedList.make(1, 2, 3)
|
|
51
|
+
diff = LinkedList.make(1, 2, 4)
|
|
52
|
+
short = LinkedList.make(1, 2)
|
|
53
|
+
|
|
54
|
+
assert_equal list, same
|
|
55
|
+
refute_equal list, diff
|
|
56
|
+
refute_equal list, short
|
|
57
|
+
refute_equal short, list
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def test_converstion_to_string
|
|
61
|
+
list = LinkedList.make(:one, :two, :three)
|
|
62
|
+
assert_equal "LL(one, two, three)", list.to_s
|
|
63
|
+
assert_equal "LL()", LinkedList.make().to_s
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_converstion_with_inspect
|
|
67
|
+
list = LinkedList.make(:one, :two, :three)
|
|
68
|
+
assert_equal "LL(:one, :two, :three)", list.inspect
|
|
69
|
+
assert_equal "LL()", LinkedList.make().inspect
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def test_lists_are_enumerable
|
|
73
|
+
list = LinkedList.make(1, 2, 3)
|
|
74
|
+
new_list = list.map { |item| item + 10 }
|
|
75
|
+
expected = [11, 12, 13]
|
|
76
|
+
assert_equal expected, new_list
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def test_conjunction
|
|
80
|
+
list = LinkedList.make.conj("C").conj("B").conj("A")
|
|
81
|
+
assert_equal LinkedList.make("A", "B", "C"), list
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
end
|
|
@@ -38,7 +38,9 @@ g\ 0: g1 g\ 2 g\ 3 g4
|
|
|
38
38
|
assert_equal %w(d1 d2).sort, Task['d'].prerequisites.sort
|
|
39
39
|
assert_equal %w(e1 f1).sort, Task['e'].prerequisites.sort
|
|
40
40
|
assert_equal %w(e1 f1).sort, Task['f'].prerequisites.sort
|
|
41
|
-
assert_equal
|
|
41
|
+
assert_equal(
|
|
42
|
+
["g1", "g 2", "g 3", "g4"].sort,
|
|
43
|
+
Task['g 0'].prerequisites.sort)
|
|
42
44
|
assert_equal 7, Task.tasks.size
|
|
43
45
|
end
|
|
44
46
|
end
|
|
@@ -49,11 +49,10 @@ class TestRakeMultiTask < Rake::TestCase
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def test_multitasks_with_parameters
|
|
52
|
-
task :a, [:arg] do |t,args| add_run(args[:arg]) end
|
|
53
|
-
multitask :b, [:arg] => [:a] do |t,args| add_run(args[:arg]+'mt') end
|
|
52
|
+
task :a, [:arg] do |t, args| add_run(args[:arg]) end
|
|
53
|
+
multitask :b, [:arg] => [:a] do |t, args| add_run(args[:arg] + 'mt') end
|
|
54
54
|
Task[:b].invoke "b"
|
|
55
55
|
assert @runs[0] == "b"
|
|
56
56
|
assert @runs[1] == "bmt"
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
|
-
|
data/test/test_rake_path_map.rb
CHANGED
|
@@ -52,7 +52,7 @@ class TestRakePathMap < Rake::TestCase
|
|
|
52
52
|
assert_equal "", "dir/.depends".pathmap("%x")
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
def
|
|
55
|
+
def test_x_returns_everything_but_extension
|
|
56
56
|
assert_equal "abc", "abc".pathmap("%X")
|
|
57
57
|
assert_equal "abc", "abc.rb".pathmap("%X")
|
|
58
58
|
assert_equal "abc.xyz", "abc.xyz.rb".pathmap("%X")
|
|
@@ -142,16 +142,27 @@ class TestRakePathMap < Rake::TestCase
|
|
|
142
142
|
|
|
143
143
|
def test_complex_patterns
|
|
144
144
|
sep = "".pathmap("%s")
|
|
145
|
-
assert_equal
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
"
|
|
151
|
-
assert_equal
|
|
152
|
-
"
|
|
153
|
-
|
|
154
|
-
assert_equal
|
|
145
|
+
assert_equal(
|
|
146
|
+
"dir/abc.rb",
|
|
147
|
+
"dir/abc.rb".pathmap("%d/%n%x"))
|
|
148
|
+
assert_equal(
|
|
149
|
+
"./abc.rb",
|
|
150
|
+
"abc.rb".pathmap("%d/%n%x"))
|
|
151
|
+
assert_equal(
|
|
152
|
+
"Your file extension is '.rb'",
|
|
153
|
+
"dir/abc.rb".pathmap("Your file extension is '%x'"))
|
|
154
|
+
assert_equal(
|
|
155
|
+
"bin/org/onstepback/proj/A.class",
|
|
156
|
+
"src/org/onstepback/proj/A.java".pathmap("%{src,bin}d/%n.class"))
|
|
157
|
+
assert_equal(
|
|
158
|
+
"src_work/bin/org/onstepback/proj/A.class",
|
|
159
|
+
"src_work/src/org/onstepback/proj/A.java"
|
|
160
|
+
.pathmap('%{\bsrc\b,bin}X.class'))
|
|
161
|
+
assert_equal(
|
|
162
|
+
".depends.bak",
|
|
163
|
+
".depends".pathmap("%X.bak"))
|
|
164
|
+
assert_equal(
|
|
165
|
+
"d#{sep}a/b/c#{sep}file.txt",
|
|
166
|
+
"a/b/c/d/file.txt".pathmap("%-1d%s%3d%s%f"))
|
|
155
167
|
end
|
|
156
168
|
end
|
|
157
|
-
|
|
@@ -3,7 +3,7 @@ require File.expand_path('../helper', __FILE__)
|
|
|
3
3
|
class TestRakeRakeTestLoader < Rake::TestCase
|
|
4
4
|
|
|
5
5
|
def test_pattern
|
|
6
|
-
|
|
6
|
+
orig_loaded_features = $:.dup
|
|
7
7
|
FileUtils.touch 'foo.rb'
|
|
8
8
|
FileUtils.touch 'test_a.rb'
|
|
9
9
|
FileUtils.touch 'test_b.rb'
|
|
@@ -14,8 +14,7 @@ class TestRakeRakeTestLoader < Rake::TestCase
|
|
|
14
14
|
|
|
15
15
|
assert_equal %w[-v], ARGV
|
|
16
16
|
ensure
|
|
17
|
-
$:.replace
|
|
17
|
+
$:.replace orig_loaded_features
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
end
|
|
21
|
-
|
|
@@ -2,15 +2,11 @@ require File.expand_path('../helper', __FILE__)
|
|
|
2
2
|
require 'open3'
|
|
3
3
|
|
|
4
4
|
class TestRakeReduceCompat < Rake::TestCase
|
|
5
|
-
|
|
6
|
-
def rake(*args)
|
|
7
|
-
Open3.popen3(RUBY, "-I", @rake_lib, @rake_exec, *args) { |_, out, _, _|
|
|
8
|
-
out.read
|
|
9
|
-
}
|
|
10
|
-
end
|
|
5
|
+
include RubyRunner
|
|
11
6
|
|
|
12
7
|
def invoke_normal(task_name)
|
|
13
8
|
rake task_name.to_s
|
|
9
|
+
@out
|
|
14
10
|
end
|
|
15
11
|
|
|
16
12
|
def test_no_deprecated_dsl
|