Skip to content

Commit ab918fa

Browse files
authored
Merge pull request #49 from Sakapoi/dep_fix
READY: removed dev dependency
2 parents 0efe81a + 6affce7 commit ab918fa

File tree

7 files changed

+24
-67
lines changed

7 files changed

+24
-67
lines changed

Cargo.lock

Lines changed: 0 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

file/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ regex.workspace = true
1616
walkdir = "2"
1717
users = "0.11"
1818

19-
[dev-dependencies]
20-
whoami = "1.5"
21-
2219
[[bin]]
2320
name = "cat"
2421
path = "src/cat.rs"

file/tests/find/mod.rs

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ fn run_test_find(
2424
#[test]
2525
fn find_size_test() {
2626
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);
2828
let args = [&test_dir, "-size", "+4"];
2929

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);
3131

3232
run_test_find(&args, &expected_output, "", 0)
3333
}
3434

3535
#[test]
3636
fn find_name_test() {
3737
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);
3939
let args = [&test_dir, "-name", "empty_file.txt"];
4040

4141
let expected_output = format!("{}/empty_file.txt\n", test_dir);
@@ -46,18 +46,18 @@ fn find_name_test() {
4646
#[test]
4747
fn find_type_test() {
4848
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);
5050
let args = [&test_dir, "-type", "f"];
5151

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);
5353

5454
run_test_find(&args, &expected_output, "", 0)
5555
}
5656

5757
#[test]
5858
fn find_mtime_test() {
5959
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);
6161
let args = [&test_dir, "-mtime", "7"];
6262

6363
run_test_find(&args, "", "", 0)
@@ -66,40 +66,40 @@ fn find_mtime_test() {
6666
#[test]
6767
fn find_combination_test() {
6868
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);
7070
let args = [&test_dir, "-size", "+4", "-print", "-size", "+2", "-print"];
7171

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);
7373

7474
run_test_find(&args, &expected_output, "", 0)
7575
}
7676

7777
#[test]
7878
fn find_not_test() {
7979
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);
8181
let args = [&test_dir, "!", "-path", "*.txt"];
8282

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);
8484

8585
run_test_find(&args, &expected_output, "", 0)
8686
}
8787

8888
#[test]
8989
fn find_or_test() {
9090
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);
9292
let args = [&test_dir, "-path", "*.rs", "-o", "-path", "*.txt"];
9393

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);
9595

9696
run_test_find(&args, &expected_output, "", 0)
9797
}
9898

9999
#[test]
100100
fn find_and_test() {
101101
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);
103103
let args = [&test_dir, "-path", "*.txt", "-a", "-size", "+2"];
104104

105105
let expected_output = format!("{}/file1.txt\n", test_dir);
@@ -110,7 +110,7 @@ fn find_and_test() {
110110
#[test]
111111
fn find_space_argument_test() {
112112
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);
114114
let args = [&test_dir, "-name", "file with space.txt"];
115115

116116
let expected_output = format!("{}/file with space.txt\n", test_dir);
@@ -121,7 +121,7 @@ fn find_space_argument_test() {
121121
#[test]
122122
fn find_no_user_test() {
123123
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);
125125
let args = [&test_dir, "-nouser"];
126126

127127
run_test_find(&args, "", "", 0)
@@ -130,7 +130,7 @@ fn find_no_user_test() {
130130
#[test]
131131
fn find_no_group_test() {
132132
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);
134134
let args = [&test_dir, "-nogroup"];
135135

136136
run_test_find(&args, "", "", 0)
@@ -139,18 +139,18 @@ fn find_no_group_test() {
139139
#[test]
140140
fn find_x_dev_test() {
141141
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);
143143
let args = [&test_dir, "-xdev"];
144144

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);
146146

147147
run_test_find(&args, &expected_output, "", 0)
148148
}
149149

150150
#[test]
151151
fn find_perm_test() {
152152
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);
154154
let args = [&test_dir, "-perm", "777"];
155155

156156
run_test_find(&args, "", "", 0)
@@ -159,30 +159,18 @@ fn find_perm_test() {
159159
#[test]
160160
fn find_links_test() {
161161
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);
163163
let args = [&test_dir, "-links", "1"];
164164

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);
178166

179167
run_test_find(&args, &expected_output, "", 0)
180168
}
181169

182170
#[test]
183171
fn find_group_test() {
184172
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);
186174
let args = [&test_dir, "-group", "name"];
187175

188176
run_test_find(&args, "", "", 0)
@@ -191,8 +179,8 @@ fn find_group_test() {
191179
#[test]
192180
fn find_newer_test() {
193181
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);
196184
let mut file = File::create(&path_to_test_file).unwrap();
197185
writeln!(file, "File content").unwrap();
198186
let args = [&test_dir, "-newer", &path_to_test_file];
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)