elliottcable-echoe 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -1
- data/Manifest +1 -93
- data/Rakefile +1 -2
- data/echoe.gemspec +7 -7
- data/lib/echoe.rb +50 -22
- data/lib/echoe/net.rb +7 -0
- data/lib/echoe/platform.rb +27 -25
- data/vendor/rake/lib/rake/contrib/sshpublisher.rb +0 -4
- metadata +7 -96
- data/vendor/rake/CHANGES +0 -400
- data/vendor/rake/README +0 -285
- data/vendor/rake/Rakefile +0 -418
- data/vendor/rake/TODO +0 -20
- data/vendor/rake/bin/rake +0 -31
- data/vendor/rake/doc/example/Rakefile1 +0 -38
- data/vendor/rake/doc/example/Rakefile2 +0 -35
- data/vendor/rake/doc/example/a.c +0 -6
- data/vendor/rake/doc/example/b.c +0 -6
- data/vendor/rake/doc/example/main.c +0 -11
- data/vendor/rake/doc/glossary.rdoc +0 -51
- data/vendor/rake/doc/jamis.rb +0 -591
- data/vendor/rake/doc/proto_rake.rdoc +0 -127
- data/vendor/rake/doc/rake.1.gz +0 -0
- data/vendor/rake/doc/rakefile.rdoc +0 -534
- data/vendor/rake/doc/rational.rdoc +0 -151
- data/vendor/rake/doc/release_notes/rake-0.4.14.rdoc +0 -23
- data/vendor/rake/doc/release_notes/rake-0.4.15.rdoc +0 -35
- data/vendor/rake/doc/release_notes/rake-0.5.0.rdoc +0 -53
- data/vendor/rake/doc/release_notes/rake-0.5.3.rdoc +0 -78
- data/vendor/rake/doc/release_notes/rake-0.5.4.rdoc +0 -46
- data/vendor/rake/doc/release_notes/rake-0.6.0.rdoc +0 -141
- data/vendor/rake/doc/release_notes/rake-0.7.0.rdoc +0 -119
- data/vendor/rake/doc/release_notes/rake-0.7.1.rdoc +0 -59
- data/vendor/rake/doc/release_notes/rake-0.7.2.rdoc +0 -121
- data/vendor/rake/doc/release_notes/rake-0.7.3.rdoc +0 -47
- data/vendor/rake/doc/release_notes/rake-0.8.0.rdoc +0 -114
- data/vendor/rake/doc/release_notes/rake-0.8.2.rdoc +0 -165
- data/vendor/rake/doc/release_notes/rake-0.8.3.rdoc +0 -112
- data/vendor/rake/install.rb +0 -88
- data/vendor/rake/lib/rake.rb +0 -2468
- data/vendor/rake/lib/rake/classic_namespace.rb +0 -8
- data/vendor/rake/lib/rake/clean.rb +0 -33
- data/vendor/rake/lib/rake/gempackagetask.rb +0 -103
- data/vendor/rake/lib/rake/loaders/makefile.rb +0 -35
- data/vendor/rake/lib/rake/packagetask.rb +0 -185
- data/vendor/rake/lib/rake/rake_test_loader.rb +0 -5
- data/vendor/rake/lib/rake/rdoctask.rb +0 -147
- data/vendor/rake/lib/rake/ruby182_test_unit_fix.rb +0 -23
- data/vendor/rake/lib/rake/runtest.rb +0 -23
- data/vendor/rake/lib/rake/tasklib.rb +0 -23
- data/vendor/rake/lib/rake/testtask.rb +0 -161
- data/vendor/rake/lib/rake/win32.rb +0 -54
- data/vendor/rake/test/capture_stdout.rb +0 -26
- data/vendor/rake/test/check_expansion.rb +0 -5
- data/vendor/rake/test/contrib/test_sys.rb +0 -47
- data/vendor/rake/test/data/chains/Rakefile +0 -15
- data/vendor/rake/test/data/default/Rakefile +0 -19
- data/vendor/rake/test/data/dryrun/Rakefile +0 -22
- data/vendor/rake/test/data/file_creation_task/Rakefile +0 -33
- data/vendor/rake/test/data/imports/Rakefile +0 -19
- data/vendor/rake/test/data/imports/deps.mf +0 -1
- data/vendor/rake/test/data/multidesc/Rakefile +0 -17
- data/vendor/rake/test/data/namespace/Rakefile +0 -57
- data/vendor/rake/test/data/rakelib/test1.rb +0 -3
- data/vendor/rake/test/data/rbext/rakefile.rb +0 -3
- data/vendor/rake/test/data/sample.mf +0 -12
- data/vendor/rake/test/data/statusreturn/Rakefile +0 -8
- data/vendor/rake/test/data/unittest/Rakefile +0 -1
- data/vendor/rake/test/filecreation.rb +0 -32
- data/vendor/rake/test/functional.rb +0 -15
- data/vendor/rake/test/in_environment.rb +0 -30
- data/vendor/rake/test/rake_test_setup.rb +0 -10
- data/vendor/rake/test/reqfile.rb +0 -3
- data/vendor/rake/test/reqfile2.rb +0 -3
- data/vendor/rake/test/session_functional.rb +0 -337
- data/vendor/rake/test/shellcommand.rb +0 -3
- data/vendor/rake/test/test_application.rb +0 -694
- data/vendor/rake/test/test_clean.rb +0 -14
- data/vendor/rake/test/test_definitions.rb +0 -82
- data/vendor/rake/test/test_earlytime.rb +0 -35
- data/vendor/rake/test/test_extension.rb +0 -63
- data/vendor/rake/test/test_file_creation_task.rb +0 -62
- data/vendor/rake/test/test_file_task.rb +0 -139
- data/vendor/rake/test/test_filelist.rb +0 -618
- data/vendor/rake/test/test_fileutils.rb +0 -250
- data/vendor/rake/test/test_ftp.rb +0 -59
- data/vendor/rake/test/test_invocation_chain.rb +0 -75
- data/vendor/rake/test/test_makefile_loader.rb +0 -25
- data/vendor/rake/test/test_multitask.rb +0 -45
- data/vendor/rake/test/test_namespace.rb +0 -36
- data/vendor/rake/test/test_package_task.rb +0 -116
- data/vendor/rake/test/test_pathmap.rb +0 -209
- data/vendor/rake/test/test_rake.rb +0 -41
- data/vendor/rake/test/test_require.rb +0 -33
- data/vendor/rake/test/test_rules.rb +0 -347
- data/vendor/rake/test/test_task_arguments.rb +0 -89
- data/vendor/rake/test/test_task_manager.rb +0 -170
- data/vendor/rake/test/test_tasklib.rb +0 -12
- data/vendor/rake/test/test_tasks.rb +0 -371
- data/vendor/rake/test/test_test_task.rb +0 -75
- data/vendor/rake/test/test_top_level_functions.rb +0 -84
- data/vendor/rake/test/test_win32.rb +0 -57
@@ -1,250 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rake'
|
4
|
-
require 'test/unit'
|
5
|
-
require 'test/filecreation'
|
6
|
-
require 'fileutils'
|
7
|
-
require 'stringio'
|
8
|
-
|
9
|
-
class TestFileUtils < Test::Unit::TestCase
|
10
|
-
include FileCreation
|
11
|
-
|
12
|
-
def setup
|
13
|
-
File.chmod(0750,"test/shellcommand.rb")
|
14
|
-
end
|
15
|
-
|
16
|
-
def teardown
|
17
|
-
FileUtils.rm_rf("testdata")
|
18
|
-
FileUtils::LN_SUPPORTED[0] = true
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_rm_one_file
|
22
|
-
create_file("testdata/a")
|
23
|
-
FileUtils.rm_rf "testdata/a"
|
24
|
-
assert ! File.exist?("testdata/a")
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_rm_two_files
|
28
|
-
create_file("testdata/a")
|
29
|
-
create_file("testdata/b")
|
30
|
-
FileUtils.rm_rf ["testdata/a", "testdata/b"]
|
31
|
-
assert ! File.exist?("testdata/a")
|
32
|
-
assert ! File.exist?("testdata/b")
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_rm_filelist
|
36
|
-
list = Rake::FileList.new << "testdata/a" << "testdata/b"
|
37
|
-
list.each { |fn| create_file(fn) }
|
38
|
-
FileUtils.rm_r list
|
39
|
-
assert ! File.exist?("testdata/a")
|
40
|
-
assert ! File.exist?("testdata/b")
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_ln
|
44
|
-
create_dir("testdata")
|
45
|
-
open("testdata/a", "w") { |f| f.puts "TEST_LN" }
|
46
|
-
RakeFileUtils.safe_ln("testdata/a", "testdata/b", :verbose => false)
|
47
|
-
assert_equal "TEST_LN\n", open("testdata/b") { |f| f.read }
|
48
|
-
end
|
49
|
-
|
50
|
-
class BadLink
|
51
|
-
include RakeFileUtils
|
52
|
-
attr_reader :cp_args
|
53
|
-
def initialize(klass)
|
54
|
-
@failure_class = klass
|
55
|
-
end
|
56
|
-
def cp(*args)
|
57
|
-
@cp_args = args
|
58
|
-
end
|
59
|
-
def ln(*args)
|
60
|
-
fail @failure_class, "ln not supported"
|
61
|
-
end
|
62
|
-
public :safe_ln
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_safe_ln_failover_to_cp_on_standard_error
|
66
|
-
FileUtils::LN_SUPPORTED[0] = true
|
67
|
-
c = BadLink.new(StandardError)
|
68
|
-
c.safe_ln "a", "b"
|
69
|
-
assert_equal ['a', 'b'], c.cp_args
|
70
|
-
c.safe_ln "x", "y"
|
71
|
-
assert_equal ['x', 'y'], c.cp_args
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_safe_ln_failover_to_cp_on_not_implemented_error
|
75
|
-
FileUtils::LN_SUPPORTED[0] = true
|
76
|
-
c = BadLink.new(NotImplementedError)
|
77
|
-
c.safe_ln "a", "b"
|
78
|
-
assert_equal ['a', 'b'], c.cp_args
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_safe_ln_fails_on_script_error
|
82
|
-
FileUtils::LN_SUPPORTED[0] = true
|
83
|
-
c = BadLink.new(ScriptError)
|
84
|
-
assert_raise(ScriptError) do c.safe_ln "a", "b" end
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_verbose
|
88
|
-
verbose true
|
89
|
-
assert_equal true, verbose
|
90
|
-
verbose false
|
91
|
-
assert_equal false, verbose
|
92
|
-
verbose(true) {
|
93
|
-
assert_equal true, verbose
|
94
|
-
}
|
95
|
-
assert_equal false, verbose
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_nowrite
|
99
|
-
nowrite true
|
100
|
-
assert_equal true, nowrite
|
101
|
-
nowrite false
|
102
|
-
assert_equal false, nowrite
|
103
|
-
nowrite(true){
|
104
|
-
assert_equal true, nowrite
|
105
|
-
}
|
106
|
-
assert_equal false, nowrite
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_file_utils_methods_are_available_at_top_level
|
110
|
-
create_file("testdata/a")
|
111
|
-
rm_rf "testdata/a"
|
112
|
-
assert ! File.exist?("testdata/a")
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_fileutils_methods_dont_leak
|
116
|
-
obj = Object.new
|
117
|
-
assert_raise(NoMethodError) { obj.copy } # from FileUtils
|
118
|
-
assert_raise(NoMethodError) { obj.ruby } # from RubyFileUtils
|
119
|
-
end
|
120
|
-
|
121
|
-
def test_sh
|
122
|
-
verbose(false) { sh %{ruby test/shellcommand.rb} }
|
123
|
-
assert true, "should not fail"
|
124
|
-
end
|
125
|
-
|
126
|
-
def test_sh_multiple_arguments
|
127
|
-
ENV['RAKE_TEST_SH'] = 'someval'
|
128
|
-
expanded = windows? ? '%RAKE_TEST_SH%' : '$RAKE_TEST_SH'
|
129
|
-
# This one gets expanded by the shell
|
130
|
-
verbose(false) { sh %{ruby test/check_expansion.rb #{expanded} someval} }
|
131
|
-
assert true, "should not fail"
|
132
|
-
assert_raises(RuntimeError) {
|
133
|
-
# This one does not get expanded
|
134
|
-
verbose(false) { sh 'ruby', 'test/check_expansion.rb', expanded, 'someval' }
|
135
|
-
}
|
136
|
-
end
|
137
|
-
|
138
|
-
def test_sh_failure
|
139
|
-
assert_raises(RuntimeError) {
|
140
|
-
verbose(false) { sh %{ruby test/shellcommand.rb 1} }
|
141
|
-
}
|
142
|
-
end
|
143
|
-
|
144
|
-
def test_sh_special_handling
|
145
|
-
count = 0
|
146
|
-
verbose(false) {
|
147
|
-
sh(%{ruby test/shellcommand.rb}) do |ok, res|
|
148
|
-
assert(ok)
|
149
|
-
assert_equal 0, res.exitstatus
|
150
|
-
count += 1
|
151
|
-
end
|
152
|
-
sh(%{ruby test/shellcommand.rb 1}) do |ok, res|
|
153
|
-
assert(!ok)
|
154
|
-
assert_equal 1, res.exitstatus
|
155
|
-
count += 1
|
156
|
-
end
|
157
|
-
}
|
158
|
-
assert_equal 2, count, "Block count should be 2"
|
159
|
-
end
|
160
|
-
|
161
|
-
def test_sh_noop
|
162
|
-
verbose(false) { sh %{test/shellcommand.rb 1}, :noop=>true }
|
163
|
-
assert true, "should not fail"
|
164
|
-
end
|
165
|
-
|
166
|
-
def test_sh_bad_option
|
167
|
-
ex = assert_raise(ArgumentError) {
|
168
|
-
verbose(false) { sh %{test/shellcommand.rb}, :bad_option=>true }
|
169
|
-
}
|
170
|
-
assert_match(/bad_option/, ex.message)
|
171
|
-
end
|
172
|
-
|
173
|
-
def test_sh_verbose
|
174
|
-
out = redirect_stderr {
|
175
|
-
verbose(true) {
|
176
|
-
sh %{test/shellcommand.rb}, :noop=>true
|
177
|
-
}
|
178
|
-
}
|
179
|
-
assert_match(/^test\/shellcommand\.rb$/, out)
|
180
|
-
end
|
181
|
-
|
182
|
-
def test_sh_no_verbose
|
183
|
-
out = redirect_stderr {
|
184
|
-
verbose(false) {
|
185
|
-
sh %{test/shellcommand.rb}, :noop=>true
|
186
|
-
}
|
187
|
-
}
|
188
|
-
assert_equal '', out
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_sh_default_is_no_verbose
|
192
|
-
out = redirect_stderr {
|
193
|
-
sh %{test/shellcommand.rb}, :noop=>true
|
194
|
-
}
|
195
|
-
assert_equal '', out
|
196
|
-
end
|
197
|
-
|
198
|
-
def test_ruby
|
199
|
-
verbose(false) do
|
200
|
-
ENV['RAKE_TEST_RUBY'] = "123"
|
201
|
-
block_run = false
|
202
|
-
# This one gets expanded by the shell
|
203
|
-
env_var = windows? ? '%RAKE_TEST_RUBY%' : '$RAKE_TEST_RUBY'
|
204
|
-
ruby %{-e "exit #{env_var}"} do |ok, status| # " (emacs wart)
|
205
|
-
assert(!ok)
|
206
|
-
assert_equal 123, status.exitstatus
|
207
|
-
block_run = true
|
208
|
-
end
|
209
|
-
assert block_run, "The block must be run"
|
210
|
-
|
211
|
-
if windows?
|
212
|
-
puts "SKIPPING test_ruby/part 2 when in windows"
|
213
|
-
else
|
214
|
-
# This one does not get expanded
|
215
|
-
block_run = false
|
216
|
-
ruby '-e', %{exit "#{env_var}".length} do |ok, status| # " (emacs wart)
|
217
|
-
assert(!ok)
|
218
|
-
assert_equal 15, status.exitstatus
|
219
|
-
block_run = true
|
220
|
-
end
|
221
|
-
assert block_run, "The block must be run"
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
def test_split_all
|
227
|
-
assert_equal ['a'], RakeFileUtils.split_all('a')
|
228
|
-
assert_equal ['..'], RakeFileUtils.split_all('..')
|
229
|
-
assert_equal ['/'], RakeFileUtils.split_all('/')
|
230
|
-
assert_equal ['a', 'b'], RakeFileUtils.split_all('a/b')
|
231
|
-
assert_equal ['/', 'a', 'b'], RakeFileUtils.split_all('/a/b')
|
232
|
-
assert_equal ['..', 'a', 'b'], RakeFileUtils.split_all('../a/b')
|
233
|
-
end
|
234
|
-
|
235
|
-
private
|
236
|
-
|
237
|
-
def redirect_stderr
|
238
|
-
old_err = $stderr
|
239
|
-
$stderr = StringIO.new
|
240
|
-
yield
|
241
|
-
$stderr.string
|
242
|
-
ensure
|
243
|
-
$stderr = old_err
|
244
|
-
end
|
245
|
-
|
246
|
-
def windows?
|
247
|
-
! File::ALT_SEPARATOR.nil?
|
248
|
-
end
|
249
|
-
|
250
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'date'
|
4
|
-
require 'time'
|
5
|
-
require 'test/unit'
|
6
|
-
require 'rake/contrib/ftptools'
|
7
|
-
|
8
|
-
class FakeDate
|
9
|
-
def self.today
|
10
|
-
Date.new(2003,10,3)
|
11
|
-
end
|
12
|
-
def self.now
|
13
|
-
Time.local(2003,10,3,12,00,00)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
class TestFtpFile < Test::Unit::TestCase
|
19
|
-
|
20
|
-
def setup
|
21
|
-
Rake::FtpFile.class_eval { @date_class = FakeDate; @time_class = FakeDate }
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_general
|
25
|
-
file = Rake::FtpFile.new("here", "-rw-r--r-- 1 a279376 develop 121770 Mar 6 14:50 wiki.pl")
|
26
|
-
assert_equal "wiki.pl", file.name
|
27
|
-
assert_equal "here/wiki.pl", file.path
|
28
|
-
assert_equal "a279376", file.owner
|
29
|
-
assert_equal "develop", file.group
|
30
|
-
assert_equal 0644, file.mode
|
31
|
-
assert_equal 121770, file.size
|
32
|
-
assert_equal Time.mktime(2003,3,6,14,50,0,0), file.time
|
33
|
-
assert ! file.directory?
|
34
|
-
assert ! file.symlink?
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_far_date
|
38
|
-
file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 2001 vss")
|
39
|
-
assert_equal Time.mktime(2001,11,26,0,0,0,0), file.time
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_close_date
|
43
|
-
file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 15:35 vss")
|
44
|
-
assert_equal Time.mktime(2002,11,26,15,35,0,0), file.time
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_directory
|
48
|
-
file = Rake::FtpFile.new(".", "drwxrwxr-x 9 a279376 develop 4096 Mar 13 14:32 working")
|
49
|
-
assert file.directory?
|
50
|
-
assert !file.symlink?
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_symlink
|
54
|
-
file = Rake::FtpFile.new(".", "lrwxrwxrwx 1 a279376 develop 64 Mar 26 2002 xtrac -> /home/a279376/working/ics/development/java/com/fmr/fwp/ics/xtrac")
|
55
|
-
assert_equal 'xtrac', file.name
|
56
|
-
assert file.symlink?
|
57
|
-
assert !file.directory?
|
58
|
-
end
|
59
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'rake'
|
5
|
-
|
6
|
-
######################################################################
|
7
|
-
class TestAnEmptyInvocationChain < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@empty = Rake::InvocationChain::EMPTY
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_should_be_able_to_add_members
|
14
|
-
assert_nothing_raised do
|
15
|
-
@empty.append("A")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_to_s
|
20
|
-
assert_equal "TOP", @empty.to_s
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
######################################################################
|
25
|
-
class TestAnInvocationChainWithOneMember < Test::Unit::TestCase
|
26
|
-
def setup
|
27
|
-
@empty = Rake::InvocationChain::EMPTY
|
28
|
-
@first_member = "A"
|
29
|
-
@chain = @empty.append(@first_member)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_should_report_first_member_as_a_member
|
33
|
-
assert @chain.member?(@first_member)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_should_fail_when_adding_original_member
|
37
|
-
ex = assert_raise RuntimeError do
|
38
|
-
@chain.append(@first_member)
|
39
|
-
end
|
40
|
-
assert_match(/circular +dependency/i, ex.message)
|
41
|
-
assert_match(/A.*=>.*A/, ex.message)
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_to_s
|
45
|
-
assert_equal "TOP => A", @chain.to_s
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
######################################################################
|
51
|
-
class TestAnInvocationChainWithMultipleMember < Test::Unit::TestCase
|
52
|
-
def setup
|
53
|
-
@first_member = "A"
|
54
|
-
@second_member = "B"
|
55
|
-
ch = Rake::InvocationChain::EMPTY.append(@first_member)
|
56
|
-
@chain = ch.append(@second_member)
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_should_report_first_member_as_a_member
|
60
|
-
assert @chain.member?(@first_member)
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_should_report_second_member_as_a_member
|
64
|
-
assert @chain.member?(@second_member)
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_should_fail_when_adding_original_member
|
68
|
-
ex = assert_raise RuntimeError do
|
69
|
-
@chain.append(@first_member)
|
70
|
-
end
|
71
|
-
assert_match(/A.*=>.*B.*=>.*A/, ex.message)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
|
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'rake'
|
5
|
-
require 'rake/loaders/makefile'
|
6
|
-
|
7
|
-
class TestMakefileLoader < Test::Unit::TestCase
|
8
|
-
include Rake
|
9
|
-
|
10
|
-
def test_parse
|
11
|
-
Task.clear
|
12
|
-
loader = Rake::MakefileLoader.new
|
13
|
-
loader.load("test/data/sample.mf")
|
14
|
-
%w(a b c d).each do |t|
|
15
|
-
assert Task.task_defined?(t), "#{t} should be a defined task"
|
16
|
-
end
|
17
|
-
assert_equal %w(a1 a2 a3 a4 a5 a6 a7).sort, Task['a'].prerequisites.sort
|
18
|
-
assert_equal %w(b1 b2 b3 b4 b5 b6 b7).sort, Task['b'].prerequisites.sort
|
19
|
-
assert_equal %w(c1).sort, Task['c'].prerequisites.sort
|
20
|
-
assert_equal %w(d1 d2).sort, Task['d'].prerequisites.sort
|
21
|
-
assert_equal %w(e1 f1).sort, Task['e'].prerequisites.sort
|
22
|
-
assert_equal %w(e1 f1).sort, Task['f'].prerequisites.sort
|
23
|
-
assert_equal 6, Task.tasks.size
|
24
|
-
end
|
25
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'rake'
|
5
|
-
|
6
|
-
######################################################################
|
7
|
-
class TestMultiTask < Test::Unit::TestCase
|
8
|
-
include Rake
|
9
|
-
|
10
|
-
def setup
|
11
|
-
Task.clear
|
12
|
-
@runs = Array.new
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_running_multitasks
|
16
|
-
task :a do 3.times do |i| @runs << "A#{i}"; sleep 0.01; end end
|
17
|
-
task :b do 3.times do |i| @runs << "B#{i}"; sleep 0.01; end end
|
18
|
-
multitask :both => [:a, :b]
|
19
|
-
Task[:both].invoke
|
20
|
-
assert_equal 6, @runs.size
|
21
|
-
assert @runs.index("A0") < @runs.index("A1")
|
22
|
-
assert @runs.index("A1") < @runs.index("A2")
|
23
|
-
assert @runs.index("B0") < @runs.index("B1")
|
24
|
-
assert @runs.index("B1") < @runs.index("B2")
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_all_multitasks_wait_on_slow_prerequisites
|
28
|
-
task :slow do 3.times do |i| @runs << "S#{i}"; sleep 0.05 end end
|
29
|
-
task :a => [:slow] do 3.times do |i| @runs << "A#{i}"; sleep 0.01 end end
|
30
|
-
task :b => [:slow] do 3.times do |i| @runs << "B#{i}"; sleep 0.01 end end
|
31
|
-
multitask :both => [:a, :b]
|
32
|
-
Task[:both].invoke
|
33
|
-
assert_equal 9, @runs.size
|
34
|
-
assert @runs.index("S0") < @runs.index("S1")
|
35
|
-
assert @runs.index("S1") < @runs.index("S2")
|
36
|
-
assert @runs.index("S2") < @runs.index("A0")
|
37
|
-
assert @runs.index("S2") < @runs.index("B0")
|
38
|
-
assert @runs.index("A0") < @runs.index("A1")
|
39
|
-
assert @runs.index("A1") < @runs.index("A2")
|
40
|
-
assert @runs.index("B0") < @runs.index("B1")
|
41
|
-
assert @runs.index("B1") < @runs.index("B2")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
|