Skip to content

Commit 831348d

Browse files
committed
Fix file path in ed diff tests
1 parent 00a5c0b commit 831348d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/ed_diff.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ mod tests {
226226
// This test diff is intentionally reversed.
227227
// We want it to turn the alef into bet.
228228
let diff = diff_w(&alef, &bet, &format!("{target}/alef")).unwrap();
229-
File::create("target/ab.ed")
229+
File::create(&format!("{target}/ab.ed"))
230230
.unwrap()
231231
.write_all(&diff)
232232
.unwrap();
@@ -240,7 +240,7 @@ mod tests {
240240
{
241241
let output = Command::new("ed")
242242
.arg(&format!("{target}/alef"))
243-
.stdin(File::open("target/ab.ed").unwrap())
243+
.stdin(File::open(&format!("{target}/ab.ed")).unwrap())
244244
.output()
245245
.unwrap();
246246
assert!(output.status.success(), "{output:?}");
@@ -299,12 +299,12 @@ mod tests {
299299
}
300300
// This test diff is intentionally reversed.
301301
// We want it to turn the alef into bet.
302-
let diff = diff_w(&alef, &bet, "target/alef_").unwrap();
303-
File::create("target/ab_.ed")
302+
let diff = diff_w(&alef, &bet, &format!("{target}/alef_")).unwrap();
303+
File::create(&format!("{target}/ab_.ed"))
304304
.unwrap()
305305
.write_all(&diff)
306306
.unwrap();
307-
let mut fa = File::create("target/alef_").unwrap();
307+
let mut fa = File::create(&format!("{target}/alef_")).unwrap();
308308
fa.write_all(&alef[..]).unwrap();
309309
let mut fb = File::create(&format!("{target}/bet_")).unwrap();
310310
fb.write_all(&bet[..]).unwrap();
@@ -313,15 +313,15 @@ mod tests {
313313
#[cfg(not(windows))] // there's no ed on windows
314314
{
315315
let output = Command::new("ed")
316-
.arg("target/alef_")
317-
.stdin(File::open("target/ab_.ed").unwrap())
316+
.arg(&format!("{target}/alef_"))
317+
.stdin(File::open(&format!("{target}/ab_.ed")).unwrap())
318318
.output()
319319
.unwrap();
320320
assert!(output.status.success(), "{output:?}");
321321
}
322322
//println!("{}", String::from_utf8_lossy(&output.stdout));
323323
//println!("{}", String::from_utf8_lossy(&output.stderr));
324-
let alef = fs::read("target/alef_").unwrap();
324+
let alef = fs::read(&format!("{target}/alef_")).unwrap();
325325
assert_eq!(alef, bet);
326326
}
327327
}
@@ -380,7 +380,7 @@ mod tests {
380380
// This test diff is intentionally reversed.
381381
// We want it to turn the alef into bet.
382382
let diff = diff_w(&alef, &bet, &format!("{target}/alefr")).unwrap();
383-
File::create("target/abr.ed")
383+
File::create(&format!("{target}/abr.ed"))
384384
.unwrap()
385385
.write_all(&diff)
386386
.unwrap();
@@ -394,7 +394,7 @@ mod tests {
394394
{
395395
let output = Command::new("ed")
396396
.arg(&format!("{target}/alefr"))
397-
.stdin(File::open("target/abr.ed").unwrap())
397+
.stdin(File::open(&format!("{target}/abr.ed")).unwrap())
398398
.output()
399399
.unwrap();
400400
assert!(output.status.success(), "{output:?}");

0 commit comments

Comments
 (0)