summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests.rs
diff options
context:
space:
mode:
authorMaayan Hanin <maayan.asa.hanin@gmail.com>2020-07-09 22:06:51 +0300
committerGitHub <noreply@github.com>2020-07-09 21:06:51 +0200
commitedb7a0eead3604316b3cca2ac9122c5599445a63 (patch)
treee8d7fe06992decf52c81678b4c000a6edeb922fd /cli/tests/integration_tests.rs
parent202e7fa6ad366ee56a6d070e94eaecb6dbc745bf (diff)
fix(cli): panic when stdio is null on windows (#6528)
Fixes: #6409
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r--cli/tests/integration_tests.rs59
1 files changed, 59 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 87a6f9d63..2ec25d0d0 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -3116,3 +3116,62 @@ fn set_raw_should_not_panic_on_no_tty() {
let stderr = std::str::from_utf8(&output.stderr).unwrap().trim();
assert!(stderr.contains("BadResource"));
}
+
+#[cfg(windows)]
+enum WinProcConstraints {
+ NoStdIn,
+ NoStdOut,
+ NoStdErr,
+}
+
+#[cfg(windows)]
+fn run_deno_script_constrained(
+ script_path: std::path::PathBuf,
+ constraints: WinProcConstraints,
+) -> Result<(), i64> {
+ let file_path = "cli/tests/DenoWinRunner.ps1";
+ let constraints = match constraints {
+ WinProcConstraints::NoStdIn => "1",
+ WinProcConstraints::NoStdOut => "2",
+ WinProcConstraints::NoStdErr => "4",
+ };
+ let deno_exe_path = util::deno_exe_path()
+ .into_os_string()
+ .into_string()
+ .unwrap();
+
+ let deno_script_path = script_path.into_os_string().into_string().unwrap();
+
+ let args = vec![&deno_exe_path[..], &deno_script_path[..], constraints];
+ util::run_powershell_script_file(file_path, args)
+}
+
+#[cfg(windows)]
+#[test]
+fn should_not_panic_on_no_stdin() {
+ let output = run_deno_script_constrained(
+ util::tests_path().join("echo.ts"),
+ WinProcConstraints::NoStdIn,
+ );
+ output.unwrap();
+}
+
+#[cfg(windows)]
+#[test]
+fn should_not_panic_on_no_stdout() {
+ let output = run_deno_script_constrained(
+ util::tests_path().join("echo.ts"),
+ WinProcConstraints::NoStdOut,
+ );
+ output.unwrap();
+}
+
+#[cfg(windows)]
+#[test]
+fn should_not_panic_on_no_stderr() {
+ let output = run_deno_script_constrained(
+ util::tests_path().join("echo.ts"),
+ WinProcConstraints::NoStdErr,
+ );
+ output.unwrap();
+}