diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/run_tests.rs | 19 | ||||
-rw-r--r-- | tests/unit/files_test.ts | 8 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index 68b72ffed..02fb915b5 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -4304,6 +4304,25 @@ fn set_raw_should_not_panic_on_no_tty() { assert!(stderr.contains("BadResource")); } +#[cfg(not(windows))] +#[test] +fn fsfile_set_raw_should_not_panic_on_no_tty() { + let output = util::deno_cmd() + .arg("eval") + .arg("Deno.openSync(\"/dev/stdin\").setRaw(true)") + // stdin set to piped so it certainly does not refer to TTY + .stdin(std::process::Stdio::piped()) + // stderr is piped so we can capture output. + .stderr_piped() + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(!output.status.success()); + let stderr = std::str::from_utf8(&output.stderr).unwrap().trim(); + assert!(stderr.contains("BadResource")); +} + #[test] fn timeout_clear() { // https://github.com/denoland/deno/issues/7599 diff --git a/tests/unit/files_test.ts b/tests/unit/files_test.ts index 47fa03ddd..0034a8472 100644 --- a/tests/unit/files_test.ts +++ b/tests/unit/files_test.ts @@ -10,6 +10,8 @@ import { } from "./test_util.ts"; import { copy } from "@std/streams/copy.ts"; +// Note tests for Deno.FsFile.setRaw is in integration tests. + Deno.test(function filesStdioFileDescriptors() { assertEquals(Deno.stdin.rid, 0); assertEquals(Deno.stdout.rid, 1); @@ -899,6 +901,12 @@ Deno.test( }, ); +Deno.test({ permissions: { read: true } }, function fsFileIsTerminal() { + // CI not under TTY, so cannot test stdin/stdout/stderr. + using file = Deno.openSync("tests/testdata/assets/hello.txt"); + assert(!file.isTerminal()); +}); + Deno.test( { permissions: { read: true, run: true, hrtime: true } }, async function fsFileLockFileSync() { |