rant 0.3.6 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/NEWS +13 -0
  2. data/README +7 -1
  3. data/Rantfile +10 -14
  4. data/TODO +3 -0
  5. data/devel-notes +5 -0
  6. data/doc/advanced.rdoc +46 -0
  7. data/doc/c.rdoc +64 -0
  8. data/doc/examples/c_dependencies/Rantfile +27 -0
  9. data/doc/examples/c_dependencies/include/hello.h +7 -0
  10. data/doc/examples/c_dependencies/include/util.h +7 -0
  11. data/doc/examples/c_dependencies/src/main.c +9 -0
  12. data/doc/examples/c_dependencies/src/util.c +9 -0
  13. data/doc/examples/directedrule/Rantfile +0 -1
  14. data/doc/rantfile.rdoc +12 -9
  15. data/doc/rubyproject.rdoc +26 -0
  16. data/lib/rant/c/include.rb +51 -0
  17. data/lib/rant/import/autoclean.rb +16 -9
  18. data/lib/rant/import/c/dependencies.rb +127 -0
  19. data/lib/rant/import/directedrule.rb +8 -4
  20. data/lib/rant/import/rubypackage.rb +2 -1
  21. data/lib/rant/import/subfile.rb +41 -0
  22. data/lib/rant/import/truth.rb +6 -1
  23. data/lib/rant/import/win32/rubycmdwrapper.rb +37 -0
  24. data/lib/rant/import.rb +26 -3
  25. data/lib/rant/rantenv.rb +0 -32
  26. data/lib/rant/rantfile.rb +207 -194
  27. data/lib/rant/rantlib.rb +83 -150
  28. data/lib/rant/rantsys.rb +7 -10
  29. data/lib/rant/rantvar.rb +4 -6
  30. data/lib/rant.rb +57 -0
  31. data/rantmethods.rb +1 -47
  32. data/setup.rb +2 -2
  33. data/test/Rantfile +6 -1
  34. data/test/c/source.c +23 -0
  35. data/test/c/test_parse_includes.rb +41 -0
  36. data/test/import/c/dependencies/Rantfile +34 -0
  37. data/test/import/c/dependencies/bar.h +2 -0
  38. data/test/import/c/dependencies/foo.h +5 -0
  39. data/test/import/c/dependencies/hello.c +7 -0
  40. data/test/import/c/dependencies/include/foo.h +0 -0
  41. data/test/import/c/dependencies/include/sub/sub.h +8 -0
  42. data/test/import/c/dependencies/include/with space.h +7 -0
  43. data/test/import/c/dependencies/src/abc +5 -0
  44. data/test/import/c/dependencies/src/abc.c +5 -0
  45. data/test/import/c/dependencies/src/bar.c +11 -0
  46. data/test/import/c/dependencies/test_c_dependencies.rb +92 -0
  47. data/test/import/c/dependencies/test_on_the_fly.rb +44 -0
  48. data/test/import/directedrule/Rantfile +7 -2
  49. data/test/import/directedrule/test_directedrule.rb +6 -0
  50. data/test/import/subfile/Rantfile +28 -0
  51. data/test/import/subfile/autoclean.rf +16 -0
  52. data/test/import/subfile/test_subfile.rb +91 -0
  53. data/test/import/truth/Rantfile +7 -0
  54. data/test/import/truth/test_truth.rb +3 -0
  55. data/test/project2/buildfile +2 -0
  56. data/test/project2/test_project.rb +5 -3
  57. data/test/rant-import/Rantfile +4 -0
  58. data/test/rant-import/test_rant-import.rb +104 -1
  59. data/test/rule.rf +6 -0
  60. data/test/test_autosubfiletask.rb +59 -0
  61. data/test/test_clean.rb +48 -5
  62. data/test/test_dirtask.rb +45 -1
  63. data/test/test_examples.rb +25 -3
  64. data/test/test_filelist.rb +14 -2
  65. data/test/test_lighttask.rb +4 -6
  66. data/test/test_rant_interface.rb +8 -8
  67. data/test/test_rantfile_api.rb +37 -1
  68. data/test/test_rule.rb +6 -3
  69. data/test/test_source.rb +28 -1
  70. data/test/test_sourcenode.rb +163 -0
  71. data/test/test_task.rb +2 -2
  72. data/test/test_var.rb +3 -3
  73. data/test/tutil.rb +23 -2
  74. metadata +45 -3
  75. data/test/test_metatask.rb +0 -29
data/rantmethods.rb CHANGED
@@ -14,7 +14,7 @@ end
14
14
 
15
15
  desc "Print constants introduced by Rant."
16
16
  task :constants do
17
- puts ((self.class.constants - Object.constants).sort)
17
+ puts((self.class.constants - Object.constants).sort)
18
18
  end
19
19
 
20
20
  desc "Print all attribute writers of a Gem::Specification."
@@ -82,49 +82,3 @@ file "bench-depsearch" do |t|
82
82
  EOT
83
83
  }
84
84
  end
85
-
86
- =begin
87
- class TraceObject < Object
88
- ml = public_instance_methods + protected_instance_methods + private_instance_methods
89
- ml.each { |m|
90
- eval <<-EOM
91
- def #{m}(*args)
92
- print "TraceObject##{m}("
93
- print args.join(", ")
94
- print ")"
95
- puts(block_given? ? " block_given" : "")
96
- super
97
- end
98
- EOM
99
- }
100
- end
101
- =end
102
-
103
- class TraceArray < Array
104
- ml = public_instance_methods + protected_instance_methods + private_instance_methods
105
- ml.delete "print"
106
- ml.delete "block_given?"
107
- ml.delete "puts"
108
- ml.each { |m|
109
- eval <<-EOM
110
- def #{m}(*args)
111
- print "TraceArray##{m}("
112
- print args.join(", ")
113
- print ")"
114
- puts(block_given? ? " block_given" : "")
115
- super
116
- end
117
- EOM
118
- }
119
- end
120
-
121
- # list the methods that are sent to an object that is in an array
122
- # which is flattened.
123
- #task :flatten do
124
- # to = TraceObject.new
125
- #[to].flatten
126
- #end
127
-
128
- task :flatten_ary do
129
- [TraceArray.new].flatten
130
- end
data/setup.rb CHANGED
@@ -1143,11 +1143,11 @@ class Installer
1143
1143
  begin
1144
1144
  File.open(path, 'rb') {|r|
1145
1145
  first = r.gets
1146
- return unless File.basename(config('rubypath')) == 'ruby'
1146
+ return unless File.basename(config('rubypath')) =~ /ruby/
1147
1147
  ### stefan ###
1148
1148
  # Add <tt>|| ""</tt> which avoids an ArgumentError if first
1149
1149
  # line doesn't match the regexp.
1150
- return unless File.basename(first.sub(/\A\#!/, '').split[0] || "") == 'ruby'
1150
+ return unless File.basename((first||"").sub(/\A\#!/, '').split[0] || "") == 'ruby'
1151
1151
  $stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose?
1152
1152
  File.open(tmpfile, 'wb') {|w|
1153
1153
  w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
data/test/Rantfile CHANGED
@@ -23,10 +23,12 @@ gen Action do
23
23
  rac.build "version.t"
24
24
  end
25
25
 
26
- source "auto.rf"
26
+ auto_t_task = source "auto.rf"
27
+ rac.abort unless auto_t_task.name == "auto.t"
27
28
 
28
29
  task :clean do
29
30
  sys.rm_f %w(auto.t auto.rf version.t)
31
+ sys.rm_rf %w(basedir.t)
30
32
  end
31
33
 
32
34
  gen Directory, "tmp.t"
@@ -49,4 +51,7 @@ task :build_test_t do |t|
49
51
  test(?d, "tmp.t") or t.fail
50
52
  end
51
53
 
54
+ desc "Make some path (basedir.t/a/b)."
55
+ gen Directory, "basedir.t", "a/b"
56
+
52
57
  # vim: ft=ruby
data/test/c/source.c ADDED
@@ -0,0 +1,23 @@
1
+
2
+ #include <stdio.h>
3
+ #include "util.h"
4
+
5
+ /*
6
+ * some comment
7
+ */
8
+ #include "mylib.h"
9
+
10
+ /*
11
+ #include "xy"
12
+ */
13
+
14
+ //
15
+ # include <file.h>
16
+ #include "custom" // custom header
17
+
18
+ # // include "abc"
19
+
20
+ #include \
21
+ "custom2.h"
22
+
23
+ #include <std>
@@ -0,0 +1,41 @@
1
+
2
+ require 'tutil'
3
+ require 'rant/c/include'
4
+
5
+ $testCDir ||= File.expand_path(File.dirname(__FILE__))
6
+
7
+ class TestCParseIncludes < Test::Unit::TestCase
8
+ C = Rant::C
9
+ def setup
10
+ Dir.chdir($testCDir)
11
+ end
12
+ def test_parse_source
13
+ src = File.read "source.c"
14
+ sc, lc = C::Include.parse_includes(src)
15
+ assert_equal(%w(stdio.h file.h std), sc)
16
+ assert_equal(
17
+ %w(util.h mylib.h custom custom2.h), lc)
18
+ end
19
+ def test_parse_empty
20
+ sc, lc = C::Include.parse_includes("")
21
+ assert(sc.empty?)
22
+ assert(lc.empty?)
23
+ end
24
+ def test_parse_nil
25
+ assert_raises(ArgumentError) {
26
+ C::Include.parse_includes(nil)
27
+ }
28
+ end
29
+ def test_accepts_to_str
30
+ obj = Object.new
31
+ def obj.to_str
32
+ "//"
33
+ end
34
+ lc, sc = nil, nil
35
+ assert_nothing_raised {
36
+ sc, lc = C::Include.parse_includes(obj)
37
+ }
38
+ assert(sc.empty?)
39
+ assert(lc.empty?)
40
+ end
41
+ end
@@ -0,0 +1,34 @@
1
+
2
+ import "c/dependencies", "autoclean"
3
+
4
+ var :deps, 1..3
5
+
6
+ file "a.t" => sys["**/*.{c,cpp}"] do |t|
7
+ sys.touch t.name
8
+ end
9
+
10
+ file "hello.t" => "hello.c" do |t|
11
+ sys.touch t.name
12
+ end
13
+
14
+ file "bar.t" => "src/bar.c" do |t|
15
+ sys.touch t.name
16
+ end
17
+
18
+ desc "Create C source dependency file."
19
+ gen C::Dependencies
20
+
21
+ gen C::Dependencies, "deps2.t", :search => [".", "include"]
22
+ gen C::Dependencies, "deps3.t", :search => [".", "include", "src"]
23
+
24
+ gen Action do
25
+ source case var[:deps]
26
+ when 2: "deps2.t"
27
+ when 3: "deps3.t"
28
+ else "c_dependencies"
29
+ end
30
+ end
31
+
32
+ gen AutoClean
33
+
34
+ # vim:ft=ruby
@@ -0,0 +1,2 @@
1
+
2
+ #include "foo.h"
@@ -0,0 +1,5 @@
1
+
2
+ #ifndef FOO_H
3
+ #define FOO_H
4
+
5
+ #endif
@@ -0,0 +1,7 @@
1
+ #include "foo.h"
2
+ #include <stdio.h>
3
+
4
+ int main()
5
+ {
6
+ printf("Hello, world!");
7
+ }
File without changes
@@ -0,0 +1,8 @@
1
+ #ifndef SUB_SUB_H
2
+ #define SUB_SUB_H
3
+
4
+ #include "bar.h"
5
+
6
+ #define SUB_STR "substr"
7
+
8
+ #endif
@@ -0,0 +1,7 @@
1
+
2
+ #ifndef WITH_SPACE_H
3
+ #define WITH_SPACE_H
4
+
5
+ #include "foo.h"
6
+
7
+ #endif
@@ -0,0 +1,5 @@
1
+
2
+ float abc(float param)
3
+ {
4
+ return param;
5
+ }
@@ -0,0 +1,5 @@
1
+
2
+ int abc(int param)
3
+ {
4
+ return param;
5
+ }
@@ -0,0 +1,11 @@
1
+
2
+ #include <abc.c>
3
+ #include "abc"
4
+ #include "with space.h"
5
+
6
+ void greet()
7
+ {
8
+ abc(0);
9
+ abc(0.0);
10
+ printf("greetings from bar\n");
11
+ }
@@ -0,0 +1,92 @@
1
+
2
+ require 'test/unit'
3
+ require 'tutil'
4
+
5
+ $testImportCDepDir ||= File.expand_path(File.dirname(__FILE__))
6
+
7
+ class TestImportCDependencies < Test::Unit::TestCase
8
+ def setup
9
+ # Ensure we run in test directory.
10
+ Dir.chdir $testImportCDepDir
11
+ @manifest = %w(
12
+ test_c_dependencies.rb Rantfile hello.c foo.h bar.h
13
+ include include/foo.h include/sub include/sub/sub.h
14
+ src src/abc src/abc.c src/bar.c
15
+ )
16
+ @manifest << "include/with space.h"
17
+ end
18
+ def teardown
19
+ Dir.chdir $testImportCDepDir
20
+ FileUtils.rm_f "c_dependencies"
21
+ FileUtils.rm_rf Dir["*.t"]
22
+ @manifest.each { |f|
23
+ assert(test(?e, f), "#{f} missing")
24
+ }
25
+ end
26
+ def test_hello_c
27
+ assert_rant("hello.t")
28
+ assert(test(?f, "hello.t"))
29
+ assert(test(?f, "c_dependencies"))
30
+ out, err = assert_rant("hello.t")
31
+ assert(out.strip.empty?)
32
+ assert(err.strip.empty?)
33
+ timeout
34
+ FileUtils.touch "foo.h"
35
+ old_mtime = File.mtime "hello.t"
36
+ assert_rant("hello.t")
37
+ assert(File.mtime("hello.t") > old_mtime)
38
+ old_mtime = File.mtime("hello.t")
39
+ timeout
40
+ out, err = assert_rant("hello.t")
41
+ assert(out.strip.empty?)
42
+ assert(err.strip.empty?)
43
+ FileUtils.rm "c_dependencies"
44
+ out, err = assert_rant("hello.t")
45
+ assert(!out.strip.empty?)
46
+ assert(err.strip.empty?)
47
+ assert_equal(old_mtime, File.mtime("hello.t"))
48
+ end
49
+ def test_bar_c
50
+ assert_rant("deps=2", "bar.t")
51
+ assert(test(?f, "bar.t"))
52
+ assert(test(?f, "deps2.t"))
53
+ cdeps_mtime = File.mtime "deps2.t"
54
+ FileUtils.rm "bar.t"
55
+ assert_rant("deps=2", "bar.t")
56
+ assert(test(?f, "bar.t"))
57
+ assert_equal(cdeps_mtime, File.mtime("deps2.t"))
58
+ old_mtime = File.mtime "bar.t"
59
+ timeout
60
+ FileUtils.touch "src/abc.c"
61
+ assert_rant("deps=2", "bar.t")
62
+ assert_equal(old_mtime, File.mtime("bar.t"))
63
+ timeout
64
+ FileUtils.touch "include/with space.h"
65
+ assert_rant("deps=2", "bar.t")
66
+ assert(File.mtime("bar.t") > old_mtime)
67
+ end
68
+ def test_bar_c_deps3
69
+ assert_rant("deps=3", "bar.t")
70
+ assert(test(?f, "bar.t"))
71
+ assert(test(?f, "deps3.t"))
72
+ old_mtime = File.mtime("bar.t")
73
+ timeout
74
+ FileUtils.touch "src/abc"
75
+ assert_rant("deps=3", "bar.t")
76
+ assert(File.mtime("bar.t") > old_mtime)
77
+ old_mtime = File.mtime "bar.t"
78
+ timeout
79
+ FileUtils.touch "src/abc.c"
80
+ assert_rant("deps=3", "bar.t")
81
+ assert(File.mtime("bar.t") > old_mtime)
82
+ old_mtime = File.mtime "bar.t"
83
+ timeout
84
+ FileUtils.touch "foo.h"
85
+ assert_rant("deps=3", "bar.t")
86
+ assert(File.mtime("bar.t") > old_mtime)
87
+ assert_rant("autoclean")
88
+ %w(a.t hello.t bar.t c_dependencies deps2.t deps3.t).each { |f|
89
+ assert(!test(?e, f), "#{f} should get unlinked by AutoClean")
90
+ }
91
+ end
92
+ end
@@ -0,0 +1,44 @@
1
+
2
+ require 'test/unit'
3
+ require 'tutil'
4
+
5
+ $testImportCDepDir ||= File.expand_path(File.dirname(__FILE__))
6
+
7
+ class TestImportCDependenciesOnTheFly < Test::Unit::TestCase
8
+ def setup
9
+ # Ensure we run in test directory.
10
+ Dir.chdir $testImportCDepDir
11
+ end
12
+ def teardown
13
+ Dir.chdir $testImportCDepDir
14
+ FileUtils.rm_f "c_dependencies"
15
+ FileUtils.rm_rf Dir["*.t"]
16
+ end
17
+ def test_opts_without_filename
18
+ open "rf.t", "w" do |f|
19
+ f << <<-EOF
20
+ file "bar.t" => "src/bar.c" do |t|
21
+ sys.touch t.name
22
+ end
23
+ gen C::Dependencies,
24
+ :sources => sys["src/*.c"],
25
+ :search => "include"
26
+ source "c_dependencies"
27
+ EOF
28
+ end
29
+ assert_rant("-frf.t")
30
+ assert(test(?f, "bar.t"))
31
+ out, err = assert_rant("-frf.t")
32
+ assert(out.strip.empty?)
33
+ assert(err.strip.empty?)
34
+ old_mtime = File.mtime "bar.t"
35
+ timeout
36
+ FileUtils.touch "src/abc"
37
+ assert_rant("-frf.t")
38
+ assert_equal(old_mtime, File.mtime("bar.t"))
39
+ timeout
40
+ FileUtils.touch "include/with space.h"
41
+ assert_rant("-frf.t")
42
+ assert(File.mtime("bar.t") > old_mtime)
43
+ end
44
+ end
@@ -1,9 +1,9 @@
1
1
 
2
2
  import %w(directedrule autoclean)
3
3
 
4
- task :mk_src => %w(src.t/1.b src.t/2.b src.t/3.b)
4
+ task :mk_src => %w(src.t/1.b src.t/2.b src.t/3.b src.t/1.2b)
5
5
  gen Directory, "src.t"
6
- %w(src.t/1.b src.t/2.b src.t/3.b).each { |f|
6
+ %w(src.t/1.b src.t/2.b src.t/3.b src.t/1.2b).each { |f|
7
7
  file f => "src.t" do |t| sys.touch t.name end
8
8
  }
9
9
 
@@ -13,11 +13,16 @@ file "foo.t" => %w(build.t/1.a build.t/2.a) do |t|
13
13
  end
14
14
 
15
15
  gen Directory, "build.t"
16
+ gen Directory, "build2.t"
16
17
 
17
18
  gen Action do
18
19
  rac.build "build.t"
19
20
  end
20
21
 
22
+ gen DirectedRule, "build2.t" => ["src.t"], '.2a' => '.2b' do |t|
23
+ sys.touch t.name
24
+ end
25
+
21
26
  ro_tt = gen DirectedRule, "build.t" => ["src.t"], :a => :b do |t|
22
27
  sys.touch t.name
23
28
  end
@@ -28,4 +28,10 @@ class TestDirectedRule < Test::Unit::TestCase
28
28
  assert_rant("foo.t")
29
29
  assert(test(?f, "foo.t"))
30
30
  end
31
+ def test_build_invoke_dir_task
32
+ assert_rant
33
+ assert_rant("build2.t/1.2a")
34
+ assert(test(?d, "build2.t"))
35
+ assert(test(?f, "build2.t/1.2a"))
36
+ end
31
37
  end
@@ -0,0 +1,28 @@
1
+ import "subfile"
2
+
3
+ gen SubFile, "sub.t/file" do |t|
4
+ sys.touch t.name
5
+ end
6
+
7
+ desc "some subfile"
8
+ gen SubFile, "sub2.t/file"
9
+
10
+ gen SubFile, "sub3.t", "file" do |t|
11
+ sys.touch t.name
12
+ end
13
+
14
+ gen SubFile, "sub.t/file2" do |t|
15
+ sys.touch t.name
16
+ end
17
+
18
+ gen SubFile, "sub4.t/sub/file" do |t|
19
+ sys.touch t.name
20
+ end
21
+
22
+ gen SubFile, "sub5.t", "sub/sub/file" do |t|
23
+ sys.touch t.name
24
+ end
25
+
26
+ gen SubFile, "file.t" do |t|
27
+ sys.touch t.name
28
+ end
@@ -0,0 +1,16 @@
1
+
2
+ import %w(autoclean subfile)
3
+
4
+ gen AutoClean
5
+
6
+ gen SubFile, "sub.t/file" do |t|
7
+ sys.touch t.name
8
+ end
9
+
10
+ gen SubFile, "sub2.t", "sub.t/file" do |t|
11
+ sys.touch t.name
12
+ end
13
+
14
+ gen SubFile, "sub3.t", "file" do |t|
15
+ sys.touch t.name
16
+ end
@@ -0,0 +1,91 @@
1
+
2
+ require 'test/unit'
3
+ require 'tutil'
4
+
5
+ $testImportSubFileDir ||= File.expand_path(File.dirname(__FILE__))
6
+
7
+ class TestSubFile < Test::Unit::TestCase
8
+ def setup
9
+ # Ensure we run in test directory.
10
+ Dir.chdir($testImportSubFileDir)
11
+ end
12
+ def teardown
13
+ FileUtils.rm_rf Dir["*.t"]
14
+ end
15
+ def test_run_cmd
16
+ assert_rant("sub.t/file")
17
+ assert(test(?d, "sub.t"))
18
+ assert(test(?f, "sub.t/file"))
19
+ end
20
+ def test_desc
21
+ out, err = assert_rant("--tasks")
22
+ assert_match(%r{sub2\.t/file\s*#.*some subfile}, out)
23
+ end
24
+ def test_no_block
25
+ assert_rant("sub2.t/file")
26
+ assert(test(?d, "sub2.t"))
27
+ assert(!test(?e, "sub2.t/file"))
28
+ end
29
+ def test_fail_no_basedir
30
+ assert_rant(:fail, "sub3.t/file")
31
+ assert(!test(?e, "sub3.t"))
32
+ assert(!test(?e, "sub3.t/file"))
33
+ end
34
+ def test_basedir
35
+ FileUtils.mkdir "sub3.t"
36
+ assert_rant("sub3.t/file")
37
+ assert(test(?d, "sub3.t"))
38
+ assert(test(?f, "sub3.t/file"))
39
+ end
40
+ def test_dirtask_exists
41
+ assert_rant("sub.t/file2")
42
+ assert(test(?d, "sub.t"))
43
+ assert(test(?f, "sub.t/file2"))
44
+ assert(!test(?e, "sub.t/file"))
45
+ end
46
+ def test_make_two
47
+ assert_rant("sub.t/file", "sub.t/file2")
48
+ assert(test(?f, "sub.t/file"))
49
+ assert(test(?f, "sub.t/file2"))
50
+ end
51
+ def test_two_dirs
52
+ assert_rant("sub4.t/sub/file")
53
+ assert(test(?f, "sub4.t/sub/file"))
54
+ end
55
+ def test_basedir_two_dirs
56
+ FileUtils.mkdir "sub5.t"
57
+ out, err = assert_rant("sub5.t/sub/sub/file")
58
+ assert(!out.strip.empty?)
59
+ assert(test(?f, "sub5.t/sub/sub/file"))
60
+ out, err = assert_rant("sub5.t/sub/sub/file")
61
+ assert(out.strip.empty?)
62
+ end
63
+ def test_make_dir
64
+ assert_rant("sub.t")
65
+ assert(test(?d, "sub.t"))
66
+ assert(!test(?e, "sub.t/file"))
67
+ end
68
+ def test_only_file
69
+ assert_rant("file.t")
70
+ assert(test(?f, "file.t"))
71
+ out, err = assert_rant("file.t")
72
+ assert(out.strip.empty?)
73
+ end
74
+ def test_autoclean
75
+ assert_rant("-fautoclean.rf", "sub.t/file")
76
+ assert(test(?f, "sub.t/file"))
77
+ FileUtils.mkdir "sub2.t"
78
+ assert_rant("-fautoclean.rf", "sub2.t/sub.t/file")
79
+ assert(test(?f, "sub2.t/sub.t/file"))
80
+ FileUtils.mkdir "sub3.t"
81
+ assert_rant("-fautoclean.rf", "sub3.t/file")
82
+ assert(test(?f, "sub3.t/file"))
83
+ assert_rant("-fautoclean.rf", "autoclean")
84
+ assert(test(?d, "sub2.t"))
85
+ assert(test(?d, "sub3.t"))
86
+ %w(sub.t sub2.t/sub.t sub3.t/file).each { |f|
87
+ assert(!test(?e, f),
88
+ "#{f} should have been unlinked by AutoClean")
89
+ }
90
+ end
91
+ end
@@ -11,6 +11,13 @@ file("rm.t") { |t|
11
11
  "touch rm.t" %
12
12
  "this file is useless"
13
13
 
14
+ task :sys_pipe do |t|
15
+ sys.touch %w(a.t b.t)
16
+ test(?f, "a.t") && test(?f, "b.t") or t.fail
17
+ sys["*.t"] % :rm
18
+ test(?f, "a.t") || test(?f, "b.t") and t.fail
19
+ end
20
+
14
21
  drag :AutoClean, :clean
15
22
 
16
23
  # vim:ft=ruby
@@ -20,4 +20,7 @@ class TestTruth < Test::Unit::TestCase
20
20
  assert_rant("clean")
21
21
  assert(!test(?e, "rm.t"))
22
22
  end
23
+ def test_pipe
24
+ assert_rant("sys_pipe")
25
+ end
23
26
  end
@@ -12,3 +12,5 @@ task :clean do |t|
12
12
  end
13
13
 
14
14
  subdirs %w(sub1 sub2)
15
+
16
+ :return_val
@@ -15,7 +15,9 @@ class TestProject2 < Test::Unit::TestCase
15
15
  include ::Rant::Sys
16
16
 
17
17
  def app *args
18
- @app = ::Rant::RantApp.new(*args)
18
+ @app = ::Rant::RantApp.new
19
+ @app.args.concat(args.flatten)
20
+ @app
19
21
  end
20
22
  def setup
21
23
  Dir.chdir($testProject2Dir) unless Dir.pwd == $testProject2Dir
@@ -51,8 +53,8 @@ class TestProject2 < Test::Unit::TestCase
51
53
  capture_std do
52
54
  app("b_f2")
53
55
  @app.rootdir = $testProject2Dir
54
- assert(@app.source("buildfile"),
55
- "source should return a true value on success")
56
+ assert_equal(:return_val, @app.source("buildfile"),
57
+ "source should return value of last expression in Rantfile")
56
58
  assert_equal(@app.run, 0)
57
59
  end
58
60
  assert(File.exist?("b_f2"))
@@ -12,4 +12,8 @@ task :private do |t|
12
12
  puts t.name
13
13
  end
14
14
 
15
+ task :sys_shun_demo do |t|
16
+ puts(sys["**/*.s.t"].shun("a.t"))
17
+ end
18
+
15
19
  # vim: ft=ruby