aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cli.rs
diff options
context:
space:
mode:
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2021-04-18 03:47:23 +0000
committerGitHub <noreply@github.com>2021-04-18 03:47:23 +0000
commitc368a113957d42666f080303783174e4adaf02b4 (patch)
tree96349d7f01be73cf6f80962bf34a9af543c2971c /tests/cli.rs
parentDon't use different syle for symlink symbol (diff)
parentUpdate README for separate .tar and .tar.gz flags (diff)
downloadminiserve-c368a113957d42666f080303783174e4adaf02b4.tar.gz
miniserve-c368a113957d42666f080303783174e4adaf02b4.zip
Merge branch 'master' into rfc-resolve-symlinks
Diffstat (limited to 'tests/cli.rs')
-rw-r--r--tests/cli.rs28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/cli.rs b/tests/cli.rs
index e09473d..f88b284 100644
--- a/tests/cli.rs
+++ b/tests/cli.rs
@@ -3,7 +3,7 @@ mod fixtures;
use assert_cmd::prelude::*;
use fixtures::Error;
use std::process::Command;
-use structopt::clap::{crate_name, crate_version};
+use structopt::clap::{crate_name, crate_version, Shell};
#[test]
/// Show help and exit.
@@ -27,3 +27,29 @@ fn version_shows() -> Result<(), Error> {
Ok(())
}
+
+#[test]
+/// Print completions and exit.
+fn print_completions() -> Result<(), Error> {
+ for shell in &Shell::variants() {
+ Command::cargo_bin("miniserve")?
+ .arg("--print-completions")
+ .arg(&shell)
+ .assert()
+ .success();
+ }
+
+ Ok(())
+}
+
+#[test]
+/// Print completions rejects invalid shells.
+fn print_completions_invalid_shell() -> Result<(), Error> {
+ Command::cargo_bin("miniserve")?
+ .arg("--print-completions")
+ .arg("fakeshell")
+ .assert()
+ .failure();
+
+ Ok(())
+}