2022-06-18 21:56:31 -07:00
|
|
|
use super::*;
|
2020-01-15 01:20:38 -08:00
|
|
|
|
|
|
|
#[test]
|
2024-06-01 16:26:41 -07:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
fn bash() {
|
2020-01-15 01:20:38 -08:00
|
|
|
let output = Command::new(executable_path("just"))
|
2024-06-01 16:26:41 -07:00
|
|
|
.args(["--completions", "bash"])
|
2020-01-15 01:20:38 -08:00
|
|
|
.output()
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
assert!(output.status.success());
|
|
|
|
|
2024-06-01 16:26:41 -07:00
|
|
|
let script = str::from_utf8(&output.stdout).unwrap();
|
|
|
|
|
|
|
|
let tempdir = tempdir();
|
|
|
|
|
|
|
|
let path = tempdir.path().join("just.bash");
|
|
|
|
|
|
|
|
fs::write(&path, script).unwrap();
|
2020-01-15 01:20:38 -08:00
|
|
|
|
2024-06-01 16:26:41 -07:00
|
|
|
let status = Command::new("./tests/completions/just.bash")
|
|
|
|
.arg(path)
|
|
|
|
.status()
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
assert!(status.success());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn replacements() {
|
2024-06-08 14:56:21 -07:00
|
|
|
for shell in ["bash", "elvish", "fish", "nushell", "powershell", "zsh"] {
|
2024-06-05 13:16:47 -07:00
|
|
|
let output = Command::new(executable_path("just"))
|
2024-06-01 16:26:41 -07:00
|
|
|
.args(["--completions", shell])
|
2024-06-05 13:16:47 -07:00
|
|
|
.output()
|
2024-06-01 16:26:41 -07:00
|
|
|
.unwrap();
|
2024-06-13 19:57:12 -07:00
|
|
|
assert!(
|
|
|
|
output.status.success(),
|
|
|
|
"shell completion generation for {shell} failed: {}",
|
|
|
|
output.status
|
|
|
|
);
|
2024-06-01 16:26:41 -07:00
|
|
|
}
|
2020-01-15 01:20:38 -08:00
|
|
|
}
|