rake 0.9.2 → 13.0.3

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 +7 -0
  2. data/CONTRIBUTING.rdoc +43 -0
  3. data/Gemfile +10 -0
  4. data/History.rdoc +2386 -0
  5. data/MIT-LICENSE +1 -1
  6. data/README.rdoc +64 -109
  7. data/Rakefile +22 -386
  8. data/bin/bundle +105 -0
  9. data/bin/console +7 -0
  10. data/bin/rake +20 -23
  11. data/bin/rdoc +29 -0
  12. data/bin/rubocop +29 -0
  13. data/bin/setup +6 -0
  14. data/doc/command_line_usage.rdoc +65 -21
  15. data/doc/glossary.rdoc +40 -49
  16. data/doc/jamis.rb +1 -0
  17. data/doc/rake.1 +156 -0
  18. data/doc/rakefile.rdoc +127 -62
  19. data/exe/rake +27 -0
  20. data/lib/rake.rb +37 -31
  21. data/lib/rake/application.rb +507 -272
  22. data/lib/rake/backtrace.rb +24 -0
  23. data/lib/rake/clean.rb +55 -8
  24. data/lib/rake/cloneable.rb +11 -19
  25. data/lib/rake/cpu_counter.rb +107 -0
  26. data/lib/rake/default_loader.rb +5 -0
  27. data/lib/rake/dsl_definition.rb +74 -46
  28. data/lib/rake/early_time.rb +5 -1
  29. data/lib/rake/ext/core.rb +5 -6
  30. data/lib/rake/ext/string.rb +61 -52
  31. data/lib/rake/file_creation_task.rb +4 -3
  32. data/lib/rake/file_list.rb +81 -49
  33. data/lib/rake/file_task.rb +15 -8
  34. data/lib/rake/file_utils.rb +69 -47
  35. data/lib/rake/file_utils_ext.rb +18 -26
  36. data/lib/rake/invocation_chain.rb +25 -19
  37. data/lib/rake/invocation_exception_mixin.rb +1 -0
  38. data/lib/rake/late_time.rb +18 -0
  39. data/lib/rake/linked_list.rb +112 -0
  40. data/lib/rake/loaders/makefile.rb +23 -9
  41. data/lib/rake/multi_task.rb +4 -6
  42. data/lib/rake/name_space.rb +36 -23
  43. data/lib/rake/packagetask.rb +71 -34
  44. data/lib/rake/phony.rb +16 -0
  45. data/lib/rake/private_reader.rb +21 -0
  46. data/lib/rake/promise.rb +100 -0
  47. data/lib/rake/pseudo_status.rb +8 -2
  48. data/lib/rake/rake_module.rb +41 -3
  49. data/lib/rake/rake_test_loader.rb +21 -7
  50. data/lib/rake/rule_recursion_overflow_error.rb +2 -2
  51. data/lib/rake/scope.rb +43 -0
  52. data/lib/rake/task.rb +186 -79
  53. data/lib/rake/task_argument_error.rb +1 -0
  54. data/lib/rake/task_arguments.rb +50 -15
  55. data/lib/rake/task_manager.rb +89 -65
  56. data/lib/rake/tasklib.rb +2 -12
  57. data/lib/rake/testtask.rb +61 -63
  58. data/lib/rake/thread_history_display.rb +49 -0
  59. data/lib/rake/thread_pool.rb +163 -0
  60. data/lib/rake/trace_output.rb +23 -0
  61. data/lib/rake/version.rb +7 -7
  62. data/lib/rake/win32.rb +14 -18
  63. data/rake.gemspec +43 -0
  64. metadata +82 -221
  65. data/.gemtest +0 -0
  66. data/CHANGES +0 -509
  67. data/RRR +0 -9
  68. data/TODO +0 -20
  69. data/doc/rake.1.gz +0 -0
  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 -55
  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.rdoc +0 -49
  90. data/install.rb +0 -90
  91. data/lib/rake/alt_system.rb +0 -109
  92. data/lib/rake/classic_namespace.rb +0 -9
  93. data/lib/rake/contrib/compositepublisher.rb +0 -21
  94. data/lib/rake/contrib/ftptools.rb +0 -150
  95. data/lib/rake/contrib/publisher.rb +0 -69
  96. data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
  97. data/lib/rake/contrib/sshpublisher.rb +0 -45
  98. data/lib/rake/contrib/sys.rb +0 -191
  99. data/lib/rake/ext/module.rb +0 -39
  100. data/lib/rake/ext/time.rb +0 -14
  101. data/lib/rake/gempackagetask.rb +0 -13
  102. data/lib/rake/pathmap.rb +0 -1
  103. data/lib/rake/rdoctask.rb +0 -230
  104. data/lib/rake/ruby182_test_unit_fix.rb +0 -25
  105. data/lib/rake/runtest.rb +0 -21
  106. data/test/check_expansion.rb +0 -5
  107. data/test/check_no_expansion.rb +0 -5
  108. data/test/data/access/Rakefile +0 -35
  109. data/test/data/chains/Rakefile +0 -15
  110. data/test/data/comments/Rakefile +0 -18
  111. data/test/data/default/Rakefile +0 -17
  112. data/test/data/deprecated_import/Rakefile +0 -1
  113. data/test/data/dryrun/Rakefile +0 -22
  114. data/test/data/extra/Rakefile +0 -1
  115. data/test/data/file_creation_task/Rakefile +0 -31
  116. data/test/data/imports/Rakefile +0 -19
  117. data/test/data/imports/deps.mf +0 -1
  118. data/test/data/multidesc/Rakefile +0 -15
  119. data/test/data/namespace/Rakefile +0 -64
  120. data/test/data/rakelib/test1.rb +0 -4
  121. data/test/data/rbext/rakefile.rb +0 -3
  122. data/test/data/sample.mf +0 -14
  123. data/test/data/statusreturn/Rakefile +0 -6
  124. data/test/data/unittest/Rakefile +0 -1
  125. data/test/data/verbose/Rakefile +0 -34
  126. data/test/file_creation.rb +0 -34
  127. data/test/helper.rb +0 -44
  128. data/test/in_environment.rb +0 -35
  129. data/test/reqfile.rb +0 -3
  130. data/test/reqfile2.rb +0 -3
  131. data/test/shellcommand.rb +0 -3
  132. data/test/test_rake.rb +0 -38
  133. data/test/test_rake_application.rb +0 -364
  134. data/test/test_rake_application_options.rb +0 -382
  135. data/test/test_rake_clean.rb +0 -12
  136. data/test/test_rake_definitions.rb +0 -80
  137. data/test/test_rake_directory_task.rb +0 -55
  138. data/test/test_rake_dsl.rb +0 -73
  139. data/test/test_rake_early_time.rb +0 -31
  140. data/test/test_rake_extension.rb +0 -59
  141. data/test/test_rake_file_creation_task.rb +0 -62
  142. data/test/test_rake_file_list.rb +0 -633
  143. data/test/test_rake_file_list_path_map.rb +0 -8
  144. data/test/test_rake_file_task.rb +0 -104
  145. data/test/test_rake_file_utils.rb +0 -252
  146. data/test/test_rake_ftp_file.rb +0 -59
  147. data/test/test_rake_functional.rb +0 -468
  148. data/test/test_rake_invocation_chain.rb +0 -52
  149. data/test/test_rake_makefile_loader.rb +0 -23
  150. data/test/test_rake_multi_task.rb +0 -51
  151. data/test/test_rake_name_space.rb +0 -43
  152. data/test/test_rake_package_task.rb +0 -78
  153. data/test/test_rake_path_map.rb +0 -157
  154. data/test/test_rake_path_map_explode.rb +0 -31
  155. data/test/test_rake_path_map_partial.rb +0 -18
  156. data/test/test_rake_pseudo_status.rb +0 -20
  157. data/test/test_rake_rdoc_task.rb +0 -81
  158. data/test/test_rake_require.rb +0 -35
  159. data/test/test_rake_rules.rb +0 -346
  160. data/test/test_rake_task.rb +0 -271
  161. data/test/test_rake_task_argument_parsing.rb +0 -116
  162. data/test/test_rake_task_arguments.rb +0 -86
  163. data/test/test_rake_task_lib.rb +0 -9
  164. data/test/test_rake_task_manager.rb +0 -145
  165. data/test/test_rake_task_manager_argument_resolution.rb +0 -36
  166. data/test/test_rake_task_with_arguments.rb +0 -162
  167. data/test/test_rake_test_task.rb +0 -122
  168. data/test/test_rake_top_level_functions.rb +0 -76
  169. data/test/test_rake_win32.rb +0 -83
  170. data/test/test_sys.rb +0 -20
@@ -1,271 +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
- t = task("t" => "a") { }
108
- t.clear
109
- assert t.prerequisites.empty?, "prerequisites should be empty"
110
- assert t.actions.empty?, "actions should be empty"
111
- end
112
-
113
- def test_clear_prerequisites
114
- t = task("t" => ["a", "b"])
115
- assert_equal ['a', 'b'], t.prerequisites
116
- t.clear_prerequisites
117
- assert_equal [], t.prerequisites
118
- end
119
-
120
- def test_clear_actions
121
- t = task("t") { }
122
- t.clear_actions
123
- assert t.actions.empty?, "actions should be empty"
124
- end
125
-
126
- def test_find
127
- task :tfind
128
- assert_equal "tfind", Task[:tfind].name
129
- ex = assert_raises(RuntimeError) { Task[:leaves] }
130
- assert_equal "Don't know how to build task 'leaves'", ex.message
131
- end
132
-
133
- def test_defined
134
- assert ! Task.task_defined?(:a)
135
- task :a
136
- assert Task.task_defined?(:a)
137
- end
138
-
139
- def test_multi_invocations
140
- runs = []
141
- p = proc do |t| runs << t.name end
142
- task({:t1=>[:t2,:t3]}, &p)
143
- task({:t2=>[:t3]}, &p)
144
- task(:t3, &p)
145
- Task[:t1].invoke
146
- assert_equal ["t1", "t2", "t3"], runs.sort
147
- end
148
-
149
- def test_task_list
150
- task :t2
151
- task :t1 => [:t2]
152
- assert_equal ["t1", "t2"], Task.tasks.collect {|t| t.name}
153
- end
154
-
155
- def test_task_gives_name_on_to_s
156
- task :abc
157
- assert_equal "abc", Task[:abc].to_s
158
- end
159
-
160
- def test_symbols_can_be_prerequisites
161
- task :a => :b
162
- assert_equal ["b"], Task[:a].prerequisites
163
- end
164
-
165
- def test_strings_can_be_prerequisites
166
- task :a => "b"
167
- assert_equal ["b"], Task[:a].prerequisites
168
- end
169
-
170
- def test_arrays_can_be_prerequisites
171
- task :a => ["b", "c"]
172
- assert_equal ["b", "c"], Task[:a].prerequisites
173
- end
174
-
175
- def test_filelists_can_be_prerequisites
176
- task :a => FileList.new.include("b", "c")
177
- assert_equal ["b", "c"], Task[:a].prerequisites
178
- end
179
-
180
- def test_prerequiste_tasks_returns_tasks_not_strings
181
- a = task :a => ["b", "c"]
182
- b = task :b
183
- c = task :c
184
- assert_equal [b, c], a.prerequisite_tasks
185
- end
186
-
187
- def test_prerequiste_tasks_fails_if_prerequisites_are_undefined
188
- a = task :a => ["b", "c"]
189
- b = task :b
190
- assert_raises(RuntimeError) do
191
- a.prerequisite_tasks
192
- end
193
- end
194
-
195
- def test_prerequiste_tasks_honors_namespaces
196
- a = b = nil
197
- namespace "X" do
198
- a = task :a => ["b", "c"]
199
- b = task :b
200
- end
201
- c = task :c
202
-
203
- assert_equal [b, c], a.prerequisite_tasks
204
- end
205
-
206
- def test_timestamp_returns_now_if_all_prereqs_have_no_times
207
- a = task :a => ["b", "c"]
208
- b = task :b
209
- c = task :c
210
-
211
- faux_stamp = 100
212
- flexmock(Time, :now => faux_stamp)
213
-
214
- assert_equal faux_stamp, a.timestamp
215
- end
216
-
217
- def test_timestamp_returns_latest_prereq_timestamp
218
- a = task :a => ["b", "c"]
219
- b = task :b
220
- c = task :c
221
-
222
- faux_stamp = 100
223
- flexmock(Time, :now => faux_stamp-10)
224
- flexmock(b, :timestamp => faux_stamp - 1)
225
- flexmock(c, :timestamp => faux_stamp)
226
-
227
- assert_equal faux_stamp, a.timestamp
228
- end
229
-
230
- def test_investigation_output
231
- t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
232
- task(:t2)
233
- task(:t3)
234
- out = t1.investigation
235
- assert_match(/class:\s*Rake::Task/, out)
236
- assert_match(/needed:\s*true/, out)
237
- assert_match(/pre-requisites:\s*--t[23]/, out)
238
- end
239
-
240
-
241
- def test_extended_comments
242
- desc %{
243
- This is a comment.
244
-
245
- And this is the extended comment.
246
- name -- Name of task to execute.
247
- rev -- Software revision to use.
248
- }
249
- t = task(:t, :name, :rev)
250
- assert_equal "[name,rev]", t.arg_description
251
- assert_equal "This is a comment.", t.comment
252
- assert_match(/^\s*name -- Name/, t.full_comment)
253
- assert_match(/^\s*rev -- Software/, t.full_comment)
254
- assert_match(/\A\s*This is a comment\.$/, t.full_comment)
255
- end
256
-
257
- def test_multiple_comments
258
- desc "line one"
259
- t = task(:t)
260
- desc "line two"
261
- task(:t)
262
- assert_equal "line one / line two", t.comment
263
- end
264
-
265
- def test_settable_comments
266
- t = task(:t)
267
- t.comment = "HI"
268
- assert_equal "HI", t.comment
269
- end
270
- end
271
-
@@ -1,116 +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
- in_environment('RAKE_COLUMNS' => '1234') do
49
- assert_equal 1234, app.terminal_width
50
- end
51
- end
52
-
53
- def test_terminal_width_using_stty
54
- app = Rake::Application.new
55
- flexmock(app,
56
- :unix? => true,
57
- :dynamic_width_stty => 1235,
58
- :dynamic_width_tput => 0)
59
- in_environment('RAKE_COLUMNS' => nil) do
60
- assert_equal 1235, app.terminal_width
61
- end
62
- end
63
-
64
- def test_terminal_width_using_tput
65
- app = Rake::Application.new
66
- flexmock(app,
67
- :unix? => true,
68
- :dynamic_width_stty => 0,
69
- :dynamic_width_tput => 1236)
70
- in_environment('RAKE_COLUMNS' => nil) do
71
- assert_equal 1236, app.terminal_width
72
- end
73
- end
74
-
75
- def test_terminal_width_using_hardcoded_80
76
- app = Rake::Application.new
77
- flexmock(app, :unix? => false)
78
- in_environment('RAKE_COLUMNS' => nil) do
79
- assert_equal 80, app.terminal_width
80
- end
81
- end
82
-
83
- def test_terminal_width_with_failure
84
- app = Rake::Application.new
85
- flexmock(app).should_receive(:unix?).and_throw(RuntimeError)
86
- in_environment('RAKE_COLUMNS' => nil) do
87
- assert_equal 80, app.terminal_width
88
- end
89
- end
90
-
91
- def test_no_rakeopt
92
- in_environment do
93
- ARGV << '--trace'
94
- app = Rake::Application.new
95
- app.init
96
- assert !app.options.silent
97
- end
98
- end
99
-
100
- def test_rakeopt_with_blank_options
101
- in_environment("RAKEOPT" => "") do
102
- ARGV << '--trace'
103
- app = Rake::Application.new
104
- app.init
105
- assert !app.options.silent
106
- end
107
- end
108
-
109
- def test_rakeopt_with_silent_options
110
- in_environment("RAKEOPT" => "-s") do
111
- app = Rake::Application.new
112
- app.init
113
- assert app.options.silent
114
- end
115
- end
116
- end
@@ -1,86 +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
- end
9
-
10
- def test_empty_arg_list_is_empty
11
- ta = Rake::TaskArguments.new([], [])
12
- assert_equal({}, ta.to_hash)
13
- end
14
-
15
- def test_multiple_values_in_args
16
- ta = Rake::TaskArguments.new([:a, :b, :c], [:one, :two, :three])
17
- assert_equal({:a => :one, :b => :two, :c => :three}, ta.to_hash)
18
- end
19
-
20
- def test_to_s
21
- ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2, 3])
22
- assert_equal ta.to_hash.inspect, ta.to_s
23
- assert_equal ta.to_hash.inspect, ta.inspect
24
- end
25
-
26
- def test_enumerable_behavior
27
- ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2 ,3])
28
- assert_equal [10, 20, 30], ta.collect { |k,v| v * 10 }.sort
29
- end
30
-
31
- def test_named_args
32
- ta = Rake::TaskArguments.new(["aa", "bb"], [1, 2])
33
- assert_equal 1, ta.aa
34
- assert_equal 1, ta[:aa]
35
- assert_equal 1, ta["aa"]
36
- assert_equal 2, ta.bb
37
- assert_nil ta.cc
38
- end
39
-
40
- def test_args_knows_its_names
41
- ta = Rake::TaskArguments.new(["aa", "bb"], [1, 2])
42
- assert_equal ["aa", "bb"], ta.names
43
- end
44
-
45
- def test_extra_names_are_nil
46
- ta = Rake::TaskArguments.new(["aa", "bb", "cc"], [1, 2])
47
- assert_nil ta.cc
48
- end
49
-
50
- def test_args_do_not_reference_env_values
51
- ta = Rake::TaskArguments.new(["aa"], [1])
52
- ENV['rev'] = "1.2"
53
- ENV['VER'] = "2.3"
54
- assert_nil ta.rev
55
- assert_nil ta.ver
56
- end
57
-
58
- def test_creating_new_argument_scopes
59
- parent = Rake::TaskArguments.new(['p'], [1])
60
- child = parent.new_scope(['c', 'p'])
61
- assert_equal({:p=>1}, child.to_hash)
62
- assert_equal 1, child.p
63
- assert_equal 1, child["p"]
64
- assert_equal 1, child[:p]
65
- assert_nil child.c
66
- end
67
-
68
- def test_child_hides_parent_arg_names
69
- parent = Rake::TaskArguments.new(['aa'], [1])
70
- child = Rake::TaskArguments.new(['aa'], [2], parent)
71
- assert_equal 2, child.aa
72
- end
73
-
74
- def test_default_arguments_values_can_be_merged
75
- ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
76
- ta.with_defaults({ :aa => 'default_val' })
77
- assert_equal 'default_val', ta[:aa]
78
- assert_equal 'original_val', ta[:bb]
79
- end
80
-
81
- def test_default_arguments_that_dont_match_names_are_ignored
82
- ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
83
- ta.with_defaults({ "cc" => "default_val" })
84
- assert_nil ta[:cc]
85
- end
86
- end