diff options
author | andy finch <andyfinch7@gmail.com> | 2019-05-08 19:20:30 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-05-08 19:20:30 -0400 |
commit | 2edee3367dc9003b721cf87ca57e820c7acf7b25 (patch) | |
tree | 4bc91161188344d61b7e20107701c7e2af6b4ae1 /tools/complex_permissions_test.ts | |
parent | ac8c6fec5bb2be97c8dbdb2286d2688575a593f2 (diff) |
First pass at permissions whitelist (#2129)
Diffstat (limited to 'tools/complex_permissions_test.ts')
-rw-r--r-- | tools/complex_permissions_test.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/complex_permissions_test.ts b/tools/complex_permissions_test.ts new file mode 100644 index 000000000..72377ff93 --- /dev/null +++ b/tools/complex_permissions_test.ts @@ -0,0 +1,24 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +const { args, readFileSync, writeFileSync, exit, dial } = Deno; + +const name = args[1]; +const test: (args: string[]) => void = { + read: (files: string[]): void => { + files.forEach((file): any => readFileSync(file)); + }, + write: (files: string[]): void => { + files.forEach( + (file): any => writeFileSync(file, new Uint8Array(), { append: true }) + ); + }, + net: (hosts: string[]): void => { + hosts.forEach((host): any => fetch(host)); + } +}[name]; + +if (!test) { + console.log("Unknown test:", name); + exit(1); +} + +test(args.slice(2)); |