summaryrefslogtreecommitdiff
path: root/cli/tests/run_tests.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-01-07 17:25:34 +0100
committerGitHub <noreply@github.com>2023-01-07 17:25:34 +0100
commitfac64478157ee563b185edb5734688e4523df3a1 (patch)
tree888d562982e1fc37dfb9a4459928bcec84d55dfc /cli/tests/run_tests.rs
parent82e930726ee5dbac8e6eae0962c07c72daf9843c (diff)
refactor(permissions): add PermissionsContainer struct for internal mutability (#17134)
Turns out we were cloning permissions which after prompting were discarded, so the state of permissions was never preserved. To handle that we need to store all permissions behind "Arc<Mutex<>>" (because there are situations where we need to send them to other thread). Testing and benching code still uses "Permissions" in most places - it's undesirable to share the same permission set between various test/bench files - otherwise granting or revoking permissions in one file would influence behavior of other test files.
Diffstat (limited to 'cli/tests/run_tests.rs')
-rw-r--r--cli/tests/run_tests.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/cli/tests/run_tests.rs b/cli/tests/run_tests.rs
index dfe95d9a8..8460d3f8f 100644
--- a/cli/tests/run_tests.rs
+++ b/cli/tests/run_tests.rs
@@ -3725,4 +3725,21 @@ console.log("finish");
args: "run --quiet run/001_hello.js --allow-net",
output: "run/001_hello.js.out",
});
+
+ // Regression test for https://github.com/denoland/deno/issues/16772
+ #[test]
+ fn file_fetcher_preserves_permissions() {
+ let _guard = util::http_server();
+ util::with_pty(&["repl"], |mut console| {
+ console.write_text(
+ "const a = import('http://127.0.0.1:4545/run/019_media_types.ts');",
+ );
+ console.write_text("y");
+ console.write_line("");
+ console.write_line("close();");
+ let output = console.read_all_output();
+ assert_contains!(output, "success");
+ assert_contains!(output, "true");
+ });
+ }
}