diff options
Diffstat (limited to 'js/files_test.ts')
-rw-r--r-- | js/files_test.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/js/files_test.ts b/js/files_test.ts new file mode 100644 index 000000000..82af10aa2 --- /dev/null +++ b/js/files_test.ts @@ -0,0 +1,20 @@ +// Copyright 2018 the Deno authors. All rights reserved. MIT license. + +import * as deno from "deno"; +import { test, assert, assertEqual } from "./test_util.ts"; + +test(function filesStdioFileDescriptors() { + assertEqual(deno.stdin.fd, 0); + assertEqual(deno.stdout.fd, 1); + assertEqual(deno.stderr.fd, 2); +}); + +test(async function filesCopyToStdout() { + const filename = "package.json"; + const file = await deno.open(filename); + assert(file.fd > 2); + const bytesWritten = await deno.copy(deno.stdout, file); + const fileSize = deno.statSync(filename).len; + assertEqual(bytesWritten, fileSize); + console.log("bytes written", bytesWritten); +}); |