rake 10.0.0.beta.2 → 13.0.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/macos.yml +22 -0
- data/.github/workflows/ubuntu-rvm.yml +28 -0
- data/.github/workflows/ubuntu.yml +20 -0
- data/.github/workflows/windows.yml +20 -0
- data/CONTRIBUTING.rdoc +43 -0
- data/Gemfile +10 -0
- data/History.rdoc +2359 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +57 -101
- data/Rakefile +22 -354
- data/bin/bundle +105 -0
- data/bin/console +7 -0
- data/bin/rake +19 -27
- data/bin/rdoc +29 -0
- data/bin/rubocop +29 -0
- data/bin/setup +6 -0
- data/doc/command_line_usage.rdoc +30 -18
- data/doc/glossary.rdoc +40 -49
- data/doc/jamis.rb +1 -0
- data/doc/rake.1 +156 -0
- data/doc/rakefile.rdoc +127 -62
- data/exe/rake +27 -0
- data/lib/rake.rb +35 -34
- data/lib/rake/application.rb +355 -188
- data/lib/rake/backtrace.rb +14 -7
- data/lib/rake/clean.rb +54 -8
- data/lib/rake/cloneable.rb +5 -4
- data/lib/rake/cpu_counter.rb +107 -0
- data/lib/rake/default_loader.rb +5 -0
- data/lib/rake/dsl_definition.rb +58 -19
- data/lib/rake/early_time.rb +5 -1
- data/lib/rake/ext/core.rb +5 -6
- data/lib/rake/ext/string.rb +61 -52
- data/lib/rake/file_creation_task.rb +4 -3
- data/lib/rake/file_list.rb +81 -49
- data/lib/rake/file_task.rb +15 -8
- data/lib/rake/file_utils.rb +63 -43
- data/lib/rake/file_utils_ext.rb +10 -22
- data/lib/rake/invocation_chain.rb +25 -19
- data/lib/rake/invocation_exception_mixin.rb +1 -0
- data/lib/rake/late_time.rb +18 -0
- data/lib/rake/linked_list.rb +112 -0
- data/lib/rake/loaders/makefile.rb +23 -9
- data/lib/rake/multi_task.rb +2 -1
- data/lib/rake/name_space.rb +36 -23
- data/lib/rake/packagetask.rb +71 -34
- data/lib/rake/phony.rb +6 -3
- data/lib/rake/private_reader.rb +21 -0
- data/lib/rake/promise.rb +100 -0
- data/lib/rake/pseudo_status.rb +8 -2
- data/lib/rake/rake_module.rb +34 -11
- data/lib/rake/rake_test_loader.rb +18 -13
- data/lib/rake/rule_recursion_overflow_error.rb +2 -2
- data/lib/rake/scope.rb +43 -0
- data/lib/rake/task.rb +166 -82
- data/lib/rake/task_argument_error.rb +1 -0
- data/lib/rake/task_arguments.rb +45 -14
- data/lib/rake/task_manager.rb +82 -50
- data/lib/rake/tasklib.rb +2 -12
- data/lib/rake/testtask.rb +68 -39
- data/lib/rake/thread_history_display.rb +10 -6
- data/lib/rake/thread_pool.rb +60 -86
- data/lib/rake/trace_output.rb +23 -0
- data/lib/rake/version.rb +6 -8
- data/lib/rake/win32.rb +14 -18
- data/rake.gemspec +36 -0
- metadata +64 -166
- data/.gemtest +0 -0
- data/CHANGES +0 -526
- data/TODO +0 -21
- data/doc/rake.1.gz +0 -0
- data/doc/release_notes/rake-0.4.14.rdoc +0 -23
- data/doc/release_notes/rake-0.4.15.rdoc +0 -35
- data/doc/release_notes/rake-0.5.0.rdoc +0 -53
- data/doc/release_notes/rake-0.5.3.rdoc +0 -78
- data/doc/release_notes/rake-0.5.4.rdoc +0 -46
- data/doc/release_notes/rake-0.6.0.rdoc +0 -141
- data/doc/release_notes/rake-0.7.0.rdoc +0 -119
- data/doc/release_notes/rake-0.7.1.rdoc +0 -59
- data/doc/release_notes/rake-0.7.2.rdoc +0 -121
- data/doc/release_notes/rake-0.7.3.rdoc +0 -47
- data/doc/release_notes/rake-0.8.0.rdoc +0 -114
- data/doc/release_notes/rake-0.8.2.rdoc +0 -165
- data/doc/release_notes/rake-0.8.3.rdoc +0 -112
- data/doc/release_notes/rake-0.8.4.rdoc +0 -147
- data/doc/release_notes/rake-0.8.5.rdoc +0 -53
- data/doc/release_notes/rake-0.8.6.rdoc +0 -55
- data/doc/release_notes/rake-0.8.7.rdoc +0 -55
- data/doc/release_notes/rake-0.9.0.rdoc +0 -112
- data/doc/release_notes/rake-0.9.1.rdoc +0 -52
- data/doc/release_notes/rake-0.9.2.2.rdoc +0 -55
- data/doc/release_notes/rake-0.9.2.rdoc +0 -49
- data/doc/release_notes/rake-0.9.3.rdoc +0 -102
- data/doc/release_notes/rake-10.0.0.rdoc +0 -178
- data/install.rb +0 -90
- data/lib/rake/alt_system.rb +0 -109
- data/lib/rake/contrib/compositepublisher.rb +0 -21
- data/lib/rake/contrib/ftptools.rb +0 -151
- data/lib/rake/contrib/publisher.rb +0 -73
- data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
- data/lib/rake/contrib/sshpublisher.rb +0 -50
- data/lib/rake/ext/module.rb +0 -0
- data/lib/rake/ext/time.rb +0 -14
- data/lib/rake/pathmap.rb +0 -1
- data/lib/rake/ruby182_test_unit_fix.rb +0 -25
- data/lib/rake/runtest.rb +0 -21
- data/test/file_creation.rb +0 -34
- data/test/helper.rb +0 -522
- data/test/test_rake.rb +0 -40
- data/test/test_rake_application.rb +0 -484
- data/test/test_rake_application_options.rb +0 -427
- data/test/test_rake_backtrace.rb +0 -67
- data/test/test_rake_clean.rb +0 -14
- data/test/test_rake_definitions.rb +0 -80
- data/test/test_rake_directory_task.rb +0 -57
- data/test/test_rake_dsl.rb +0 -40
- data/test/test_rake_early_time.rb +0 -31
- data/test/test_rake_extension.rb +0 -59
- data/test/test_rake_file_creation_task.rb +0 -56
- data/test/test_rake_file_list.rb +0 -628
- data/test/test_rake_file_list_path_map.rb +0 -8
- data/test/test_rake_file_task.rb +0 -122
- data/test/test_rake_file_utils.rb +0 -305
- data/test/test_rake_ftp_file.rb +0 -59
- data/test/test_rake_functional.rb +0 -472
- data/test/test_rake_invocation_chain.rb +0 -52
- data/test/test_rake_makefile_loader.rb +0 -44
- data/test/test_rake_multi_task.rb +0 -59
- data/test/test_rake_name_space.rb +0 -43
- data/test/test_rake_package_task.rb +0 -79
- data/test/test_rake_path_map.rb +0 -157
- data/test/test_rake_path_map_explode.rb +0 -34
- data/test/test_rake_path_map_partial.rb +0 -18
- data/test/test_rake_pseudo_status.rb +0 -21
- data/test/test_rake_rake_test_loader.rb +0 -21
- data/test/test_rake_reduce_compat.rb +0 -30
- data/test/test_rake_require.rb +0 -40
- data/test/test_rake_rules.rb +0 -327
- data/test/test_rake_task.rb +0 -316
- data/test/test_rake_task_argument_parsing.rb +0 -103
- data/test/test_rake_task_arguments.rb +0 -88
- data/test/test_rake_task_lib.rb +0 -9
- data/test/test_rake_task_manager.rb +0 -157
- data/test/test_rake_task_manager_argument_resolution.rb +0 -19
- data/test/test_rake_task_with_arguments.rb +0 -162
- data/test/test_rake_test_task.rb +0 -120
- data/test/test_rake_thread_pool.rb +0 -146
- data/test/test_rake_top_level_functions.rb +0 -71
- data/test/test_rake_win32.rb +0 -72
- data/test/test_thread_history_display.rb +0 -91
data/test/test_rake_task.rb
DELETED
@@ -1,316 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
class TestRakeTask < Rake::TestCase
|
5
|
-
include Rake
|
6
|
-
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
|
10
|
-
Task.clear
|
11
|
-
Rake::TaskManager.record_task_metadata = true
|
12
|
-
end
|
13
|
-
|
14
|
-
def teardown
|
15
|
-
Rake::TaskManager.record_task_metadata = false
|
16
|
-
|
17
|
-
super
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_create
|
21
|
-
arg = nil
|
22
|
-
t = task(:name) { |task| arg = task; 1234 }
|
23
|
-
assert_equal "name", t.name
|
24
|
-
assert_equal [], t.prerequisites
|
25
|
-
assert t.needed?
|
26
|
-
t.execute(0)
|
27
|
-
assert_equal t, arg
|
28
|
-
assert_nil t.source
|
29
|
-
assert_equal [], t.sources
|
30
|
-
assert_equal 1, t.locations.size
|
31
|
-
assert_match(/#{Regexp.quote(__FILE__)}/, t.locations.first)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_inspect
|
35
|
-
# t = task(:foo, :needs => [:bar, :baz])
|
36
|
-
t = task(:foo => [:bar, :baz])
|
37
|
-
assert_equal "<Rake::Task foo => [bar, baz]>", t.inspect
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_invoke
|
41
|
-
runlist = []
|
42
|
-
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
|
43
|
-
t2 = task(:t2) { |t| runlist << t.name }
|
44
|
-
t3 = task(:t3) { |t| runlist << t.name }
|
45
|
-
assert_equal ["t2", "t3"], t1.prerequisites
|
46
|
-
t1.invoke
|
47
|
-
assert_equal ["t2", "t3", "t1"], runlist
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_invoke_with_circular_dependencies
|
51
|
-
runlist = []
|
52
|
-
t1 = task(:t1 => [:t2]) { |t| runlist << t.name; 3321 }
|
53
|
-
t2 = task(:t2 => [:t1]) { |t| runlist << t.name }
|
54
|
-
assert_equal ["t2"], t1.prerequisites
|
55
|
-
assert_equal ["t1"], t2.prerequisites
|
56
|
-
ex = assert_raises RuntimeError do
|
57
|
-
t1.invoke
|
58
|
-
end
|
59
|
-
assert_match(/circular dependency/i, ex.message)
|
60
|
-
assert_match(/t1 => t2 => t1/, ex.message)
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_dry_run_prevents_actions
|
64
|
-
Rake.application.options.dryrun = true
|
65
|
-
runlist = []
|
66
|
-
t1 = task(:t1) { |t| runlist << t.name; 3321 }
|
67
|
-
_, err = capture_io { t1.invoke }
|
68
|
-
assert_match(/execute .*t1/i, err)
|
69
|
-
assert_match(/dry run/i, err)
|
70
|
-
refute_match(/invoke/i, err)
|
71
|
-
assert_equal [], runlist
|
72
|
-
ensure
|
73
|
-
Rake.application.options.dryrun = false
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_tasks_can_be_traced
|
77
|
-
Rake.application.options.trace = true
|
78
|
-
t1 = task(:t1)
|
79
|
-
_, err = capture_io {
|
80
|
-
t1.invoke
|
81
|
-
}
|
82
|
-
assert_match(/invoke t1/i, err)
|
83
|
-
assert_match(/execute t1/i, err)
|
84
|
-
ensure
|
85
|
-
Rake.application.options.trace = false
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_no_double_invoke
|
89
|
-
runlist = []
|
90
|
-
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
|
91
|
-
t2 = task(:t2 => [:t3]) { |t| runlist << t.name }
|
92
|
-
t3 = task(:t3) { |t| runlist << t.name }
|
93
|
-
t1.invoke
|
94
|
-
assert_equal ["t3", "t2", "t1"], runlist
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_can_double_invoke_with_reenable
|
98
|
-
runlist = []
|
99
|
-
t1 = task(:t1) { |t| runlist << t.name }
|
100
|
-
t1.invoke
|
101
|
-
t1.reenable
|
102
|
-
t1.invoke
|
103
|
-
assert_equal ["t1", "t1"], runlist
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_clear
|
107
|
-
desc "a task"
|
108
|
-
t = task("t" => "a") { }
|
109
|
-
t.clear
|
110
|
-
assert t.prerequisites.empty?, "prerequisites should be empty"
|
111
|
-
assert t.actions.empty?, "actions should be empty"
|
112
|
-
assert_nil t.comment, "comments should be empty"
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_clear_prerequisites
|
116
|
-
t = task("t" => ["a", "b"])
|
117
|
-
assert_equal ['a', 'b'], t.prerequisites
|
118
|
-
t.clear_prerequisites
|
119
|
-
assert_equal [], t.prerequisites
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_clear_actions
|
123
|
-
t = task("t") { }
|
124
|
-
t.clear_actions
|
125
|
-
assert t.actions.empty?, "actions should be empty"
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_clear_comments
|
129
|
-
desc "the original foo"
|
130
|
-
task :foo => [:x] do
|
131
|
-
# Dummy action
|
132
|
-
end
|
133
|
-
|
134
|
-
task(:foo).clear_comments
|
135
|
-
|
136
|
-
desc "a slightly different foo"
|
137
|
-
task :foo
|
138
|
-
|
139
|
-
assert_equal "a slightly different foo", task(:foo).comment
|
140
|
-
assert_equal ["x"], task(:foo).prerequisites
|
141
|
-
assert_equal 1, task(:foo).actions.size
|
142
|
-
end
|
143
|
-
|
144
|
-
def test_find
|
145
|
-
task :tfind
|
146
|
-
assert_equal "tfind", Task[:tfind].name
|
147
|
-
ex = assert_raises(RuntimeError) { Task[:leaves] }
|
148
|
-
assert_equal "Don't know how to build task 'leaves'", ex.message
|
149
|
-
end
|
150
|
-
|
151
|
-
def test_defined
|
152
|
-
assert ! Task.task_defined?(:a)
|
153
|
-
task :a
|
154
|
-
assert Task.task_defined?(:a)
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_multi_invocations
|
158
|
-
runs = []
|
159
|
-
p = proc do |t| runs << t.name end
|
160
|
-
task({:t1=>[:t2,:t3]}, &p)
|
161
|
-
task({:t2=>[:t3]}, &p)
|
162
|
-
task(:t3, &p)
|
163
|
-
Task[:t1].invoke
|
164
|
-
assert_equal ["t1", "t2", "t3"], runs.sort
|
165
|
-
end
|
166
|
-
|
167
|
-
def test_task_list
|
168
|
-
task :t2
|
169
|
-
task :t1 => [:t2]
|
170
|
-
assert_equal ["t1", "t2"], Task.tasks.collect {|t| t.name}
|
171
|
-
end
|
172
|
-
|
173
|
-
def test_task_gives_name_on_to_s
|
174
|
-
task :abc
|
175
|
-
assert_equal "abc", Task[:abc].to_s
|
176
|
-
end
|
177
|
-
|
178
|
-
def test_symbols_can_be_prerequisites
|
179
|
-
task :a => :b
|
180
|
-
assert_equal ["b"], Task[:a].prerequisites
|
181
|
-
end
|
182
|
-
|
183
|
-
def test_strings_can_be_prerequisites
|
184
|
-
task :a => "b"
|
185
|
-
assert_equal ["b"], Task[:a].prerequisites
|
186
|
-
end
|
187
|
-
|
188
|
-
def test_arrays_can_be_prerequisites
|
189
|
-
task :a => ["b", "c"]
|
190
|
-
assert_equal ["b", "c"], Task[:a].prerequisites
|
191
|
-
end
|
192
|
-
|
193
|
-
def test_filelists_can_be_prerequisites
|
194
|
-
task :a => FileList.new.include("b", "c")
|
195
|
-
assert_equal ["b", "c"], Task[:a].prerequisites
|
196
|
-
end
|
197
|
-
|
198
|
-
def test_prerequiste_tasks_returns_tasks_not_strings
|
199
|
-
a = task :a => ["b", "c"]
|
200
|
-
b = task :b
|
201
|
-
c = task :c
|
202
|
-
assert_equal [b, c], a.prerequisite_tasks
|
203
|
-
end
|
204
|
-
|
205
|
-
def test_prerequiste_tasks_fails_if_prerequisites_are_undefined
|
206
|
-
a = task :a => ["b", "c"]
|
207
|
-
b = task :b
|
208
|
-
assert_raises(RuntimeError) do
|
209
|
-
a.prerequisite_tasks
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
def test_prerequiste_tasks_honors_namespaces
|
214
|
-
a = b = nil
|
215
|
-
namespace "X" do
|
216
|
-
a = task :a => ["b", "c"]
|
217
|
-
b = task :b
|
218
|
-
end
|
219
|
-
c = task :c
|
220
|
-
|
221
|
-
assert_equal [b, c], a.prerequisite_tasks
|
222
|
-
end
|
223
|
-
|
224
|
-
def test_timestamp_returns_now_if_all_prereqs_have_no_times
|
225
|
-
a = task :a => ["b", "c"]
|
226
|
-
b = task :b
|
227
|
-
c = task :c
|
228
|
-
|
229
|
-
assert_in_delta Time.now, a.timestamp, 0.1, 'computer too slow?'
|
230
|
-
end
|
231
|
-
|
232
|
-
def test_timestamp_returns_latest_prereq_timestamp
|
233
|
-
a = task :a => ["b", "c"]
|
234
|
-
b = task :b
|
235
|
-
c = task :c
|
236
|
-
|
237
|
-
now = Time.now
|
238
|
-
def b.timestamp() Time.now + 10 end
|
239
|
-
def c.timestamp() Time.now + 5 end
|
240
|
-
|
241
|
-
assert_in_delta now, a.timestamp, 0.1, 'computer too slow?'
|
242
|
-
end
|
243
|
-
|
244
|
-
def test_always_multitask
|
245
|
-
mx = Mutex.new
|
246
|
-
result = []
|
247
|
-
|
248
|
-
t_a = task(:a) do |t|
|
249
|
-
sleep 0.02
|
250
|
-
mx.synchronize{ result << t.name }
|
251
|
-
end
|
252
|
-
|
253
|
-
t_b = task(:b) do |t|
|
254
|
-
mx.synchronize{ result << t.name }
|
255
|
-
end
|
256
|
-
|
257
|
-
t_c = task(:c => [:a,:b]) do |t|
|
258
|
-
mx.synchronize{ result << t.name }
|
259
|
-
end
|
260
|
-
|
261
|
-
t_c.invoke
|
262
|
-
|
263
|
-
# task should always run in order
|
264
|
-
assert_equal ['a', 'b', 'c'], result
|
265
|
-
|
266
|
-
[t_a, t_b, t_c].each { |t| t.reenable }
|
267
|
-
result.clear
|
268
|
-
|
269
|
-
Rake.application.options.always_multitask = true
|
270
|
-
t_c.invoke
|
271
|
-
|
272
|
-
# with multitask, task 'b' should grab the mutex first
|
273
|
-
assert_equal ['b', 'a', 'c'], result
|
274
|
-
end
|
275
|
-
|
276
|
-
def test_investigation_output
|
277
|
-
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
|
278
|
-
task(:t2)
|
279
|
-
task(:t3)
|
280
|
-
out = t1.investigation
|
281
|
-
assert_match(/class:\s*Rake::Task/, out)
|
282
|
-
assert_match(/needed:\s*true/, out)
|
283
|
-
assert_match(/pre-requisites:\s*--t[23]/, out)
|
284
|
-
end
|
285
|
-
|
286
|
-
|
287
|
-
def test_extended_comments
|
288
|
-
desc %{
|
289
|
-
This is a comment.
|
290
|
-
|
291
|
-
And this is the extended comment.
|
292
|
-
name -- Name of task to execute.
|
293
|
-
rev -- Software revision to use.
|
294
|
-
}
|
295
|
-
t = task(:t, :name, :rev)
|
296
|
-
assert_equal "[name,rev]", t.arg_description
|
297
|
-
assert_equal "This is a comment.", t.comment
|
298
|
-
assert_match(/^\s*name -- Name/, t.full_comment)
|
299
|
-
assert_match(/^\s*rev -- Software/, t.full_comment)
|
300
|
-
assert_match(/\A\s*This is a comment\.$/, t.full_comment)
|
301
|
-
end
|
302
|
-
|
303
|
-
def test_multiple_comments
|
304
|
-
desc "line one"
|
305
|
-
t = task(:t)
|
306
|
-
desc "line two"
|
307
|
-
task(:t)
|
308
|
-
assert_equal "line one / line two", t.comment
|
309
|
-
end
|
310
|
-
|
311
|
-
def test_settable_comments
|
312
|
-
t = task(:t)
|
313
|
-
t.comment = "HI"
|
314
|
-
assert_equal "HI", t.comment
|
315
|
-
end
|
316
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRakeTaskArgumentParsing < Rake::TestCase
|
4
|
-
def setup
|
5
|
-
super
|
6
|
-
|
7
|
-
@app = Rake::Application.new
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_name_only
|
11
|
-
name, args = @app.parse_task_string("name")
|
12
|
-
assert_equal "name", name
|
13
|
-
assert_equal [], args
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_empty_args
|
17
|
-
name, args = @app.parse_task_string("name[]")
|
18
|
-
assert_equal "name", name
|
19
|
-
assert_equal [], args
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_one_argument
|
23
|
-
name, args = @app.parse_task_string("name[one]")
|
24
|
-
assert_equal "name", name
|
25
|
-
assert_equal ["one"], args
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_two_arguments
|
29
|
-
name, args = @app.parse_task_string("name[one,two]")
|
30
|
-
assert_equal "name", name
|
31
|
-
assert_equal ["one", "two"], args
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_can_handle_spaces_between_args
|
35
|
-
name, args = @app.parse_task_string("name[one, two,\tthree , \tfour]")
|
36
|
-
assert_equal "name", name
|
37
|
-
assert_equal ["one", "two", "three", "four"], args
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_keeps_embedded_spaces
|
41
|
-
name, args = @app.parse_task_string("name[a one ana, two]")
|
42
|
-
assert_equal "name", name
|
43
|
-
assert_equal ["a one ana", "two"], args
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_terminal_width_using_env
|
47
|
-
app = Rake::Application.new
|
48
|
-
app.terminal_columns = 1234
|
49
|
-
|
50
|
-
assert_equal 1234, app.terminal_width
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_terminal_width_using_stty
|
54
|
-
def @app.unix?() true end
|
55
|
-
def @app.dynamic_width_stty() 1235 end
|
56
|
-
def @app.dynamic_width_tput() 0 end
|
57
|
-
|
58
|
-
assert_equal 1235, @app.terminal_width
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_terminal_width_using_tput
|
62
|
-
def @app.unix?() true end
|
63
|
-
def @app.dynamic_width_stty() 0 end
|
64
|
-
def @app.dynamic_width_tput() 1236 end
|
65
|
-
|
66
|
-
assert_equal 1236, @app.terminal_width
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_terminal_width_using_hardcoded_80
|
70
|
-
def @app.unix?() false end
|
71
|
-
|
72
|
-
assert_equal 80, @app.terminal_width
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_terminal_width_with_failure
|
76
|
-
def @app.unix?() raise end
|
77
|
-
|
78
|
-
assert_equal 80, @app.terminal_width
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_no_rakeopt
|
82
|
-
ARGV << '--trace'
|
83
|
-
app = Rake::Application.new
|
84
|
-
app.init
|
85
|
-
assert !app.options.silent
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_rakeopt_with_blank_options
|
89
|
-
ARGV << '--trace'
|
90
|
-
app = Rake::Application.new
|
91
|
-
app.init
|
92
|
-
assert !app.options.silent
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_rakeopt_with_silent_options
|
96
|
-
ENV['RAKEOPT'] = '-s'
|
97
|
-
app = Rake::Application.new
|
98
|
-
|
99
|
-
app.init
|
100
|
-
|
101
|
-
assert app.options.silent
|
102
|
-
end
|
103
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
######################################################################
|
4
|
-
class TestRakeTaskArguments < Rake::TestCase
|
5
|
-
def teardown
|
6
|
-
ENV.delete('rev')
|
7
|
-
ENV.delete('VER')
|
8
|
-
|
9
|
-
super
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_empty_arg_list_is_empty
|
13
|
-
ta = Rake::TaskArguments.new([], [])
|
14
|
-
assert_equal({}, ta.to_hash)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_multiple_values_in_args
|
18
|
-
ta = Rake::TaskArguments.new([:a, :b, :c], [:one, :two, :three])
|
19
|
-
assert_equal({:a => :one, :b => :two, :c => :three}, ta.to_hash)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_to_s
|
23
|
-
ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2, 3])
|
24
|
-
assert_equal ta.to_hash.inspect, ta.to_s
|
25
|
-
assert_equal ta.to_hash.inspect, ta.inspect
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_enumerable_behavior
|
29
|
-
ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2 ,3])
|
30
|
-
assert_equal [10, 20, 30], ta.collect { |k,v| v * 10 }.sort
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_named_args
|
34
|
-
ta = Rake::TaskArguments.new(["aa", "bb"], [1, 2])
|
35
|
-
assert_equal 1, ta.aa
|
36
|
-
assert_equal 1, ta[:aa]
|
37
|
-
assert_equal 1, ta["aa"]
|
38
|
-
assert_equal 2, ta.bb
|
39
|
-
assert_nil ta.cc
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_args_knows_its_names
|
43
|
-
ta = Rake::TaskArguments.new(["aa", "bb"], [1, 2])
|
44
|
-
assert_equal ["aa", "bb"], ta.names
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_extra_names_are_nil
|
48
|
-
ta = Rake::TaskArguments.new(["aa", "bb", "cc"], [1, 2])
|
49
|
-
assert_nil ta.cc
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_args_do_not_reference_env_values
|
53
|
-
ta = Rake::TaskArguments.new(["aa"], [1])
|
54
|
-
ENV['rev'] = "1.2"
|
55
|
-
ENV['VER'] = "2.3"
|
56
|
-
assert_nil ta.rev
|
57
|
-
assert_nil ta.ver
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_creating_new_argument_scopes
|
61
|
-
parent = Rake::TaskArguments.new(['p'], [1])
|
62
|
-
child = parent.new_scope(['c', 'p'])
|
63
|
-
assert_equal({:p=>1}, child.to_hash)
|
64
|
-
assert_equal 1, child.p
|
65
|
-
assert_equal 1, child["p"]
|
66
|
-
assert_equal 1, child[:p]
|
67
|
-
assert_nil child.c
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_child_hides_parent_arg_names
|
71
|
-
parent = Rake::TaskArguments.new(['aa'], [1])
|
72
|
-
child = Rake::TaskArguments.new(['aa'], [2], parent)
|
73
|
-
assert_equal 2, child.aa
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_default_arguments_values_can_be_merged
|
77
|
-
ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
|
78
|
-
ta.with_defaults({ :aa => 'default_val' })
|
79
|
-
assert_equal 'default_val', ta[:aa]
|
80
|
-
assert_equal 'original_val', ta[:bb]
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_default_arguments_that_dont_match_names_are_ignored
|
84
|
-
ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
|
85
|
-
ta.with_defaults({ "cc" => "default_val" })
|
86
|
-
assert_nil ta[:cc]
|
87
|
-
end
|
88
|
-
end
|