about summary refs log tree commit diff
path: root/src/test/ui/command/command-argv0-debug.rs
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2019-12-11 21:39:57 -0800
committerJeremy Fitzhardinge <jsgf@fb.com>2019-12-16 14:44:16 -0800
commitce56e7528359b9581cac0b59080d25468d60de20 (patch)
treeb96bbc2c0c8627ca77d82ffe907e64087ae1651f /src/test/ui/command/command-argv0-debug.rs
parent232022ff176bc77d19137ba7b3a40b73b403df9b (diff)
downloadrust-ce56e7528359b9581cac0b59080d25468d60de20.tar.gz
rust-ce56e7528359b9581cac0b59080d25468d60de20.zip
Move command-related tests into command/
Diffstat (limited to 'src/test/ui/command/command-argv0-debug.rs')
-rw-r--r--src/test/ui/command/command-argv0-debug.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/command/command-argv0-debug.rs b/src/test/ui/command/command-argv0-debug.rs
new file mode 100644
index 00000000000..133d2ada2b2
--- /dev/null
+++ b/src/test/ui/command/command-argv0-debug.rs
@@ -0,0 +1,24 @@
+// run-pass
+
+// ignore-windows - this is a unix-specific test
+// ignore-cloudabi no processes
+// ignore-emscripten no processes
+// ignore-sgx no processes
+#![feature(process_set_argv0)]
+
+use std::os::unix::process::CommandExt;
+use std::process::Command;
+
+fn main() {
+    let mut command = Command::new("some-boring-name");
+
+    assert_eq!(format!("{:?}", command), r#""some-boring-name""#);
+
+    command.args(&["1", "2", "3"]);
+
+    assert_eq!(format!("{:?}", command), r#""some-boring-name" "1" "2" "3""#);
+
+    command.arg0("exciting-name");
+
+    assert_eq!(format!("{:?}", command), r#"["some-boring-name"] "exciting-name" "1" "2" "3""#);
+}