drake 0.9.0.0.3.0 → 0.9.1.0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +9 -8
- data/CHANGES-drake +4 -0
- data/Rakefile +14 -49
- data/Rakefile-drake +2 -1
- data/bin/drake +4 -3
- data/doc/release_notes/rake-0.9.1.rdoc +52 -0
- data/lib/rake/dsl_definition.rb +19 -0
- data/lib/rake/version.rb +1 -1
- data/test/data/access/Rakefile +3 -1
- data/test/data/default/Rakefile +0 -2
- data/test/data/file_creation_task/Rakefile +0 -2
- data/test/data/multidesc/Rakefile +0 -2
- data/test/data/namespace/Rakefile +0 -2
- data/test/data/statusreturn/Rakefile +0 -2
- data/test/file_creation.rb +0 -2
- data/test/helper.rb +63 -0
- data/test/in_environment.rb +4 -1
- data/test/{parallel_setup.rb → setup_parallel.rb} +0 -0
- data/test/{serial_setup.rb → setup_serial.rb} +0 -0
- data/test/{lib/parallel_test.rb → test_parallel.rb} +3 -1
- data/test/{lib/rake_test.rb → test_rake.rb} +2 -5
- data/test/test_rake_application.rb +365 -0
- data/test/test_rake_application_options.rb +383 -0
- data/test/test_rake_clean.rb +14 -0
- data/test/{lib/definitions_test.rb → test_rake_definitions.rb} +5 -10
- data/test/test_rake_directory_task.rb +55 -0
- data/test/test_rake_dsl.rb +53 -0
- data/test/{lib/earlytime_test.rb → test_rake_early_time.rb} +2 -5
- data/test/{lib/extension_test.rb → test_rake_extension.rb} +2 -6
- data/test/{lib/file_creation_task_test.rb → test_rake_file_creation_task.rb} +7 -7
- data/test/{lib/filelist_test.rb → test_rake_file_list.rb} +18 -22
- data/test/test_rake_file_list_path_map.rb +8 -0
- data/test/{lib/file_task_test.rb → test_rake_file_task.rb} +22 -61
- data/test/{lib/fileutils_test.rb → test_rake_file_utils.rb} +11 -15
- data/test/{lib/ftp_test.rb → test_rake_ftp_file.rb} +5 -5
- data/test/{functional/session_based_tests.rb → test_rake_functional.rb} +35 -24
- data/test/test_rake_invocation_chain.rb +52 -0
- data/test/{lib/makefile_loader_test.rb → test_rake_makefile_loader.rb} +2 -5
- data/test/{lib/multitask_test.rb → test_rake_multi_task.rb} +5 -7
- data/test/{lib/namespace_test.rb → test_rake_name_space.rb} +4 -16
- data/test/{lib/package_task_test.rb → test_rake_package_task.rb} +2 -6
- data/test/{lib/pathmap_test.rb → test_rake_path_map.rb} +4 -58
- data/test/test_rake_path_map_explode.rb +31 -0
- data/test/test_rake_path_map_partial.rb +18 -0
- data/test/{lib/pseudo_status_test.rb → test_rake_pseudo_status.rb} +2 -8
- data/test/{lib/rdoc_task_test.rb → test_rake_rdoc_task.rb} +4 -7
- data/test/{lib/require_test.rb → test_rake_require.rb} +3 -9
- data/test/{lib/rules_test.rb → test_rake_rules.rb} +11 -13
- data/test/{lib/task_test.rb → test_rake_task.rb} +16 -183
- data/test/test_rake_task_argument_parsing.rb +126 -0
- data/test/{lib/task_arguments_test.rb → test_rake_task_arguments.rb} +2 -5
- data/test/{lib/tasklib_test.rb → test_rake_task_lib.rb} +2 -5
- data/test/{lib/task_manager_test.rb → test_rake_task_manager.rb} +7 -45
- data/test/test_rake_task_manager_argument_resolution.rb +36 -0
- data/test/test_rake_task_with_arguments.rb +162 -0
- data/test/{lib/test_task_test.rb → test_rake_test_task.rb} +52 -7
- data/test/{lib/top_level_functions_test.rb → test_rake_top_level_functions.rb} +8 -20
- data/test/{lib/win32_test.rb → test_rake_win32.rb} +5 -12
- data/test/{contrib/test_sys.rb → test_sys.rb} +2 -6
- metadata +62 -47
- data/lib/rake/dsl.rb +0 -2
- data/test/capture_stdout.rb +0 -26
- data/test/functional/functional_test.rb +0 -25
- data/test/lib/application_test.rb +0 -871
- data/test/lib/clean_test.rb +0 -15
- data/test/lib/dsl_test.rb +0 -52
- data/test/lib/invocation_chain_test.rb +0 -81
- data/test/lib/testtask_test.rb +0 -49
- data/test/rake_test_setup.rb +0 -41
- data/test/ruby_version_test.rb +0 -3
- data/test/test_helper.rb +0 -19
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
2
|
+
|
3
|
+
class TestRakeDsl < Rake::TestCase
|
4
|
+
|
5
|
+
def test_namespace_command
|
6
|
+
namespace "n" do
|
7
|
+
task "t"
|
8
|
+
end
|
9
|
+
refute_nil Rake::Task["n:t"]
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_namespace_command_with_bad_name
|
13
|
+
ex = assert_raises(ArgumentError) do
|
14
|
+
namespace 1 do end
|
15
|
+
end
|
16
|
+
assert_match(/string/i, ex.message)
|
17
|
+
assert_match(/symbol/i, ex.message)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_namespace_command_with_a_string_like_object
|
21
|
+
name = Object.new
|
22
|
+
def name.to_str
|
23
|
+
"bob"
|
24
|
+
end
|
25
|
+
namespace name do
|
26
|
+
task "t"
|
27
|
+
end
|
28
|
+
refute_nil Rake::Task["bob:t"]
|
29
|
+
end
|
30
|
+
|
31
|
+
class Foo
|
32
|
+
def initialize
|
33
|
+
task :foo_deprecated_a => "foo_deprecated_b" do
|
34
|
+
print "a"
|
35
|
+
end
|
36
|
+
file "foo_deprecated_b" do
|
37
|
+
print "b"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_deprecated_object_dsl
|
43
|
+
out, err = capture_io do
|
44
|
+
Foo.new
|
45
|
+
Rake.application.invoke_task :foo_deprecated_a
|
46
|
+
end
|
47
|
+
assert_equal("ba", out)
|
48
|
+
assert_match(/deprecated/, err)
|
49
|
+
assert_match(/Foo\#task/, err)
|
50
|
+
assert_match(/Foo\#file/, err)
|
51
|
+
assert_match(/test_rake_dsl\.rb:\d+/, err)
|
52
|
+
end
|
53
|
+
end
|
@@ -1,9 +1,6 @@
|
|
1
|
-
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
|
-
|
4
|
-
require 'rake'
|
5
|
-
|
6
|
-
class TestEarlyTime < Test::Unit::TestCase
|
3
|
+
class TestRakeEarlyTime < Rake::TestCase
|
7
4
|
def test_create
|
8
5
|
early = Rake::EarlyTime.instance
|
9
6
|
assert early <= Time.now
|
@@ -1,11 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'rake'
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
5
2
|
require 'stringio'
|
6
3
|
|
7
|
-
|
8
|
-
class TestExtension < Test::Unit::TestCase
|
4
|
+
class TestRakeExtension < Rake::TestCase
|
9
5
|
|
10
6
|
module Redirect
|
11
7
|
def error_redirect
|
@@ -1,23 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'test/unit'
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
4
2
|
require 'fileutils'
|
5
|
-
require 'rake'
|
6
|
-
require 'test/file_creation'
|
7
3
|
|
8
4
|
######################################################################
|
9
|
-
class
|
5
|
+
class TestRakeFileCreationTask < Rake::TestCase
|
10
6
|
include Rake
|
11
|
-
include
|
7
|
+
include Rake::DSL
|
12
8
|
|
13
9
|
DUMMY_DIR = 'testdata/dummy_dir'
|
14
10
|
|
15
11
|
def setup
|
12
|
+
super
|
13
|
+
|
16
14
|
Task.clear
|
17
15
|
end
|
18
16
|
|
19
17
|
def teardown
|
20
18
|
FileUtils.rm_rf DUMMY_DIR
|
19
|
+
|
20
|
+
super
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_file_needed
|
@@ -1,23 +1,19 @@
|
|
1
|
-
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
|
-
|
4
|
-
require 'rake'
|
5
|
-
|
6
|
-
require 'test/capture_stdout'
|
7
|
-
require 'test/rake_test_setup'
|
8
|
-
|
9
|
-
class TestFileList < Test::Unit::TestCase
|
3
|
+
class TestRakeFileList < Rake::TestCase
|
10
4
|
FileList = Rake::FileList
|
11
|
-
include CaptureStdout
|
12
|
-
include TestMethods
|
13
5
|
|
14
6
|
def setup
|
7
|
+
super
|
8
|
+
|
15
9
|
create_test_data
|
16
10
|
end
|
17
11
|
|
18
12
|
def teardown
|
19
13
|
# FileList.select_default_ignore_patterns
|
20
14
|
FileUtils.rm_rf("testdata")
|
15
|
+
|
16
|
+
super
|
21
17
|
end
|
22
18
|
|
23
19
|
def test_delegating_methods_do_not_include_to_a_or_to_ary
|
@@ -90,8 +86,8 @@ class TestFileList < Test::Unit::TestCase
|
|
90
86
|
|
91
87
|
def test_match
|
92
88
|
fl = FileList.new
|
93
|
-
fl.include('test/
|
94
|
-
assert fl.include?("test/
|
89
|
+
fl.include('test/test_*.rb')
|
90
|
+
assert fl.include?("test/test_rake_file_list.rb")
|
95
91
|
assert fl.size > 3
|
96
92
|
fl.each { |fn| assert_match(/\.rb$/, fn) }
|
97
93
|
end
|
@@ -99,10 +95,10 @@ class TestFileList < Test::Unit::TestCase
|
|
99
95
|
def test_add_matching
|
100
96
|
fl = FileList.new
|
101
97
|
fl << "a.java"
|
102
|
-
fl.include("test
|
98
|
+
fl.include("test/*.rb")
|
103
99
|
assert_equal "a.java", fl[0]
|
104
100
|
assert fl.size > 2
|
105
|
-
assert fl.include?("test/
|
101
|
+
assert fl.include?("test/test_rake_file_list.rb")
|
106
102
|
end
|
107
103
|
|
108
104
|
def test_multiple_patterns
|
@@ -329,32 +325,32 @@ class TestFileList < Test::Unit::TestCase
|
|
329
325
|
end
|
330
326
|
|
331
327
|
def test_egrep_with_output
|
332
|
-
files = FileList['test/
|
328
|
+
files = FileList['test/test_*.rb']
|
333
329
|
the_line_number = __LINE__ + 1
|
334
|
-
out =
|
330
|
+
out, = capture_io do files.egrep(/PUGH/) end
|
335
331
|
assert_match(/:#{the_line_number}:/, out)
|
336
332
|
end
|
337
333
|
|
338
334
|
def test_egrep_with_block
|
339
|
-
files = FileList['test/
|
335
|
+
files = FileList['test/test_*.rb']
|
340
336
|
found = nil
|
341
337
|
the_line_number = __LINE__ + 1
|
342
338
|
files.egrep(/XYZZY/) do |fn, ln, line |
|
343
339
|
found = [fn, ln, line]
|
344
340
|
end
|
345
|
-
assert_equal 'test/
|
341
|
+
assert_equal 'test/test_rake_file_list.rb', found[0]
|
346
342
|
assert_equal the_line_number, found[1]
|
347
343
|
assert_match(/files\.egrep/, found[2])
|
348
344
|
end
|
349
345
|
|
350
346
|
def test_egrep_with_error
|
351
|
-
files = FileList['test/
|
352
|
-
|
347
|
+
files = FileList['test/test_*.rb']
|
348
|
+
_, err = capture_io do
|
353
349
|
files.egrep(/ANYTHING/) do |fn, ln, line |
|
354
350
|
fail "_EGREP_FAILURE_"
|
355
351
|
end
|
356
352
|
end
|
357
|
-
assert_match(/_EGREP_FAILURE_/,
|
353
|
+
assert_match(/_EGREP_FAILURE_/, err)
|
358
354
|
end
|
359
355
|
|
360
356
|
def test_existing
|
@@ -461,7 +457,7 @@ class TestFileList < Test::Unit::TestCase
|
|
461
457
|
a = FileList['a', 'b', 'c']
|
462
458
|
a.freeze
|
463
459
|
c = a.clone
|
464
|
-
|
460
|
+
assert_raises(TypeError, RuntimeError) do
|
465
461
|
c << 'more'
|
466
462
|
end
|
467
463
|
end
|
@@ -1,20 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'test/unit'
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
4
2
|
require 'fileutils'
|
5
|
-
require 'rake'
|
6
|
-
require 'test/file_creation'
|
7
|
-
require 'test/rake_test_setup'
|
8
3
|
|
9
|
-
|
10
|
-
class TestFileTask < Test::Unit::TestCase
|
4
|
+
class TestRakeFileTask < Rake::TestCase
|
11
5
|
include Rake
|
12
|
-
include FileCreation
|
13
|
-
include TestMethods
|
14
6
|
|
15
7
|
FILES = [ANCIENT_FILE, OLDFILE, MIDDLE_AGED_FILE, NEWFILE]
|
16
8
|
|
17
9
|
def setup
|
10
|
+
super
|
11
|
+
|
18
12
|
Task.clear
|
19
13
|
@runs = ThreadSafeArray.new
|
20
14
|
FileUtils.rm_rf "testdata", :verbose => false
|
@@ -31,15 +25,23 @@ class TestFileTask < Test::Unit::TestCase
|
|
31
25
|
end
|
32
26
|
|
33
27
|
def test_file_need
|
28
|
+
FileUtils.mkdir_p 'testdata' # HACK use tmpdir
|
29
|
+
|
34
30
|
name = "testdata/dummy"
|
35
31
|
file name
|
32
|
+
|
36
33
|
ftask = Task[name]
|
34
|
+
|
37
35
|
assert_equal name.to_s, ftask.name
|
38
36
|
File.delete(ftask.name) rescue nil
|
37
|
+
|
39
38
|
assert ftask.needed?, "file should be needed"
|
39
|
+
|
40
40
|
open(ftask.name, "w") { |f| f.puts "HI" }
|
41
|
+
|
41
42
|
assert_equal nil, ftask.prerequisites.collect{|n| Task[n].timestamp}.max
|
42
43
|
assert ! ftask.needed?, "file should not be needed"
|
44
|
+
ensure
|
43
45
|
File.delete(ftask.name) rescue nil
|
44
46
|
end
|
45
47
|
|
@@ -77,11 +79,19 @@ class TestFileTask < Test::Unit::TestCase
|
|
77
79
|
end
|
78
80
|
|
79
81
|
def test_existing_file_depends_on_non_existing_file
|
82
|
+
@ran = false
|
83
|
+
|
80
84
|
create_file(OLDFILE)
|
81
85
|
delete_file(NEWFILE)
|
82
|
-
file NEWFILE
|
86
|
+
file NEWFILE do
|
87
|
+
@ran = true
|
88
|
+
end
|
89
|
+
|
83
90
|
file OLDFILE => NEWFILE
|
84
|
-
|
91
|
+
|
92
|
+
Task[OLDFILE].invoke
|
93
|
+
|
94
|
+
assert @ran
|
85
95
|
end
|
86
96
|
|
87
97
|
def test_old_file_in_between
|
@@ -307,52 +317,3 @@ class TestFileTask < Test::Unit::TestCase
|
|
307
317
|
|
308
318
|
end
|
309
319
|
|
310
|
-
######################################################################
|
311
|
-
class TestDirectoryTask < Test::Unit::TestCase
|
312
|
-
include Rake
|
313
|
-
|
314
|
-
def setup
|
315
|
-
Rake.rm_rf "testdata", :verbose=>false
|
316
|
-
end
|
317
|
-
|
318
|
-
def teardown
|
319
|
-
Rake.rm_rf "testdata", :verbose=>false
|
320
|
-
end
|
321
|
-
|
322
|
-
def test_directory
|
323
|
-
desc "DESC"
|
324
|
-
directory "testdata/a/b/c"
|
325
|
-
assert_equal FileCreationTask, Task["testdata"].class
|
326
|
-
assert_equal FileCreationTask, Task["testdata/a"].class
|
327
|
-
assert_equal FileCreationTask, Task["testdata/a/b/c"].class
|
328
|
-
assert_nil Task["testdata"].comment
|
329
|
-
assert_equal "DESC", Task["testdata/a/b/c"].comment
|
330
|
-
assert_nil Task["testdata/a/b"].comment
|
331
|
-
verbose(false) {
|
332
|
-
Task['testdata/a/b'].invoke
|
333
|
-
}
|
334
|
-
assert File.exist?("testdata/a/b")
|
335
|
-
assert ! File.exist?("testdata/a/b/c")
|
336
|
-
end
|
337
|
-
|
338
|
-
if Rake::Win32.windows?
|
339
|
-
def test_directory_win32
|
340
|
-
desc "WIN32 DESC"
|
341
|
-
FileUtils.mkdir_p("testdata")
|
342
|
-
Dir.chdir("testdata") do
|
343
|
-
directory 'c:/testdata/a/b/c'
|
344
|
-
assert_equal FileCreationTask, Task['c:/testdata'].class
|
345
|
-
assert_equal FileCreationTask, Task['c:/testdata/a'].class
|
346
|
-
assert_equal FileCreationTask, Task['c:/testdata/a/b/c'].class
|
347
|
-
assert_nil Task['c:/testdata'].comment
|
348
|
-
assert_equal "WIN32 DESC", Task['c:/testdata/a/b/c'].comment
|
349
|
-
assert_nil Task['c:/testdata/a/b'].comment
|
350
|
-
verbose(false) {
|
351
|
-
Task['c:/testdata/a/b'].invoke
|
352
|
-
}
|
353
|
-
assert File.exist?('c:/testdata/a/b')
|
354
|
-
assert ! File.exist?('c:/testdata/a/b/c')
|
355
|
-
end
|
356
|
-
end
|
357
|
-
end
|
358
|
-
end
|
@@ -1,18 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'rake'
|
4
|
-
require 'test/unit'
|
5
|
-
require 'test/file_creation'
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
6
2
|
require 'fileutils'
|
7
3
|
require 'stringio'
|
8
|
-
require 'test/rake_test_setup'
|
9
4
|
|
10
|
-
class
|
11
|
-
include FileCreation
|
12
|
-
include TestMethods
|
13
|
-
include Rake::DSL
|
5
|
+
class TestRakeFileUtils < Rake::TestCase
|
14
6
|
|
15
7
|
def setup
|
8
|
+
super
|
9
|
+
|
16
10
|
File.chmod(0750, "test/shellcommand.rb")
|
17
11
|
end
|
18
12
|
|
@@ -20,6 +14,8 @@ class TestFileUtils < Test::Unit::TestCase
|
|
20
14
|
File.chmod(0755, "test/shellcommand.rb")
|
21
15
|
FileUtils.rm_rf("testdata")
|
22
16
|
FileUtils::LN_SUPPORTED[0] = true
|
17
|
+
|
18
|
+
super
|
23
19
|
end
|
24
20
|
|
25
21
|
def test_rm_one_file
|
@@ -85,7 +81,7 @@ class TestFileUtils < Test::Unit::TestCase
|
|
85
81
|
def test_safe_ln_fails_on_script_error
|
86
82
|
FileUtils::LN_SUPPORTED[0] = true
|
87
83
|
c = BadLink.new(ScriptError)
|
88
|
-
|
84
|
+
assert_raises(ScriptError) do c.safe_ln "a", "b" end
|
89
85
|
end
|
90
86
|
|
91
87
|
def test_verbose
|
@@ -118,8 +114,8 @@ class TestFileUtils < Test::Unit::TestCase
|
|
118
114
|
|
119
115
|
def test_fileutils_methods_dont_leak
|
120
116
|
obj = Object.new
|
121
|
-
|
122
|
-
|
117
|
+
assert_raises(NoMethodError) { obj.copy } # from FileUtils
|
118
|
+
assert_raises(NoMethodError) { obj.ruby "-v" } # from RubyFileUtils
|
123
119
|
end
|
124
120
|
|
125
121
|
def test_sh
|
@@ -159,7 +155,7 @@ class TestFileUtils < Test::Unit::TestCase
|
|
159
155
|
end
|
160
156
|
|
161
157
|
def test_sh_failure
|
162
|
-
|
158
|
+
assert_raises(RuntimeError) {
|
163
159
|
verbose(false) { Sh.run %{#{FileUtils::RUBY} test/shellcommand.rb 1} }
|
164
160
|
}
|
165
161
|
end
|
@@ -187,7 +183,7 @@ class TestFileUtils < Test::Unit::TestCase
|
|
187
183
|
end
|
188
184
|
|
189
185
|
def test_sh_bad_option
|
190
|
-
ex =
|
186
|
+
ex = assert_raises(ArgumentError) {
|
191
187
|
verbose(false) { sh %{test/shellcommand.rb}, :bad_option=>true }
|
192
188
|
}
|
193
189
|
assert_match(/bad_option/, ex.message)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
3
2
|
require 'date'
|
4
3
|
require 'time'
|
5
|
-
require 'test/unit'
|
6
4
|
require 'rake/contrib/ftptools'
|
7
5
|
|
8
6
|
class FakeDate
|
@@ -14,10 +12,11 @@ class FakeDate
|
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
17
|
-
|
18
|
-
class TestFtpFile < Test::Unit::TestCase
|
15
|
+
class TestRakeFtpFile < Rake::TestCase
|
19
16
|
|
20
17
|
def setup
|
18
|
+
super
|
19
|
+
|
21
20
|
Rake::FtpFile.class_eval { @date_class = FakeDate; @time_class = FakeDate }
|
22
21
|
end
|
23
22
|
|
@@ -57,3 +56,4 @@ class TestFtpFile < Test::Unit::TestCase
|
|
57
56
|
assert !file.directory?
|
58
57
|
end
|
59
58
|
end
|
59
|
+
|
@@ -1,15 +1,25 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
begin
|
4
|
-
|
2
|
+
old_verbose = $VERBOSE
|
3
|
+
$VERBOSE = nil
|
4
|
+
require 'session'
|
5
5
|
rescue LoadError
|
6
|
+
if File::ALT_SEPARATOR
|
7
|
+
puts "Unable to run functional tests on MS Windows. Skipping."
|
8
|
+
else
|
9
|
+
puts "Unable to run functional tests -- please run \"gem install session\""
|
10
|
+
end
|
11
|
+
ensure
|
12
|
+
$VERBOSE = old_verbose
|
13
|
+
end
|
14
|
+
|
15
|
+
if defined?(Session)
|
16
|
+
if File::ALT_SEPARATOR
|
17
|
+
puts "Unable to run functional tests on MS Windows. Skipping."
|
18
|
+
end
|
6
19
|
end
|
7
|
-
|
20
|
+
|
21
|
+
require File.expand_path('../helper', __FILE__)
|
8
22
|
require 'fileutils'
|
9
|
-
require 'session'
|
10
|
-
require 'test/in_environment'
|
11
|
-
require 'test/rake_test_setup'
|
12
|
-
require 'rake'
|
13
23
|
|
14
24
|
# Version 2.1.9 of session has a bug where the @debug instance
|
15
25
|
# variable is not initialized, causing warning messages. This snippet
|
@@ -22,19 +32,20 @@ module Session
|
|
22
32
|
old_initialize(*args)
|
23
33
|
end
|
24
34
|
end
|
25
|
-
end
|
35
|
+
end if defined? Session
|
26
36
|
|
27
|
-
class
|
28
|
-
include InEnvironment
|
29
|
-
include TestMethods
|
37
|
+
class TestRakeFunctional < Rake::TestCase
|
30
38
|
|
31
39
|
RUBY_COMMAND = 'ruby'
|
32
40
|
|
33
41
|
def setup
|
42
|
+
super
|
43
|
+
|
34
44
|
@rake_path = File.expand_path("bin/rake")
|
35
45
|
lib_path = File.expand_path("lib")
|
36
46
|
@ruby_options = ["-I#{lib_path}", "-I."]
|
37
47
|
@verbose = ! ENV['VERBOSE'].nil?
|
48
|
+
|
38
49
|
if @verbose
|
39
50
|
puts
|
40
51
|
puts
|
@@ -77,7 +88,7 @@ class SessionBasedTests < Test::Unit::TestCase
|
|
77
88
|
end
|
78
89
|
assert_match %r{^rake a *# A / A2 *$}, @out
|
79
90
|
assert_match %r{^rake b *# B *$}, @out
|
80
|
-
|
91
|
+
refute_match %r{^rake c}, @out
|
81
92
|
assert_match %r{^rake d *# x{65}\.\.\.$}, @out
|
82
93
|
end
|
83
94
|
|
@@ -88,7 +99,7 @@ class SessionBasedTests < Test::Unit::TestCase
|
|
88
99
|
assert_match %r{^rake a\n *A / A2 *$}m, @out
|
89
100
|
assert_match %r{^rake b\n *B *$}m, @out
|
90
101
|
assert_match %r{^rake d\n *x{80}}m, @out
|
91
|
-
|
102
|
+
refute_match %r{^rake c\n}m, @out
|
92
103
|
end
|
93
104
|
|
94
105
|
def test_proper_namespace_access
|
@@ -116,7 +127,7 @@ class SessionBasedTests < Test::Unit::TestCase
|
|
116
127
|
in_environment('RAKE_SYSTEM' => 'test/data/sys') do
|
117
128
|
rake '-g', "sys1", '-T', 'extra'
|
118
129
|
end
|
119
|
-
|
130
|
+
refute_match %r{extra:extra}, @out
|
120
131
|
end
|
121
132
|
|
122
133
|
def test_by_default_rakelib_files_are_included
|
@@ -189,14 +200,14 @@ class SessionBasedTests < Test::Unit::TestCase
|
|
189
200
|
in_environment("PWD" => "test/data/verbose") do
|
190
201
|
rake "inline_verbose_false"
|
191
202
|
end
|
192
|
-
|
203
|
+
refute_match(/ruby -e/, @err)
|
193
204
|
end
|
194
205
|
|
195
206
|
def test_block_verbose_false_should_not_show_command
|
196
207
|
in_environment("PWD" => "test/data/verbose") do
|
197
208
|
rake "block_verbose_false"
|
198
209
|
end
|
199
|
-
|
210
|
+
refute_match(/ruby -e/, @err)
|
200
211
|
end
|
201
212
|
|
202
213
|
def test_block_verbose_true_should_show_command
|
@@ -217,15 +228,15 @@ class SessionBasedTests < Test::Unit::TestCase
|
|
217
228
|
in_environment("PWD" => "test/data/verbose") do
|
218
229
|
rake "standalone_verbose_false"
|
219
230
|
end
|
220
|
-
|
231
|
+
refute_match(/ruby -e/, @err)
|
221
232
|
end
|
222
233
|
|
223
234
|
def test_dry_run
|
224
235
|
in_environment("PWD" => "test/data/default") do rake "-n", "other" end
|
225
236
|
assert_match %r{Execute \(dry run\) default}, @err
|
226
237
|
assert_match %r{Execute \(dry run\) other}, @err
|
227
|
-
|
228
|
-
|
238
|
+
refute_match %r{DEFAULT}, @out
|
239
|
+
refute_match %r{OTHER}, @out
|
229
240
|
end
|
230
241
|
|
231
242
|
# Test for the trace/dry_run bug found by Brian Chandler
|
@@ -237,7 +248,7 @@ class SessionBasedTests < Test::Unit::TestCase
|
|
237
248
|
in_environment("PWD" => "test/data/dryrun") do
|
238
249
|
rake "--dry-run"
|
239
250
|
end
|
240
|
-
|
251
|
+
refute_match(/No such file/, @out)
|
241
252
|
assert_status
|
242
253
|
end
|
243
254
|
|
@@ -250,7 +261,7 @@ class SessionBasedTests < Test::Unit::TestCase
|
|
250
261
|
in_environment("PWD" => "test/data/dryrun") do
|
251
262
|
rake "--trace"
|
252
263
|
end
|
253
|
-
|
264
|
+
refute_match(/No such file/, @out)
|
254
265
|
assert_status
|
255
266
|
end
|
256
267
|
|
@@ -376,7 +387,7 @@ class SessionBasedTests < Test::Unit::TestCase
|
|
376
387
|
in_environment("PWD" => "test/data/comments") do
|
377
388
|
rake "-T"
|
378
389
|
end
|
379
|
-
|
390
|
+
refute_match(/comment for t1/, @out)
|
380
391
|
end
|
381
392
|
|
382
393
|
def test_comment_separated_from_task_by_blank_line_is_not_picked_up
|
@@ -454,4 +465,4 @@ class SessionBasedTests < Test::Unit::TestCase
|
|
454
465
|
def assert_status(expected_status=0)
|
455
466
|
assert_equal expected_status, @status
|
456
467
|
end
|
457
|
-
end
|
468
|
+
end if defined?(Session)
|