tests(help): Add test for -Z help output
authorKlaus Purer <klaus.purer@gmail.com>
Sat, 31 Mar 2018 09:19:28 +0000 (11:19 +0200)
committerKlaus Purer <klaus.purer@gmail.com>
Sat, 31 Mar 2018 09:19:28 +0000 (11:19 +0200)
src/bin/cli.rs
tests/testsuite/cargo_command.rs

index ed5c4805d011c71b100f67627bd16a9c01d48ecd..f1440053d6ccca8816f13546b1828407bccde92c 100644 (file)
@@ -16,12 +16,11 @@ pub fn main(config: &mut Config) -> CliResult {
             "
 Available unstable (nightly-only) flags:
 
-    -Z avoid-dev-deps    -- Avoid installing dev-dependencies if possible
-    -Z minimal-versions  -- Install minimal dependency versions instead of maximum
-    -Z no-index-update   -- Do not update the registry, avoids a network request for benchmarking
-    -Z offline           -- Offline mode that does not perform network requests
-    -Z print-im-a-teapot -- Example option for demonstration purposes
-    -Z unstable-options  -- Allow the usage of unstable options such as --registry
+    -Z avoid-dev-deps   -- Avoid installing dev-dependencies if possible
+    -Z minimal-versions -- Install minimal dependency versions instead of maximum
+    -Z no-index-update  -- Do not update the registry, avoids a network request for benchmarking
+    -Z offline          -- Offline mode that does not perform network requests
+    -Z unstable-options -- Allow the usage of unstable options such as --registry
 
 Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
         );
index f3ceeca6318892502d359f1f6ac60058de90f662..eecf74a8457725bc33ad5f9c38a5038b71b279ff 100644 (file)
@@ -331,3 +331,15 @@ fn explain() {
         ),
     );
 }
+
+// Test that the output of 'cargo -Z help' shows a different help screen with
+// all the -Z flags.
+#[test]
+fn z_flags_help() {
+    assert_that(
+        cargo_process().arg("-Z").arg("help"),
+        execs()
+            .with_status(0)
+            .with_stdout_contains("-Z unstable-options"),
+    );
+}