summaryrefslogtreecommitdiff
path: root/js/os_test.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-09-09 20:25:43 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-09-10 00:14:28 -0400
commit35bc9ddf636734a424b8f69ca7a49af071193002 (patch)
tree2f5e0908859837110ee765968abf6317c200257e /js/os_test.ts
parentc29392b25f6a7ade25a8205cabb9c3548e771ca2 (diff)
Implement deno.readFile()
As an example of how to implement ops that have both sync and async versions.
Diffstat (limited to 'js/os_test.ts')
-rw-r--r--js/os_test.ts28
1 files changed, 0 insertions, 28 deletions
diff --git a/js/os_test.ts b/js/os_test.ts
index 7a252cb73..544d7d49f 100644
--- a/js/os_test.ts
+++ b/js/os_test.ts
@@ -85,34 +85,6 @@ test(async function lstatSyncNotFound() {
assertEqual(badInfo, undefined);
});
-test(async function readFileSyncSuccess() {
- const data = deno.readFileSync("package.json");
- if (!data.byteLength) {
- throw Error(
- `Expected positive value for data.byteLength ${data.byteLength}`
- );
- }
- const decoder = new TextDecoder("utf-8");
- const json = decoder.decode(data);
- const pkg = JSON.parse(json);
- assertEqual(pkg.name, "deno");
-});
-
-/* TODO We should be able to catch specific types.
-test(function tests_readFileSync_NotFound() {
- let caughtError = false;
- let data;
- try {
- data = deno.readFileSync("bad_filename");
- } catch (e) {
- caughtError = true;
- assert(e instanceof deno.NotFound);
- }
- assert(caughtError);
- assert(data === undefined);
-});
-*/
-
testPerm({ write: true }, function writeFileSyncSuccess() {
const enc = new TextEncoder();
const data = enc.encode("Hello");