rake 10.5.0 → 13.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/macos.yml +22 -0
  3. data/.github/workflows/ubuntu-rvm.yml +28 -0
  4. data/.github/workflows/ubuntu.yml +20 -0
  5. data/.github/workflows/windows.yml +20 -0
  6. data/CONTRIBUTING.rdoc +13 -8
  7. data/Gemfile +10 -0
  8. data/History.rdoc +1997 -288
  9. data/README.rdoc +27 -11
  10. data/Rakefile +25 -65
  11. data/bin/bundle +105 -0
  12. data/bin/console +7 -0
  13. data/bin/rake +20 -24
  14. data/bin/rdoc +29 -0
  15. data/bin/rubocop +29 -0
  16. data/bin/setup +6 -0
  17. data/doc/jamis.rb +1 -0
  18. data/doc/rake.1 +139 -124
  19. data/doc/rakefile.rdoc +2 -4
  20. data/exe/rake +27 -0
  21. data/lib/rake/application.rb +124 -90
  22. data/lib/rake/backtrace.rb +3 -2
  23. data/lib/rake/clean.rb +7 -5
  24. data/lib/rake/cloneable.rb +1 -0
  25. data/lib/rake/cpu_counter.rb +10 -28
  26. data/lib/rake/default_loader.rb +1 -0
  27. data/lib/rake/dsl_definition.rb +5 -11
  28. data/lib/rake/early_time.rb +1 -0
  29. data/lib/rake/ext/core.rb +1 -0
  30. data/lib/rake/ext/string.rb +22 -21
  31. data/lib/rake/file_creation_task.rb +4 -3
  32. data/lib/rake/file_list.rb +34 -27
  33. data/lib/rake/file_task.rb +12 -4
  34. data/lib/rake/file_utils.rb +38 -32
  35. data/lib/rake/file_utils_ext.rb +8 -18
  36. data/lib/rake/invocation_chain.rb +1 -0
  37. data/lib/rake/invocation_exception_mixin.rb +1 -0
  38. data/lib/rake/late_time.rb +2 -1
  39. data/lib/rake/linked_list.rb +24 -15
  40. data/lib/rake/loaders/makefile.rb +5 -4
  41. data/lib/rake/multi_task.rb +2 -1
  42. data/lib/rake/name_space.rb +1 -1
  43. data/lib/rake/packagetask.rb +40 -17
  44. data/lib/rake/phony.rb +2 -1
  45. data/lib/rake/private_reader.rb +1 -0
  46. data/lib/rake/promise.rb +13 -12
  47. data/lib/rake/pseudo_status.rb +1 -0
  48. data/lib/rake/rake_module.rb +30 -1
  49. data/lib/rake/rake_test_loader.rb +18 -13
  50. data/lib/rake/rule_recursion_overflow_error.rb +2 -2
  51. data/lib/rake/scope.rb +3 -2
  52. data/lib/rake/task.rb +82 -31
  53. data/lib/rake/task_argument_error.rb +1 -0
  54. data/lib/rake/task_arguments.rb +15 -4
  55. data/lib/rake/task_manager.rb +54 -30
  56. data/lib/rake/tasklib.rb +2 -14
  57. data/lib/rake/testtask.rb +39 -28
  58. data/lib/rake/thread_history_display.rb +4 -3
  59. data/lib/rake/thread_pool.rb +16 -17
  60. data/lib/rake/trace_output.rb +2 -1
  61. data/lib/rake/version.rb +4 -1
  62. data/lib/rake/win32.rb +10 -15
  63. data/lib/rake.rb +35 -43
  64. data/rake.gemspec +43 -0
  65. metadata +33 -216
  66. data/.autotest +0 -7
  67. data/.rubocop.yml +0 -27
  68. data/.togglerc +0 -7
  69. data/Manifest.txt +0 -166
  70. data/doc/release_notes/rake-0.4.14.rdoc +0 -23
  71. data/doc/release_notes/rake-0.4.15.rdoc +0 -35
  72. data/doc/release_notes/rake-0.5.0.rdoc +0 -53
  73. data/doc/release_notes/rake-0.5.3.rdoc +0 -78
  74. data/doc/release_notes/rake-0.5.4.rdoc +0 -46
  75. data/doc/release_notes/rake-0.6.0.rdoc +0 -141
  76. data/doc/release_notes/rake-0.7.0.rdoc +0 -119
  77. data/doc/release_notes/rake-0.7.1.rdoc +0 -59
  78. data/doc/release_notes/rake-0.7.2.rdoc +0 -121
  79. data/doc/release_notes/rake-0.7.3.rdoc +0 -47
  80. data/doc/release_notes/rake-0.8.0.rdoc +0 -114
  81. data/doc/release_notes/rake-0.8.2.rdoc +0 -165
  82. data/doc/release_notes/rake-0.8.3.rdoc +0 -112
  83. data/doc/release_notes/rake-0.8.4.rdoc +0 -147
  84. data/doc/release_notes/rake-0.8.5.rdoc +0 -53
  85. data/doc/release_notes/rake-0.8.6.rdoc +0 -37
  86. data/doc/release_notes/rake-0.8.7.rdoc +0 -55
  87. data/doc/release_notes/rake-0.9.0.rdoc +0 -112
  88. data/doc/release_notes/rake-0.9.1.rdoc +0 -52
  89. data/doc/release_notes/rake-0.9.2.2.rdoc +0 -55
  90. data/doc/release_notes/rake-0.9.2.rdoc +0 -49
  91. data/doc/release_notes/rake-0.9.3.rdoc +0 -102
  92. data/doc/release_notes/rake-0.9.4.rdoc +0 -60
  93. data/doc/release_notes/rake-0.9.5.rdoc +0 -55
  94. data/doc/release_notes/rake-0.9.6.rdoc +0 -64
  95. data/doc/release_notes/rake-10.0.0.rdoc +0 -178
  96. data/doc/release_notes/rake-10.0.1.rdoc +0 -58
  97. data/doc/release_notes/rake-10.0.2.rdoc +0 -53
  98. data/doc/release_notes/rake-10.0.3.rdoc +0 -191
  99. data/doc/release_notes/rake-10.1.0.rdoc +0 -61
  100. data/lib/rake/alt_system.rb +0 -110
  101. data/lib/rake/contrib/.document +0 -1
  102. data/lib/rake/contrib/compositepublisher.rb +0 -21
  103. data/lib/rake/contrib/ftptools.rb +0 -137
  104. data/lib/rake/contrib/publisher.rb +0 -81
  105. data/lib/rake/contrib/rubyforgepublisher.rb +0 -18
  106. data/lib/rake/contrib/sshpublisher.rb +0 -61
  107. data/lib/rake/contrib/sys.rb +0 -4
  108. data/lib/rake/ext/module.rb +0 -2
  109. data/lib/rake/ext/pathname.rb +0 -25
  110. data/lib/rake/ext/time.rb +0 -18
  111. data/lib/rake/gempackagetask.rb +0 -4
  112. data/lib/rake/pathmap.rb +0 -3
  113. data/lib/rake/rdoctask.rb +0 -4
  114. data/lib/rake/ruby182_test_unit_fix.rb +0 -29
  115. data/lib/rake/runtest.rb +0 -27
  116. data/rakelib/publish.rake +0 -20
  117. data/rakelib/test_times.rake +0 -25
  118. data/test/file_creation.rb +0 -34
  119. data/test/helper.rb +0 -129
  120. data/test/support/rakefile_definitions.rb +0 -478
  121. data/test/support/ruby_runner.rb +0 -34
  122. data/test/test_private_reader.rb +0 -42
  123. data/test/test_rake.rb +0 -40
  124. data/test/test_rake_application.rb +0 -643
  125. data/test/test_rake_application_options.rb +0 -468
  126. data/test/test_rake_backtrace.rb +0 -119
  127. data/test/test_rake_clean.rb +0 -61
  128. data/test/test_rake_cpu_counter.rb +0 -68
  129. data/test/test_rake_definitions.rb +0 -84
  130. data/test/test_rake_directory_task.rb +0 -76
  131. data/test/test_rake_dsl.rb +0 -40
  132. data/test/test_rake_early_time.rb +0 -31
  133. data/test/test_rake_extension.rb +0 -59
  134. data/test/test_rake_file_creation_task.rb +0 -56
  135. data/test/test_rake_file_list.rb +0 -670
  136. data/test/test_rake_file_list_path_map.rb +0 -8
  137. data/test/test_rake_file_task.rb +0 -197
  138. data/test/test_rake_file_utils.rb +0 -314
  139. data/test/test_rake_ftp_file.rb +0 -74
  140. data/test/test_rake_functional.rb +0 -482
  141. data/test/test_rake_invocation_chain.rb +0 -64
  142. data/test/test_rake_late_time.rb +0 -18
  143. data/test/test_rake_linked_list.rb +0 -84
  144. data/test/test_rake_makefile_loader.rb +0 -46
  145. data/test/test_rake_multi_task.rb +0 -64
  146. data/test/test_rake_name_space.rb +0 -57
  147. data/test/test_rake_package_task.rb +0 -79
  148. data/test/test_rake_path_map.rb +0 -168
  149. data/test/test_rake_path_map_explode.rb +0 -34
  150. data/test/test_rake_path_map_partial.rb +0 -18
  151. data/test/test_rake_pathname_extensions.rb +0 -15
  152. data/test/test_rake_pseudo_status.rb +0 -21
  153. data/test/test_rake_rake_test_loader.rb +0 -20
  154. data/test/test_rake_reduce_compat.rb +0 -26
  155. data/test/test_rake_require.rb +0 -40
  156. data/test/test_rake_rules.rb +0 -388
  157. data/test/test_rake_scope.rb +0 -44
  158. data/test/test_rake_task.rb +0 -393
  159. data/test/test_rake_task_argument_parsing.rb +0 -119
  160. data/test/test_rake_task_arguments.rb +0 -127
  161. data/test/test_rake_task_lib.rb +0 -9
  162. data/test/test_rake_task_manager.rb +0 -178
  163. data/test/test_rake_task_manager_argument_resolution.rb +0 -19
  164. data/test/test_rake_task_with_arguments.rb +0 -172
  165. data/test/test_rake_test_task.rb +0 -146
  166. data/test/test_rake_thread_pool.rb +0 -145
  167. data/test/test_rake_top_level_functions.rb +0 -71
  168. data/test/test_rake_win32.rb +0 -72
  169. data/test/test_thread_history_display.rb +0 -101
  170. data/test/test_trace_output.rb +0 -52
@@ -1,482 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
- require 'fileutils'
3
- require 'open3'
4
-
5
- class TestRakeFunctional < Rake::TestCase
6
- include RubyRunner
7
-
8
- def setup
9
- super
10
-
11
- if @verbose
12
- puts
13
- puts
14
- puts '-' * 80
15
- puts @__name__
16
- puts '-' * 80
17
- end
18
- end
19
-
20
- def test_rake_default
21
- rakefile_default
22
-
23
- rake
24
-
25
- assert_match(/^DEFAULT$/, @out)
26
- end
27
-
28
- def test_rake_error_on_bad_task
29
- rakefile_default
30
-
31
- rake '-t', 'xyz'
32
-
33
- assert_match(/rake aborted/, @err)
34
- end
35
-
36
- def test_env_available_at_top_scope
37
- rakefile_default
38
-
39
- rake "TESTTOPSCOPE=1"
40
-
41
- assert_match(/^TOPSCOPE$/, @out)
42
- end
43
-
44
- def test_env_available_at_task_scope
45
- rakefile_default
46
-
47
- rake 'TESTTASKSCOPE=1', 'task_scope'
48
-
49
- assert_match(/^TASKSCOPE$/, @out)
50
- end
51
-
52
- def test_multi_desc
53
- ENV['RAKE_COLUMNS'] = '80'
54
- rakefile_multidesc
55
-
56
- rake "-T"
57
-
58
- assert_match %r{^rake a *# A / A2 *$}, @out
59
- assert_match %r{^rake b *# B *$}, @out
60
- refute_match %r{^rake c}, @out
61
- assert_match %r{^rake d *# x{65}\.\.\.$}, @out
62
- end
63
-
64
- def test_long_description
65
- rakefile_multidesc
66
-
67
- rake "--describe"
68
-
69
- assert_match %r{^rake a\n *A\n *A2 *$}m, @out
70
- assert_match %r{^rake b\n *B *$}m, @out
71
- assert_match %r{^rake d\n *x{80}}m, @out
72
- refute_match %r{^rake c\n}m, @out
73
- end
74
-
75
- def test_proper_namespace_access
76
- rakefile_access
77
-
78
- rake
79
-
80
- refute_match %r{^BAD:}, @out
81
- end
82
-
83
- def test_rbext
84
- rakefile_rbext
85
-
86
- rake "-N"
87
-
88
- assert_match %r{^OK$}, @out
89
- end
90
-
91
- def test_system
92
- rake_system_dir
93
-
94
- rake '-g', "sys1"
95
-
96
- assert_match %r{^SYS1}, @out
97
- end
98
-
99
- def test_system_excludes_rakelib_files_too
100
- rake_system_dir
101
-
102
- rake '-g', "sys1", '-T', 'extra'
103
-
104
- refute_match %r{extra:extra}, @out
105
- end
106
-
107
- def test_by_default_rakelib_files_are_included
108
- rake_system_dir
109
- rakefile_extra
110
-
111
- rake '-T', 'extra', '--trace'
112
-
113
- assert_match %r{extra:extra}, @out
114
- end
115
-
116
- def test_implicit_system
117
- rake_system_dir
118
- Dir.chdir @tempdir
119
-
120
- rake "sys1", "--trace"
121
-
122
- assert_match %r{^SYS1}, @out
123
- end
124
-
125
- def test_no_system
126
- rake_system_dir
127
- rakefile_extra
128
-
129
- rake '-G', "sys1"
130
-
131
- assert_match %r{^Don't know how to build task}, @err # emacs wart: '
132
- end
133
-
134
- def test_nosearch_with_rakefile_uses_local_rakefile
135
- rakefile_default
136
-
137
- rake "--nosearch"
138
-
139
- assert_match %r{^DEFAULT}, @out
140
- end
141
-
142
- def test_nosearch_without_rakefile_finds_system
143
- rakefile_nosearch
144
- rake_system_dir
145
-
146
- rake "--nosearch", "sys1"
147
-
148
- assert_match %r{^SYS1}, @out
149
- end
150
-
151
- def test_nosearch_without_rakefile_and_no_system_fails
152
- rakefile_nosearch
153
- ENV['RAKE_SYSTEM'] = 'not_exist'
154
-
155
- rake "--nosearch"
156
-
157
- assert_match %r{^No Rakefile found}, @err
158
- end
159
-
160
- def test_invalid_command_line_options
161
- rakefile_default
162
-
163
- rake "--bad-options"
164
-
165
- assert_match %r{invalid +option}i, @err
166
- end
167
-
168
- def test_inline_verbose_default_should_show_command
169
- rakefile_verbose
170
-
171
- rake "inline_verbose_default"
172
-
173
- assert_match(/#{Regexp.quote(RUBY)} -e/, @err)
174
- end
175
-
176
- def test_inline_verbose_true_should_show_command
177
- rakefile_verbose
178
-
179
- rake "inline_verbose_true"
180
-
181
- assert_match(/#{Regexp.quote(RUBY)} -e/, @err)
182
- end
183
-
184
- def test_inline_verbose_false_should_not_show_command
185
- rakefile_verbose
186
-
187
- rake "inline_verbose_false"
188
-
189
- refute_match(/#{Regexp.quote(RUBY)} -e/, @err)
190
- end
191
-
192
- def test_block_verbose_false_should_not_show_command
193
- rakefile_verbose
194
-
195
- rake "block_verbose_false"
196
-
197
- refute_match(/#{Regexp.quote(RUBY)} -e/, @err)
198
- end
199
-
200
- def test_block_verbose_true_should_show_command
201
- rakefile_verbose
202
-
203
- rake "block_verbose_true"
204
-
205
- assert_match(/#{Regexp.quote(RUBY)} -e/, @err)
206
- end
207
-
208
- def test_standalone_verbose_true_should_show_command
209
- rakefile_verbose
210
-
211
- rake "standalone_verbose_true"
212
-
213
- assert_match(/#{Regexp.quote(RUBY)} -e/, @err)
214
- end
215
-
216
- def test_standalone_verbose_false_should_not_show_command
217
- rakefile_verbose
218
-
219
- rake "standalone_verbose_false"
220
-
221
- refute_match(/#{Regexp.quote(RUBY)} -e/, @err)
222
- end
223
-
224
- def test_dry_run
225
- rakefile_default
226
-
227
- rake "-n", "other"
228
-
229
- assert_match %r{Execute \(dry run\) default}, @err
230
- assert_match %r{Execute \(dry run\) other}, @err
231
- refute_match %r{DEFAULT}, @out
232
- refute_match %r{OTHER}, @out
233
- end
234
-
235
- # Test for the trace/dry_run bug found by Brian Chandler
236
- def test_dry_run_bug
237
- rakefile_dryrun
238
-
239
- rake
240
-
241
- FileUtils.rm_f 'temp_one'
242
-
243
- rake "--dry-run"
244
-
245
- refute_match(/No such file/, @out)
246
- end
247
-
248
- # Test for the trace/dry_run bug found by Brian Chandler
249
- def test_trace_bug
250
- rakefile_dryrun
251
-
252
- rake
253
-
254
- FileUtils.rm_f 'temp_one'
255
-
256
- rake "--trace"
257
-
258
- refute_match(/No such file/, @out)
259
- end
260
-
261
- def test_imports
262
- rakefile_imports
263
-
264
- rake
265
-
266
- assert File.exist?(File.join(@tempdir, 'dynamic_deps')),
267
- "'dynamic_deps' file should exist"
268
- assert_match(/^FIRST$\s+^DYNAMIC$\s+^STATIC$\s+^OTHER$/, @out)
269
- end
270
-
271
- def test_regenerate_imports
272
- rakefile_regenerate_imports
273
-
274
- rake
275
-
276
- assert_match(/^INITIAL\s+^REGENERATED$/, @out)
277
- end
278
-
279
- def test_rules_chaining_to_file_task
280
- rakefile_chains
281
-
282
- rake
283
-
284
- assert File.exist?(File.join(@tempdir, 'play.app')),
285
- "'play.app' file should exist"
286
- end
287
-
288
- def test_file_creation_task
289
- rakefile_file_creation
290
-
291
- rake "prep"
292
- rake "run"
293
- rake "run"
294
-
295
- assert(@err !~ /^cp src/, "Should not recopy data")
296
- end
297
-
298
- def test_dash_f_with_no_arg_foils_rakefile_lookup
299
- rakefile_rakelib
300
-
301
- rake '-I', 'rakelib', '-rtest1', '-f'
302
-
303
- assert_match(/^TEST1$/, @out)
304
- end
305
-
306
- def test_dot_rake_files_can_be_loaded_with_dash_r
307
- rakefile_rakelib
308
-
309
- rake '-I', 'rakelib', '-rtest2', '-f'
310
-
311
- assert_empty @err
312
- assert_match(/^TEST2$/, @out)
313
- end
314
-
315
- def test_can_invoke_task_in_toplevel_namespace
316
- rakefile_namespace
317
-
318
- rake "copy"
319
-
320
- assert_match(/^COPY$/, @out)
321
- end
322
-
323
- def test_can_invoke_task_in_nested_namespace
324
- rakefile_namespace
325
-
326
- rake "nest:copy"
327
-
328
- assert_match(/^NEST COPY$/, @out)
329
- end
330
-
331
- def test_tasks_can_reference_task_in_same_namespace
332
- rakefile_namespace
333
-
334
- rake "nest:xx"
335
-
336
- assert_match(/^NEST COPY$/m, @out)
337
- end
338
-
339
- def test_tasks_can_reference_task_in_other_namespaces
340
- rakefile_namespace
341
-
342
- rake "b:run"
343
-
344
- assert_match(/^IN A\nIN B$/m, @out)
345
- end
346
-
347
- def test_anonymous_tasks_can_be_invoked_indirectly
348
- rakefile_namespace
349
-
350
- rake "anon"
351
-
352
- assert_match(/^ANON COPY$/m, @out)
353
- end
354
-
355
- def test_rake_namespace_refers_to_toplevel
356
- rakefile_namespace
357
-
358
- rake "very:nested:run"
359
-
360
- assert_match(/^COPY$/m, @out)
361
- end
362
-
363
- def test_file_task_are_not_scoped_by_namespaces
364
- rakefile_namespace
365
-
366
- rake "xyz.rb"
367
-
368
- assert_match(/^XYZ1\nXYZ2$/m, @out)
369
- end
370
-
371
- def test_file_task_dependencies_scoped_by_namespaces
372
- rakefile_namespace
373
-
374
- rake "scopedep.rb"
375
-
376
- assert_match(/^PREPARE\nSCOPEDEP$/m, @out)
377
- end
378
-
379
- def test_test_task_descriptions
380
- rakefile_test_task
381
-
382
- rake "-T"
383
-
384
- assert_match(/custom test task description/, @out)
385
- end
386
-
387
- def test_comment_before_task_acts_like_desc
388
- rakefile_comments
389
-
390
- rake "-T"
391
-
392
- refute_match(/comment for t1/, @out)
393
- end
394
-
395
- def test_comment_separated_from_task_by_blank_line_is_not_picked_up
396
- rakefile_comments
397
-
398
- rake "-T"
399
-
400
- refute_match("t2", @out)
401
- end
402
-
403
- def test_comment_after_desc_is_ignored
404
- rakefile_comments
405
-
406
- rake "-T"
407
-
408
- assert_match("override comment for t3", @out)
409
- end
410
-
411
- def test_comment_before_desc_is_ignored
412
- rakefile_comments
413
-
414
- rake "-T"
415
-
416
- assert_match("override comment for t4", @out)
417
- end
418
-
419
- def test_correct_number_of_tasks_reported
420
- rakefile_comments
421
-
422
- rake "-T"
423
-
424
- assert_equal(2, @out.split(/\n/).grep(/t\d/).size)
425
- end
426
-
427
- def test_file_list_is_requirable_separately
428
- ruby '-rrake/file_list', '-e', 'puts Rake::FileList["a"].size'
429
- assert_equal "1\n", @out
430
- end
431
-
432
- def can_detect_signals?
433
- system RUBY, '-e', 'Process.kill "TERM", $$'
434
- status = $?
435
- if @verbose
436
- puts " SIG status = #{$?.inspect}"
437
- puts " SIG status.respond_to?(:signaled?) = " +
438
- "#{$?.respond_to?(:signaled?).inspect}"
439
- puts " SIG status.signaled? = #{status.signaled?}" if
440
- status.respond_to?(:signaled?)
441
- end
442
- status.respond_to?(:signaled?) && status.signaled?
443
- end
444
-
445
- def test_signal_propagation_in_tests
446
- if can_detect_signals?
447
- rakefile_test_signal
448
- rake
449
- assert_match(/ATEST/, @out)
450
- refute_match(/BTEST/, @out)
451
- else
452
- skip "Signal detect seems broken on this system"
453
- end
454
- end
455
-
456
- def test_failing_test_sets_exit_status
457
- skip if uncertain_exit_status?
458
- rakefile_failing_test_task
459
- rake
460
- assert @exit.exitstatus > 0, "should be non-zero"
461
- end
462
-
463
- def test_stand_alone_filelist
464
- rakefile_stand_alone_filelist
465
-
466
- run_ruby @ruby_options + ["stand_alone_filelist.rb"]
467
-
468
- assert_match(/^stand_alone_filelist\.rb$/, @out)
469
- assert_equal 0, @exit.exitstatus unless uncertain_exit_status?
470
- end
471
-
472
- private
473
-
474
- # We are unable to accurately verify that Rake returns a proper
475
- # error exit status using popen3 in Ruby 1.8.7 and JRuby. This
476
- # predicate function can be used to skip tests or assertions as
477
- # needed.
478
- def uncertain_exit_status?
479
- RUBY_VERSION < "1.9" || defined?(JRUBY_VERSION)
480
- end
481
-
482
- end
@@ -1,64 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class TestRakeInvocationChain < Rake::TestCase
4
- include Rake
5
-
6
- def setup
7
- super
8
-
9
- @empty = InvocationChain.empty
10
-
11
- @first_member = "A"
12
- @second_member = "B"
13
- @one = @empty.append(@first_member)
14
- @two = @one.append(@second_member)
15
- end
16
-
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
30
- chain = @empty.append("A")
31
-
32
- assert_equal 'TOP => A', chain.to_s # HACK
33
- end
34
-
35
- def test_append_one_circular
36
- ex = assert_raises RuntimeError do
37
- @one.append(@first_member)
38
- end
39
- assert_match(/circular +dependency/i, ex.message)
40
- assert_match(/A.*=>.*A/, ex.message)
41
- end
42
-
43
- def test_append_two_circular
44
- ex = assert_raises RuntimeError do
45
- @two.append(@first_member)
46
- end
47
- assert_match(/A.*=>.*B.*=>.*A/, ex.message)
48
- end
49
-
50
- def test_member_eh_one
51
- assert @one.member?(@first_member)
52
- end
53
-
54
- def test_member_eh_two
55
- assert @two.member?(@first_member)
56
- assert @two.member?(@second_member)
57
- end
58
-
59
- def test_to_s_empty
60
- assert_equal "TOP", @empty.to_s
61
- assert_equal "TOP => A", @one.to_s
62
- end
63
-
64
- end
@@ -1,18 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- class TestRakeLateTime < Rake::TestCase
4
- def test_late_time_comparisons
5
- late = Rake::LATE
6
- assert_equal late, late
7
- assert late >= Time.now
8
- assert late > Time.now
9
- assert late != Time.now
10
- assert Time.now < late
11
- assert Time.now <= late
12
- assert Time.now != late
13
- end
14
-
15
- def test_to_s
16
- assert_equal '<LATE TIME>', Rake::LATE.to_s
17
- end
18
- end
@@ -1,84 +0,0 @@
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_conversion_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_conversion_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
@@ -1,46 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
- require 'rake/loaders/makefile'
3
-
4
- class TestRakeMakefileLoader < Rake::TestCase
5
- include Rake
6
-
7
- def test_parse
8
- Dir.chdir @tempdir
9
-
10
- open 'sample.mf', 'w' do |io|
11
- io << <<-'SAMPLE_MF'
12
- # Comments
13
- a: a1 a2 a3 a4
14
- b: b1 b2 b3 \
15
- b4 b5 b6\
16
- # Mid: Comment
17
- b7
18
-
19
- a : a5 a6 a7
20
- c: c1
21
- d: d1 d2 \
22
-
23
- e f : e1 f1
24
-
25
- g\ 0: g1 g\ 2 g\ 3 g4
26
- SAMPLE_MF
27
- end
28
-
29
- Task.clear
30
- loader = Rake::MakefileLoader.new
31
- loader.load 'sample.mf'
32
- %w(a b c d).each do |t|
33
- assert Task.task_defined?(t), "#{t} should be a defined task"
34
- end
35
- assert_equal %w(a1 a2 a3 a4 a5 a6 a7).sort, Task['a'].prerequisites.sort
36
- assert_equal %w(b1 b2 b3 b4 b5 b6 b7).sort, Task['b'].prerequisites.sort
37
- assert_equal %w(c1).sort, Task['c'].prerequisites.sort
38
- assert_equal %w(d1 d2).sort, Task['d'].prerequisites.sort
39
- assert_equal %w(e1 f1).sort, Task['e'].prerequisites.sort
40
- assert_equal %w(e1 f1).sort, Task['f'].prerequisites.sort
41
- assert_equal(
42
- ["g1", "g 2", "g 3", "g4"].sort,
43
- Task['g 0'].prerequisites.sort)
44
- assert_equal 7, Task.tasks.size
45
- end
46
- end