Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 58 lines (45 sloc) 1.485 kB
2d2859e @drbrain Break multi-testcase files into single-testcase files for autotest
drbrain authored
1 require File.expand_path('../helper', __FILE__)
2 require 'fileutils'
3
4 class TestRakeDirectoryTask < Rake::TestCase
5 include Rake
6
8f02e23 @drbrain Rake tests now create all files in a temporary directory
drbrain authored
7 def test_directory
8 desc "DESC"
2d2859e @drbrain Break multi-testcase files into single-testcase files for autotest
drbrain authored
9
8f02e23 @drbrain Rake tests now create all files in a temporary directory
drbrain authored
10 directory "a/b/c"
2d2859e @drbrain Break multi-testcase files into single-testcase files for autotest
drbrain authored
11
8f02e23 @drbrain Rake tests now create all files in a temporary directory
drbrain authored
12 assert_equal FileCreationTask, Task["a"].class
13 assert_equal FileCreationTask, Task["a/b"].class
14 assert_equal FileCreationTask, Task["a/b/c"].class
2d2859e @drbrain Break multi-testcase files into single-testcase files for autotest
drbrain authored
15
8f02e23 @drbrain Rake tests now create all files in a temporary directory
drbrain authored
16 assert_nil Task["a"].comment
17 assert_nil Task["a/b"].comment
18 assert_equal "DESC", Task["a/b/c"].comment
2d2859e @drbrain Break multi-testcase files into single-testcase files for autotest
drbrain authored
19
20 verbose(false) {
8f02e23 @drbrain Rake tests now create all files in a temporary directory
drbrain authored
21 Task['a/b'].invoke
2d2859e @drbrain Break multi-testcase files into single-testcase files for autotest
drbrain authored
22 }
8f02e23 @drbrain Rake tests now create all files in a temporary directory
drbrain authored
23
24 assert File.exist?("a/b")
25 refute File.exist?("a/b/c")
2d2859e @drbrain Break multi-testcase files into single-testcase files for autotest
drbrain authored
26 end
27
28 if Rake::Win32.windows?
29 def test_directory_win32
30 desc "WIN32 DESC"
8f02e23 @drbrain Rake tests now create all files in a temporary directory
drbrain authored
31 directory 'c:/a/b/c'
5842081 @drbrain Fix test for windows. Patch by usa from ruby trunk r32670
drbrain authored
32 assert_equal FileTask, Task['c:'].class
8f02e23 @drbrain Rake tests now create all files in a temporary directory
drbrain authored
33 assert_equal FileCreationTask, Task['c:/a'].class
5842081 @drbrain Fix test for windows. Patch by usa from ruby trunk r32670
drbrain authored
34 assert_equal FileCreationTask, Task['c:/a/b'].class
8f02e23 @drbrain Rake tests now create all files in a temporary directory
drbrain authored
35 assert_equal FileCreationTask, Task['c:/a/b/c'].class
36 assert_nil Task['c:/'].comment
37 assert_equal "WIN32 DESC", Task['c:/a/b/c'].comment
38 assert_nil Task['c:/a/b'].comment
2d2859e @drbrain Break multi-testcase files into single-testcase files for autotest
drbrain authored
39 end
40 end
27bfc63 @zimbatm Test for directory DSL with fix
zimbatm authored
41
42 def test_can_use_blocks
43 runlist = []
44
45 t1 = directory("a/b/c" => :t2) { |t| runlist << t.name }
8474318 @drbrain Fixed unusued variable warnings
drbrain authored
46 task(:t2) { |t| runlist << t.name }
27bfc63 @zimbatm Test for directory DSL with fix
zimbatm authored
47
48 verbose(false) {
49 t1.invoke
50 }
51
52 assert_equal Task["a/b/c"], t1
53 assert_equal FileCreationTask, Task["a/b/c"].class
54 assert_equal ["t2", "a/b/c"], runlist
55 assert File.directory?("a/b/c")
56 end
2d2859e @drbrain Break multi-testcase files into single-testcase files for autotest
drbrain authored
57 end
Something went wrong with that request. Please try again.