- 1279
} - 1280
- 1281
#[cfg(unix)] - 1282
#[test] - 1283
fn cli_on_path_reports_an_earlier_different_vak_as_shadowing() { - 1284
let tmp = tempfile::tempdir().unwrap(); - 1285
let bin = tmp.path().join("install"); - 1286
let stale = tmp.path().join("cargo-bin"); - 1287
let not_exec = tmp.path().join("plain"); - 1288
for dir in [&bin, &stale, ¬_exec] { - 1289
std::fs::create_dir_all(dir).unwrap(); - 1290
} - 1291
let cli = bin.join("vak"); - 1292
executable(&cli); - 1293
executable(&stale.join("vak")); - 1294
std::fs::write(not_exec.join("vak"), "not a program").unwrap(); - 1295
- 1296
// A non-executable `vak` is skipped, as a shell would skip it. - 1297
let path = std::env::join_paths([¬_exec, &bin]).unwrap(); - 1298
assert_eq!(cli_on_path(Some(&path), &cli), CliOnPath::ThisInstall); - 1299
let path = std::env::join_paths([&stale, &bin]).unwrap(); - 1300
assert_eq!( - 1301
cli_on_path(Some(&path), &cli), - 1302
CliOnPath::Shadowed(stale.join("vak")) - 1303
); - 1304
} - 1305
- 1306
#[test] - 1307
fn cli_on_path_is_absent_without_a_match() { - 1308
let tmp = tempfile::tempdir().unwrap(); - 1309
let cli = tmp.path().join("vak"); - 1310
let empty = tempfile::tempdir().unwrap(); - 1311
let path = std::env::join_paths([empty.path()]).unwrap(); - 1312
assert_eq!(cli_on_path(Some(&path), &cli), CliOnPath::Absent); - 1313
assert_eq!(cli_on_path(None, &cli), CliOnPath::Absent); - 1314
} - 1315
} - 1316
Indexing the workspace…
Vakyartha documentation is discovering safe artifacts, anchors, and source references.