From 48e7f3e313c19d8df1a05f0ccc17ac02e41dda6a Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Wed, 26 Jul 2023 15:07:57 +0200 Subject: Have a better file name than just the issue id --- library/std/tests/issue-15149.rs | 36 ----------------------------------- library/std/tests/process_spawning.rs | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 library/std/tests/issue-15149.rs create mode 100644 library/std/tests/process_spawning.rs diff --git a/library/std/tests/issue-15149.rs b/library/std/tests/issue-15149.rs deleted file mode 100644 index 52e5b55fb9d..00000000000 --- a/library/std/tests/issue-15149.rs +++ /dev/null @@ -1,36 +0,0 @@ -use std::env; -use std::fs; -use std::process; -use std::str; - -mod common; - -#[test] -fn issue_15149() { - // If we're the parent, copy our own binary to a new directory. - let my_path = env::current_exe().unwrap(); - - let temp = common::tmpdir(); - let child_dir = temp.join("issue-15140-child"); - fs::create_dir_all(&child_dir).unwrap(); - - let child_path = child_dir.join(&format!("mytest{}", env::consts::EXE_SUFFIX)); - fs::copy(&my_path, &child_path).unwrap(); - - // Append the new directory to our own PATH. - let path = { - let mut paths: Vec<_> = env::split_paths(&env::var_os("PATH").unwrap()).collect(); - paths.push(child_dir.to_path_buf()); - env::join_paths(paths).unwrap() - }; - - let child_output = - process::Command::new("mytest").env("PATH", &path).arg("child").output().unwrap(); - - assert!( - child_output.status.success(), - "child assertion failed\n child stdout:\n {}\n child stderr:\n {}", - str::from_utf8(&child_output.stdout).unwrap(), - str::from_utf8(&child_output.stderr).unwrap() - ); -} diff --git a/library/std/tests/process_spawning.rs b/library/std/tests/process_spawning.rs new file mode 100644 index 00000000000..52e5b55fb9d --- /dev/null +++ b/library/std/tests/process_spawning.rs @@ -0,0 +1,36 @@ +use std::env; +use std::fs; +use std::process; +use std::str; + +mod common; + +#[test] +fn issue_15149() { + // If we're the parent, copy our own binary to a new directory. + let my_path = env::current_exe().unwrap(); + + let temp = common::tmpdir(); + let child_dir = temp.join("issue-15140-child"); + fs::create_dir_all(&child_dir).unwrap(); + + let child_path = child_dir.join(&format!("mytest{}", env::consts::EXE_SUFFIX)); + fs::copy(&my_path, &child_path).unwrap(); + + // Append the new directory to our own PATH. + let path = { + let mut paths: Vec<_> = env::split_paths(&env::var_os("PATH").unwrap()).collect(); + paths.push(child_dir.to_path_buf()); + env::join_paths(paths).unwrap() + }; + + let child_output = + process::Command::new("mytest").env("PATH", &path).arg("child").output().unwrap(); + + assert!( + child_output.status.success(), + "child assertion failed\n child stdout:\n {}\n child stderr:\n {}", + str::from_utf8(&child_output.stdout).unwrap(), + str::from_utf8(&child_output.stderr).unwrap() + ); +} -- cgit 1.4.1-3-g733a5