diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-04-07 15:42:53 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-07 15:42:53 +1000 |
commit | d3f3e0d717fdbbf531fde0c9e7259f6bb887fa10 (patch) | |
tree | 71643d608635fb1eb1be9796bb5c01d83264ea03 /tests/specs/future/runtime_api/main.js | |
parent | b74a4f29f20c2435ea7c6d192353c1e99760edb0 (diff) |
FUTURE(ext/fs): make `Deno.FsFile` constructor illegal (#23235)
I'm unsure whether we're planning to make the `Deno.FsFile` constructor
illegal or remove `FsFile` from the `Deno.*` namspace in Deno 2. Either
way, this PR works towards the former. I'll create a superceding PR if
the latter is planned instead.
Towards #23089
Diffstat (limited to 'tests/specs/future/runtime_api/main.js')
-rw-r--r-- | tests/specs/future/runtime_api/main.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js index ed60a7b7c..9d3b3ed6c 100644 --- a/tests/specs/future/runtime_api/main.js +++ b/tests/specs/future/runtime_api/main.js @@ -31,4 +31,16 @@ console.log("Deno.writeAllSync is", Deno.writeAllSync); console.log("Deno.write is", Deno.write); console.log("Deno.writeSync is", Deno.writeSync); +try { + new Deno.FsFile(0); +} catch (error) { + if ( + error instanceof TypeError && + error.message === + "`Deno.FsFile` cannot be constructed, use `Deno.open()` or `Deno.openSync()` instead." + ) { + console.log("Deno.FsFile constructor is illegal"); + } +} + self.close(); |