rant 0.4.4 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +38 -0
- data/README +4 -2
- data/Rantfile +50 -12
- data/doc/examples/c_cpp/c++/problem_1_1/another_test.cpp +6 -0
- data/doc/examples/c_cpp/c++/problem_1_1/another_test.h +5 -0
- data/doc/examples/c_cpp/c++/problem_1_1/main.cpp +12 -0
- data/doc/examples/c_cpp/c++/problem_1_1/test.cpp +6 -0
- data/doc/examples/c_cpp/c++/problem_1_1/test.h +5 -0
- data/doc/examples/c_cpp/c++/template.rf +15 -0
- data/doc/examples/c_cpp/c/problem_1_1/another_test.c +6 -0
- data/doc/examples/c_cpp/c/problem_1_1/another_test.h +7 -0
- data/doc/examples/c_cpp/c/problem_1_1/main.c +12 -0
- data/doc/examples/c_cpp/c/problem_1_1/test.c +6 -0
- data/doc/examples/c_cpp/c/problem_1_1/test.h +7 -0
- data/doc/examples/c_cpp/c/template.rf +15 -0
- data/doc/examples/c_cpp/root.rant +46 -0
- data/doc/homepage/index.html +115 -0
- data/doc/homepage/rant_home.css +98 -0
- data/doc/rant.1 +129 -0
- data/doc/rant.rdoc +5 -6
- data/doc/rantfile.rdoc +55 -32
- data/doc/subdirs.rdoc +147 -0
- data/lib/rant.rb +47 -49
- data/lib/rant/coregen.rb +20 -20
- data/lib/rant/import.rb +63 -11
- data/lib/rant/import/archive.rb +47 -15
- data/lib/rant/import/archive/tgz.rb +1 -1
- data/lib/rant/import/autoclean.rb +28 -26
- data/lib/rant/import/c/dependencies.rb +1 -1
- data/lib/rant/import/directedrule.rb +1 -4
- data/lib/rant/import/metadata.rb +30 -7
- data/lib/rant/import/nodes/default.rb +67 -13
- data/lib/rant/import/rubypackage.rb +1 -1
- data/lib/rant/import/rubytest.rb +25 -19
- data/lib/rant/import/signedfile.rb +14 -8
- data/lib/rant/import/sys/more.rb +22 -0
- data/lib/rant/import/sys/tgz.rb +43 -0
- data/lib/rant/import/sys/zip.rb +42 -0
- data/lib/rant/node.rb +19 -13
- data/lib/rant/plugin/configure.rb +1 -1
- data/lib/rant/progress.rb +33 -0
- data/lib/rant/rantenv.rb +7 -7
- data/lib/rant/rantlib.rb +246 -256
- data/lib/rant/rantsys.rb +61 -22
- data/lib/rant/rantvar.rb +7 -9
- data/misc/TODO +18 -0
- data/misc/devel-notes +4 -1
- data/test/Rantfile +17 -3
- data/test/deprecated/README +6 -0
- data/test/deprecated/test_0_4_8.rb +41 -0
- data/test/deprecated/test_0_5_2.rb +33 -0
- data/test/import/md5/root.rant +9 -0
- data/test/import/md5/test_md5.rb +45 -0
- data/test/import/metadata/Rantfile +2 -2
- data/test/import/metadata/test_metadata.rb +2 -2
- data/test/import/package/test_package.rb +40 -1
- data/test/import/signedfile/sub1/Rantfile +1 -1
- data/test/import/sys/data/pkg.tgz +0 -0
- data/test/import/sys/data/pkg.zip +0 -0
- data/test/import/sys/data/pkg/bin/test +0 -0
- data/test/import/sys/data/pkg/bin/test.o +0 -0
- data/test/import/sys/data/pkg/test.c +6 -0
- data/test/import/sys/data/pkg/test.h +7 -0
- data/test/import/sys/data/pkg2.zip +0 -0
- data/test/import/sys/test_tgz.rb +38 -0
- data/test/import/sys/test_zip.rb +68 -0
- data/test/import/sys/tgz.rf +6 -0
- data/test/import/sys/zip.rf +15 -0
- data/test/project2/{rantfile.rb → root.rant} +0 -0
- data/test/project2/test_project.rb +3 -8
- data/test/project_rb1/{rantfile.rb → rantfile} +1 -1
- data/test/project_rb1/test_project_rb1.rb +3 -5
- data/test/rant-import/test_rant-import.rb +22 -10
- data/test/subdirs/sub1/Rantfile +1 -1
- data/test/subdirs/sub2/{rantfile.rb → rantfile} +0 -0
- data/test/subdirs/sub2/sub/rantfile +1 -1
- data/test/subdirs2/root.rant +36 -0
- data/test/subdirs2/sub00/sub.rant +8 -0
- data/test/subdirs2/sub1/sub.rant +13 -0
- data/test/subdirs2/test_subdirs2.rb +239 -0
- data/test/test_examples.rb +91 -0
- data/test/test_filetask.rb +51 -11
- data/test/test_rant_interface.rb +24 -0
- data/test/test_rantfile_api.rb +54 -2
- data/test/test_sourcenode.rb +30 -0
- data/test/test_sys.rb +143 -15
- data/test/test_task.rb +16 -22
- data/test/tutil.rb +22 -38
- metadata +67 -9
@@ -0,0 +1,239 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tutil'
|
4
|
+
|
5
|
+
$test_subdirs2_dir ||= File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class TestSubdirs2 < Test::Unit::TestCase
|
8
|
+
include Rant::TestUtil
|
9
|
+
|
10
|
+
def rootdir_rx(subdir=@subdir)
|
11
|
+
/^\(root is #$test_subdirs2_dir, in #{subdir}\)$/
|
12
|
+
end
|
13
|
+
def setup
|
14
|
+
# Ensure we run in test directory.
|
15
|
+
Dir.chdir($test_subdirs2_dir)
|
16
|
+
end
|
17
|
+
def teardown
|
18
|
+
Dir.chdir($test_subdirs2_dir)
|
19
|
+
assert_rant "autoclean"
|
20
|
+
assert Rant::FileList["**/*.t*"].shun(".svn").empty?
|
21
|
+
assert Rant::FileList["**/.rant.meta"].shun(".svn").empty?
|
22
|
+
end
|
23
|
+
def test_first
|
24
|
+
out, err = assert_rant
|
25
|
+
assert err.empty?
|
26
|
+
assert_equal "a\n", out
|
27
|
+
end
|
28
|
+
def test_subdir_task_from_commandline
|
29
|
+
out, err = assert_rant "sub1/a"
|
30
|
+
assert err.empty?
|
31
|
+
assert_equal "(in sub1)\nsub1/a\n", out
|
32
|
+
end
|
33
|
+
def test_first_in_subdir
|
34
|
+
Dir.chdir "sub1"
|
35
|
+
out, err = assert_rant
|
36
|
+
assert err.empty?
|
37
|
+
assert_equal "(root is #$test_subdirs2_dir, in sub1)\nsub1/a\n", out
|
38
|
+
end
|
39
|
+
def test_directory_in_subdir
|
40
|
+
Dir.chdir "sub1"
|
41
|
+
out, err = assert_rant "dir.t"
|
42
|
+
assert err.empty?
|
43
|
+
assert out.include?("mkdir")
|
44
|
+
assert test(?d, "dir.t")
|
45
|
+
out, err = assert_rant "dir.t"
|
46
|
+
assert err.empty?
|
47
|
+
assert !out.include?("mkdir")
|
48
|
+
end
|
49
|
+
def test_root_dir_task_in_subdir_from_commandline
|
50
|
+
Dir.chdir "sub1"
|
51
|
+
out, err = assert_rant "@a"
|
52
|
+
assert err.empty?
|
53
|
+
lines = out.split(/\n/)
|
54
|
+
assert_match(/^\(root is .*\)$/, lines[0])
|
55
|
+
assert lines.size < 4
|
56
|
+
assert_equal "a", lines.last
|
57
|
+
end
|
58
|
+
def test_root_dir_task_from_commandline
|
59
|
+
out, err = assert_rant "@a"
|
60
|
+
assert err.empty?
|
61
|
+
assert_equal "a\n", out
|
62
|
+
end
|
63
|
+
def test_fail_no_subdir_task
|
64
|
+
out, err = assert_rant :fail, "sub00/a.t"
|
65
|
+
assert out.empty?
|
66
|
+
assert_match(/\[ERROR\]/, err)
|
67
|
+
assert_match(/\bsub00\/a\.t\b/, err)
|
68
|
+
end
|
69
|
+
def test_ensure_read_sub_rant
|
70
|
+
Dir.chdir "sub00"
|
71
|
+
out, err = assert_rant
|
72
|
+
assert test(?f, "a.t")
|
73
|
+
assert test(?f, "../a.t")
|
74
|
+
|
75
|
+
out, err = assert_rant :fail, "autoclean"
|
76
|
+
assert_equal "(root is #$test_subdirs2_dir, in sub00)\n", out
|
77
|
+
assert_rant "@autoclean"
|
78
|
+
assert Dir["*.t"].empty?
|
79
|
+
end
|
80
|
+
def test_show_descriptions
|
81
|
+
out, err = assert_rant "-T"
|
82
|
+
assert err.empty?
|
83
|
+
assert_equal <<EOF, out
|
84
|
+
rant a # show full task name
|
85
|
+
rant sub1/b # noop
|
86
|
+
EOF
|
87
|
+
end
|
88
|
+
def test_show_descriptions_in_subdir
|
89
|
+
Dir.chdir "sub1"
|
90
|
+
out, err = assert_rant "-T"
|
91
|
+
assert err.empty?
|
92
|
+
lines = out.split(/\n/)
|
93
|
+
assert_equal 4, lines.size
|
94
|
+
assert_match(rootdir_rx("sub1"), lines[0])
|
95
|
+
assert_match(/^rant\s+#\s+=>\s+a$/, lines[1])
|
96
|
+
assert_match(/^rant b\s+#\s+noop$/, lines[2])
|
97
|
+
assert_match(/^rant @a\s+#\s+show full task name$/, lines[3])
|
98
|
+
end
|
99
|
+
def test_opt_look_up
|
100
|
+
in_local_temp_dir "t" do
|
101
|
+
out, err = assert_rant :fail
|
102
|
+
assert out.empty?
|
103
|
+
assert_match(/\[ERROR\].*no rantfile/i, err)
|
104
|
+
out, err = assert_rant "--look-up"
|
105
|
+
assert err.empty?
|
106
|
+
assert_equal "a", out.split(/\n/)[2]
|
107
|
+
in_local_temp_dir "t" do
|
108
|
+
out, err = assert_rant "--look-up", "a.t"
|
109
|
+
assert err.empty?
|
110
|
+
lines = out.split(/\n/)
|
111
|
+
assert_equal 4, lines.size
|
112
|
+
assert_match(rootdir_rx("t/t"), lines[0])
|
113
|
+
assert_equal "(in #$test_subdirs2_dir)", lines[1]
|
114
|
+
assert_equal "writing to b.t", lines[2]
|
115
|
+
assert_equal "writing to t/t/a.t", lines[3]
|
116
|
+
assert !test(?e, "../../a.t")
|
117
|
+
assert test(?f, "a.t")
|
118
|
+
assert test(?f, "../../b.t")
|
119
|
+
out, err = assert_rant "--look-up", "a.t"
|
120
|
+
assert err.empty?
|
121
|
+
lines = out.split(/\n/)
|
122
|
+
assert_equal 1, lines.size
|
123
|
+
assert_match rootdir_rx("t/t"), lines.first
|
124
|
+
out, err = assert_rant "-u", "@autoclean"
|
125
|
+
assert !test(?e, "../../b.t")
|
126
|
+
assert !test(?e, "a.t")
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
def test_opt_look_up_from_subdir
|
131
|
+
Dir.chdir "sub1"
|
132
|
+
out, err = assert_rant "-u", "dir.t"
|
133
|
+
assert err.empty?
|
134
|
+
assert out.include?("mkdir")
|
135
|
+
assert test(?d, "dir.t")
|
136
|
+
out, err = assert_rant "-u", "dir.t"
|
137
|
+
assert err.empty?
|
138
|
+
assert !out.include?("mkdir")
|
139
|
+
end
|
140
|
+
def test_opt_cd_parent
|
141
|
+
in_local_temp_dir "with space.t" do
|
142
|
+
out, err = assert_rant "--cd-parent"
|
143
|
+
assert err.empty?
|
144
|
+
lines = out.split(/\n/)
|
145
|
+
assert_equal 2, lines.size
|
146
|
+
assert_equal "(in #$test_subdirs2_dir)", lines[0]
|
147
|
+
assert_equal "a", lines[1]
|
148
|
+
in_local_temp_dir "a" do
|
149
|
+
orig_pwd = Dir.pwd
|
150
|
+
out, err = assert_rant "-c", "a.t"
|
151
|
+
assert_equal orig_pwd, Dir.pwd
|
152
|
+
assert err.empty?
|
153
|
+
lines = out.split(/\n/)
|
154
|
+
assert_equal 2, lines.size
|
155
|
+
assert_equal "(in #$test_subdirs2_dir)", lines[0]
|
156
|
+
assert_equal "writing to a.t", lines[1]
|
157
|
+
assert test(?f, "../../a.t")
|
158
|
+
assert_equal "a.t\n", File.read("../../a.t")
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
def test_opt_cd_parent_from_dir_with_rantfile
|
163
|
+
out, err = assert_rant "-c"
|
164
|
+
assert err.empty?
|
165
|
+
assert_equal "a\n", out
|
166
|
+
end
|
167
|
+
def test_opt_cd_parent_from_subdir
|
168
|
+
Dir.chdir "sub1"
|
169
|
+
out, err = assert_rant "-c"
|
170
|
+
assert err.empty?
|
171
|
+
lines = out.split(/\n/)
|
172
|
+
assert_equal 2, lines.size
|
173
|
+
assert_equal "(in #$test_subdirs2_dir)", lines[0]
|
174
|
+
assert_equal "a", lines[1]
|
175
|
+
end
|
176
|
+
def test_opt_cd_parent_from_subdir_sub
|
177
|
+
Dir.chdir "sub1"
|
178
|
+
in_local_temp_dir do
|
179
|
+
out, err = assert_rant "-c"
|
180
|
+
assert err.empty?
|
181
|
+
lines = out.split(/\n/)
|
182
|
+
assert_equal 2, lines.size
|
183
|
+
assert_equal "(in #$test_subdirs2_dir)", lines[0]
|
184
|
+
assert_equal "a", lines[1]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
def test_rant_import
|
188
|
+
run_import("-q", "--auto", "rant.t")
|
189
|
+
assert_exit
|
190
|
+
out = run_ruby("rant.t", "a.t")
|
191
|
+
assert_exit
|
192
|
+
assert test(?f, "a.t")
|
193
|
+
out = run_ruby("rant.t", "a.t")
|
194
|
+
assert_exit
|
195
|
+
assert out.empty?
|
196
|
+
Rant::Sys.safe_ln "rant.t", "sub1"
|
197
|
+
Dir.chdir "sub1"
|
198
|
+
out = run_ruby("rant.t", "dir.t")
|
199
|
+
assert_exit
|
200
|
+
assert test(?d, "dir.t")
|
201
|
+
out = run_ruby("rant.t", "@autoclean")
|
202
|
+
assert !test(?e, "dir.t")
|
203
|
+
ensure
|
204
|
+
Dir.chdir $test_subdirs2_dir
|
205
|
+
Rant::Sys.rm_f Dir["**/rant.t"]
|
206
|
+
end
|
207
|
+
def test_expand_path_md5_in_sub1
|
208
|
+
Dir.chdir "sub1"
|
209
|
+
out, err = assert_rant "-imd5", "sub.t"
|
210
|
+
assert err.empty?
|
211
|
+
assert !out.empty?
|
212
|
+
assert test(?f, "sub.t")
|
213
|
+
assert_equal "a.t\n", File.read("sub.t")
|
214
|
+
out, err = assert_rant "-imd5", "sub.t"
|
215
|
+
assert err.empty?
|
216
|
+
assert out !~ /writing to/
|
217
|
+
assert out !~ /\bcp\b/
|
218
|
+
Dir.chdir ".."
|
219
|
+
out, err = assert_rant "-imd5", "sub1/sub.t"
|
220
|
+
assert err.empty?
|
221
|
+
assert out.empty?
|
222
|
+
assert_rant "-imd5", "autoclean"
|
223
|
+
end
|
224
|
+
def test_expand_path
|
225
|
+
out, err = assert_rant "sub1/sub.t"
|
226
|
+
assert err.empty?
|
227
|
+
assert test(?f, "sub1/sub.t")
|
228
|
+
assert_equal "a.t\n", File.read("sub1/sub.t")
|
229
|
+
out, err = assert_rant "sub1/sub.t"
|
230
|
+
assert err.empty?
|
231
|
+
assert out.empty?
|
232
|
+
end
|
233
|
+
def test_define_in_current_subdir
|
234
|
+
Dir.chdir "sub00"
|
235
|
+
out, err = assert_rant "a"
|
236
|
+
assert err.empty?
|
237
|
+
assert_equal "sub00/a", out.split(/\n/).last
|
238
|
+
end
|
239
|
+
end
|
data/test/test_examples.rb
CHANGED
@@ -261,4 +261,95 @@ EOF
|
|
261
261
|
FileUtils.rm_f "c/problem_1_1/Rantfile"
|
262
262
|
FileUtils.rm_f "c++/problem_1_1/Rantfile"
|
263
263
|
end
|
264
|
+
def test_c_cpp
|
265
|
+
Dir.chdir "c_cpp"
|
266
|
+
proj_pwd = Dir.pwd
|
267
|
+
out, err = assert_rant("--tasks")
|
268
|
+
# TODO: replace with a not-so-strict regex
|
269
|
+
op = <<EOF
|
270
|
+
rant run # Run all C and C++ tests.
|
271
|
+
rant build # Build all.
|
272
|
+
rant autoclean # Remove all autogenerated files.
|
273
|
+
rant pkg/c_cpp.tgz # Create source package.
|
274
|
+
EOF
|
275
|
+
assert_equal(op, out)
|
276
|
+
assert(err.empty?)
|
277
|
+
gen_files = %w(
|
278
|
+
.rant.meta
|
279
|
+
c/problem_1_1/.rant.meta
|
280
|
+
c++/problem_1_1/.rant.meta
|
281
|
+
c/problem_1_1/sub.rant
|
282
|
+
c++/problem_1_1/sub.rant
|
283
|
+
c/problem_1_1/c_dependencies
|
284
|
+
c++/problem_1_1/c_dependencies
|
285
|
+
c/problem_1_1/test
|
286
|
+
c++/problem_1_1/test
|
287
|
+
c/problem_1_1/main.o
|
288
|
+
c++/problem_1_1/main.o
|
289
|
+
c/problem_1_1/test.o
|
290
|
+
c++/problem_1_1/test.o
|
291
|
+
c/problem_1_1/another_test.o
|
292
|
+
c++/problem_1_1/another_test.o
|
293
|
+
pkg
|
294
|
+
)
|
295
|
+
if Rant::Env.find_bin("gcc") && Rant::Env.find_bin("g++")
|
296
|
+
out = run_rant
|
297
|
+
assert_exit
|
298
|
+
assert_equal(2, out.scan(/Hello\, world\!/).size)
|
299
|
+
out, err = assert_rant("build")
|
300
|
+
assert(out.empty?)
|
301
|
+
assert(err.empty?)
|
302
|
+
else
|
303
|
+
STDERR.puts "*** gcc and/or g++ not available, less example testing ***"
|
304
|
+
end
|
305
|
+
assert_rant("pkg/c_cpp.tgz")
|
306
|
+
assert(test(?f, "pkg/c_cpp.tgz"))
|
307
|
+
# checking archive contents
|
308
|
+
sources = Rant::FileList["root.rant", "**/*.{c,cpp,h,rf}"]
|
309
|
+
sources.no_dir("pkg").resolve
|
310
|
+
assert sources.size > 10
|
311
|
+
Rant::Sys.unpack_tgz "pkg/c_cpp.tgz"
|
312
|
+
assert test(?d, "c_cpp")
|
313
|
+
sources.each { |fn|
|
314
|
+
pkg_fn = File.join("c_cpp", fn)
|
315
|
+
if test ?d, fn
|
316
|
+
assert test(?d, pkg_fn)
|
317
|
+
else
|
318
|
+
assert Rant::Sys.compare_file(fn, pkg_fn)
|
319
|
+
end
|
320
|
+
}
|
321
|
+
Rant::Sys.rm_rf "c_cpp"
|
322
|
+
out, err = assert_rant("pkg/c_cpp.tgz")
|
323
|
+
assert(out.empty?)
|
324
|
+
assert(err.empty?)
|
325
|
+
assert_rant("autoclean")
|
326
|
+
gen_files.each { |f|
|
327
|
+
assert(!test(?e, f),
|
328
|
+
"#{f} should have been removed by autoclean")
|
329
|
+
}
|
330
|
+
if Rant::Env.find_bin("gcc")
|
331
|
+
FileUtils.cp "c/template.rf", "c/problem_1_1/sub.rant"
|
332
|
+
Dir.chdir "c/problem_1_1"
|
333
|
+
out = run_rant
|
334
|
+
assert(out.include?("Hello, world!"))
|
335
|
+
|
336
|
+
# TODO
|
337
|
+
#assert_rant("autoclean")
|
338
|
+
|
339
|
+
FileUtils.rm_f "sub.rant"
|
340
|
+
Dir.chdir proj_pwd
|
341
|
+
|
342
|
+
# TODO: remove next line if TODO above is fixed
|
343
|
+
assert_rant("autoclean")
|
344
|
+
|
345
|
+
gen_files.each { |f|
|
346
|
+
assert(!test(?e, f),
|
347
|
+
"#{f} should have been removed by autoclean")
|
348
|
+
}
|
349
|
+
end
|
350
|
+
ensure
|
351
|
+
Dir.chdir proj_pwd
|
352
|
+
FileUtils.rm_f "c/problem_1_1/sub.rant"
|
353
|
+
FileUtils.rm_f "c++/problem_1_1/sub.rant"
|
354
|
+
end
|
264
355
|
end
|
data/test/test_filetask.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
|
2
2
|
require 'test/unit'
|
3
|
-
require '
|
3
|
+
require 'tutil'
|
4
4
|
|
5
5
|
$test_filetask_file = File.expand_path(__FILE__)
|
6
|
+
$test_dir ||= File.dirname($test_filetask_file)
|
6
7
|
|
7
8
|
class TestFileTask < Test::Unit::TestCase
|
9
|
+
include Rant::TestUtil
|
10
|
+
|
8
11
|
def setup
|
12
|
+
Dir.chdir $test_dir
|
13
|
+
@rant = Rant::RantApp.new
|
9
14
|
end
|
10
|
-
def teardown
|
11
|
-
end
|
12
|
-
|
13
15
|
def test_needed_non_existent
|
14
16
|
run = false
|
15
|
-
t = Rant::FileTask.new(
|
17
|
+
t = Rant::FileTask.new(@rant, "non_existent") { run = true }
|
16
18
|
assert(t.needed?,
|
17
19
|
"`non_existent' doesn't exist, so filetask is needed")
|
18
20
|
assert(!run,
|
@@ -20,38 +22,76 @@ class TestFileTask < Test::Unit::TestCase
|
|
20
22
|
end
|
21
23
|
def test_needed_no_dep
|
22
24
|
run = false
|
23
|
-
t =
|
25
|
+
t = @rant.file $test_filetask_file do
|
24
26
|
run = true
|
25
27
|
end
|
26
28
|
assert(!t.needed?,
|
27
29
|
"file exists and has no prerequisite, so needed? should return false")
|
28
30
|
assert(!run)
|
29
31
|
end
|
32
|
+
=begin
|
33
|
+
commented out due to a semantics change in 0.4.5
|
30
34
|
def test_single_dep
|
31
35
|
tr = false
|
32
|
-
t =
|
36
|
+
t = @rant.task :t do
|
33
37
|
tr = true
|
34
38
|
end
|
35
39
|
run = false
|
36
|
-
f =
|
40
|
+
f = @rant.file "testfile" => :t do
|
37
41
|
run = true
|
38
42
|
end
|
39
43
|
f.invoke
|
40
44
|
assert(tr)
|
41
45
|
assert(run)
|
42
46
|
end
|
47
|
+
=end
|
43
48
|
def test_prerequisites
|
44
|
-
|
49
|
+
@rant.file "a" do
|
45
50
|
true
|
46
51
|
end
|
47
|
-
|
52
|
+
@rant.file "b" do
|
48
53
|
true
|
49
54
|
end
|
50
|
-
f =
|
55
|
+
f = @rant.file "c" => %w(a b) do |t|
|
51
56
|
assert_equal(t.prerequisites, %w(a b),
|
52
57
|
"prerequisites should always be an array of _strings_")
|
53
58
|
true
|
54
59
|
end
|
55
60
|
f.invoke
|
56
61
|
end
|
62
|
+
def test_no_invoke_task_dep
|
63
|
+
write_to_file "print_name.t", "b\n"
|
64
|
+
out, err = assert_rant "depends_name.t"
|
65
|
+
assert err.empty?
|
66
|
+
assert test(?f, "depends_name.t")
|
67
|
+
assert_equal "b\na\n", File.read("depends_name.t")
|
68
|
+
assert_match(/writing.*depends_name\.t/, out)
|
69
|
+
assert !out.include?("print_name.t"),
|
70
|
+
"file task mustn't invoke task as prerequisite"
|
71
|
+
out, err = assert_rant "depends_name.t"
|
72
|
+
assert err.empty?
|
73
|
+
assert out.empty?
|
74
|
+
assert test(?f, "depends_name.t")
|
75
|
+
assert_equal "b\na\n", File.read("depends_name.t")
|
76
|
+
ensure
|
77
|
+
Rant::Sys.rm_f %w(print_name.t depends_name.t)
|
78
|
+
end
|
79
|
+
def test_no_invoke_task_dep_md5
|
80
|
+
write_to_file "print_name.t", "b\n"
|
81
|
+
out, err = assert_rant "-imd5", "depends_name.t"
|
82
|
+
assert err.empty?
|
83
|
+
assert test(?f, "depends_name.t")
|
84
|
+
assert_equal "b\na\n", File.read("depends_name.t")
|
85
|
+
assert_match(/writing.*depends_name\.t/, out)
|
86
|
+
assert !out.include?("print_name.t"),
|
87
|
+
"file task mustn't invoke task as prerequisite"
|
88
|
+
out, err = assert_rant "-imd5", "depends_name.t"
|
89
|
+
assert err.empty?
|
90
|
+
assert out.empty?
|
91
|
+
assert test(?f, "depends_name.t")
|
92
|
+
assert_equal "b\na\n", File.read("depends_name.t")
|
93
|
+
ensure
|
94
|
+
Rant::Sys.rm_f %w(auto.rf .rant.meta print_name.t depends_name.t)
|
95
|
+
Rant::Sys.rm_f Dir["*.t"]
|
96
|
+
end
|
57
97
|
end
|