File: completions.rs

package info (click to toggle)
rust-just 1.43.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,068 kB
  • sloc: sh: 300; makefile: 6
file content (43 lines) | stat: -rw-r--r-- 948 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use super::*;

#[test]
#[cfg(target_os = "linux")]
fn bash() {
  let output = Command::new(executable_path("just"))
    .args(["--completions", "bash"])
    .output()
    .unwrap();

  assert!(output.status.success());

  let script = str::from_utf8(&output.stdout).unwrap();

  let tempdir = tempdir();

  let path = tempdir.path().join("just.bash");

  fs::write(&path, script).unwrap();

  let status = Command::new("./tests/completions/just.bash")
    .arg(path)
    .status()
    .unwrap();

  assert!(status.success());
}

#[test]
fn replacements() {
  for shell in ["bash", "elvish", "fish", "nushell", "powershell", "zsh"] {
    let output = Command::new(executable_path("just"))
      .args(["--completions", shell])
      .output()
      .unwrap();
    assert!(
      output.status.success(),
      "shell completion generation for {shell} failed: {}\n{}",
      output.status,
      String::from_utf8_lossy(&output.stderr),
    );
  }
}