@@ -24,18 +24,18 @@ fn run_test_find(
24
24
#[ test]
25
25
fn find_size_test ( ) {
26
26
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
27
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
27
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
28
28
let args = [ & test_dir, "-size" , "+4" ] ;
29
29
30
- let expected_output = format ! ( "{}\n {}/file1.txt\n {}/mod.rs \n " , test_dir , test_dir, test_dir) ;
30
+ let expected_output = format ! ( "{}\n {}/file1.txt\n " , test_dir, test_dir) ;
31
31
32
32
run_test_find ( & args, & expected_output, "" , 0 )
33
33
}
34
34
35
35
#[ test]
36
36
fn find_name_test ( ) {
37
37
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
38
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
38
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
39
39
let args = [ & test_dir, "-name" , "empty_file.txt" ] ;
40
40
41
41
let expected_output = format ! ( "{}/empty_file.txt\n " , test_dir) ;
@@ -46,18 +46,18 @@ fn find_name_test() {
46
46
#[ test]
47
47
fn find_type_test ( ) {
48
48
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
49
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
49
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
50
50
let args = [ & test_dir, "-type" , "f" ] ;
51
51
52
- let expected_output = format ! ( "{}/empty_file.txt\n {}/file with space.txt\n {}/file1.txt\n {}/mod.rs \n {}/ rust_file.rs\n " , test_dir , test_dir, test_dir, test_dir, test_dir) ;
52
+ let expected_output = format ! ( "{}/empty_file.txt\n {}/file with space.txt\n {}/file1.txt\n {}/rust_file.rs\n " , test_dir, test_dir, test_dir, test_dir) ;
53
53
54
54
run_test_find ( & args, & expected_output, "" , 0 )
55
55
}
56
56
57
57
#[ test]
58
58
fn find_mtime_test ( ) {
59
59
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
60
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
60
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
61
61
let args = [ & test_dir, "-mtime" , "7" ] ;
62
62
63
63
run_test_find ( & args, "" , "" , 0 )
@@ -66,40 +66,40 @@ fn find_mtime_test() {
66
66
#[ test]
67
67
fn find_combination_test ( ) {
68
68
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
69
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
69
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
70
70
let args = [ & test_dir, "-size" , "+4" , "-print" , "-size" , "+2" , "-print" ] ;
71
71
72
- let expected_output = format ! ( "{}\n {}\n {}/file1.txt\n {}/file1.txt\n {}/mod.rs \n {}/mod.rs \n " , test_dir , test_dir , test_dir, test_dir, test_dir, test_dir) ;
72
+ let expected_output = format ! ( "{}\n {}\n {}/file1.txt\n {}/file1.txt\n " , test_dir, test_dir, test_dir, test_dir) ;
73
73
74
74
run_test_find ( & args, & expected_output, "" , 0 )
75
75
}
76
76
77
77
#[ test]
78
78
fn find_not_test ( ) {
79
79
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
80
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
80
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
81
81
let args = [ & test_dir, "!" , "-path" , "*.txt" ] ;
82
82
83
- let expected_output = format ! ( "{}\n {}/mod.rs \n {}/ rust_file.rs\n " , test_dir , test_dir, test_dir) ;
83
+ let expected_output = format ! ( "{}\n {}/rust_file.rs\n " , test_dir, test_dir) ;
84
84
85
85
run_test_find ( & args, & expected_output, "" , 0 )
86
86
}
87
87
88
88
#[ test]
89
89
fn find_or_test ( ) {
90
90
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
91
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
91
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
92
92
let args = [ & test_dir, "-path" , "*.rs" , "-o" , "-path" , "*.txt" ] ;
93
93
94
- let expected_output = format ! ( "{}/empty_file.txt\n {}/file with space.txt\n {}/file1.txt\n {}/mod.rs \n {}/ rust_file.rs\n " , test_dir , test_dir, test_dir, test_dir, test_dir) ;
94
+ let expected_output = format ! ( "{}/empty_file.txt\n {}/file with space.txt\n {}/file1.txt\n {}/rust_file.rs\n " , test_dir, test_dir, test_dir, test_dir) ;
95
95
96
96
run_test_find ( & args, & expected_output, "" , 0 )
97
97
}
98
98
99
99
#[ test]
100
100
fn find_and_test ( ) {
101
101
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
102
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
102
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
103
103
let args = [ & test_dir, "-path" , "*.txt" , "-a" , "-size" , "+2" ] ;
104
104
105
105
let expected_output = format ! ( "{}/file1.txt\n " , test_dir) ;
@@ -110,7 +110,7 @@ fn find_and_test() {
110
110
#[ test]
111
111
fn find_space_argument_test ( ) {
112
112
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
113
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
113
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
114
114
let args = [ & test_dir, "-name" , "file with space.txt" ] ;
115
115
116
116
let expected_output = format ! ( "{}/file with space.txt\n " , test_dir) ;
@@ -121,7 +121,7 @@ fn find_space_argument_test() {
121
121
#[ test]
122
122
fn find_no_user_test ( ) {
123
123
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
124
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
124
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
125
125
let args = [ & test_dir, "-nouser" ] ;
126
126
127
127
run_test_find ( & args, "" , "" , 0 )
@@ -130,7 +130,7 @@ fn find_no_user_test() {
130
130
#[ test]
131
131
fn find_no_group_test ( ) {
132
132
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
133
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
133
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
134
134
let args = [ & test_dir, "-nogroup" ] ;
135
135
136
136
run_test_find ( & args, "" , "" , 0 )
@@ -139,18 +139,18 @@ fn find_no_group_test() {
139
139
#[ test]
140
140
fn find_x_dev_test ( ) {
141
141
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
142
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
142
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
143
143
let args = [ & test_dir, "-xdev" ] ;
144
144
145
- let expected_output = format ! ( "{}\n {}/empty_file.txt\n {}/file with space.txt\n {}/file1.txt\n {}/mod.rs \n {}/ rust_file.rs\n " , test_dir , test_dir, test_dir, test_dir, test_dir, test_dir) ;
145
+ let expected_output = format ! ( "{}\n {}/empty_file.txt\n {}/file with space.txt\n {}/file1.txt\n {}/rust_file.rs\n " , test_dir, test_dir, test_dir, test_dir, test_dir) ;
146
146
147
147
run_test_find ( & args, & expected_output, "" , 0 )
148
148
}
149
149
150
150
#[ test]
151
151
fn find_perm_test ( ) {
152
152
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
153
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
153
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
154
154
let args = [ & test_dir, "-perm" , "777" ] ;
155
155
156
156
run_test_find ( & args, "" , "" , 0 )
@@ -159,30 +159,18 @@ fn find_perm_test() {
159
159
#[ test]
160
160
fn find_links_test ( ) {
161
161
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
162
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
162
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
163
163
let args = [ & test_dir, "-links" , "1" ] ;
164
164
165
- let expected_output = format ! ( "{}/empty_file.txt\n {}/file with space.txt\n {}/file1.txt\n {}/mod.rs\n {}/rust_file.rs\n " , test_dir, test_dir, test_dir, test_dir, test_dir) ;
166
-
167
- run_test_find ( & args, & expected_output, "" , 0 )
168
- }
169
-
170
- #[ test]
171
- fn find_user_test ( ) {
172
- let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
173
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
174
- let username = whoami:: username ( ) ;
175
- let args = [ & test_dir, "-user" , & username] ;
176
-
177
- let expected_output = format ! ( "{}\n {}/empty_file.txt\n {}/file with space.txt\n {}/file1.txt\n {}/mod.rs\n {}/rust_file.rs\n " , test_dir, test_dir, test_dir, test_dir, test_dir, test_dir) ;
165
+ let expected_output = format ! ( "{}/empty_file.txt\n {}/file with space.txt\n {}/file1.txt\n {}/rust_file.rs\n " , test_dir, test_dir, test_dir, test_dir) ;
178
166
179
167
run_test_find ( & args, & expected_output, "" , 0 )
180
168
}
181
169
182
170
#[ test]
183
171
fn find_group_test ( ) {
184
172
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
185
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
173
+ let test_dir = format ! ( "{}/tests/find/other " , project_root) ;
186
174
let args = [ & test_dir, "-group" , "name" ] ;
187
175
188
176
run_test_find ( & args, "" , "" , 0 )
@@ -191,8 +179,8 @@ fn find_group_test() {
191
179
#[ test]
192
180
fn find_newer_test ( ) {
193
181
let project_root = env ! ( "CARGO_MANIFEST_DIR" ) ;
194
- let test_dir = format ! ( "{}/tests/find" , project_root) ;
195
- let path_to_test_file = format ! ( "{}/empty_file .txt" , test_dir) ;
182
+ let test_dir = format ! ( "{}/tests/find/newer " , project_root) ;
183
+ let path_to_test_file = format ! ( "{}/qwe .txt" , test_dir) ;
196
184
let mut file = File :: create ( & path_to_test_file) . unwrap ( ) ;
197
185
writeln ! ( file, "File content" ) . unwrap ( ) ;
198
186
let args = [ & test_dir, "-newer" , & path_to_test_file] ;
0 commit comments