summaryrefslogtreecommitdiff
path: root/js/test_util.ts
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2018-11-15 20:07:40 -0800
committerRyan Dahl <ry@tinyclouds.org>2018-11-16 12:07:40 +0800
commit48bf4062e4359674e1a417100eb76a6347e77fc1 (patch)
treee52f2c6c63a2afcdf2d5efc059e43c7f55f2c653 /js/test_util.ts
parent9b702da9e53b6efbc7a333380bcfb3d57733730e (diff)
First pass at running subprocesses (#1156)
Diffstat (limited to 'js/test_util.ts')
-rw-r--r--js/test_util.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/js/test_util.ts b/js/test_util.ts
index 34a920d47..93fc67491 100644
--- a/js/test_util.ts
+++ b/js/test_util.ts
@@ -18,17 +18,19 @@ interface DenoPermissions {
write?: boolean;
net?: boolean;
env?: boolean;
+ run?: boolean;
}
function permToString(perms: DenoPermissions): string {
const w = perms.write ? 1 : 0;
const n = perms.net ? 1 : 0;
const e = perms.env ? 1 : 0;
- return `permW${w}N${n}E${e}`;
+ const r = perms.run ? 1 : 0;
+ return `permW${w}N${n}E${e}R${r}`;
}
function permFromString(s: string): DenoPermissions {
- const re = /^permW([01])N([01])E([01])$/;
+ const re = /^permW([01])N([01])E([01])R([01])$/;
const found = s.match(re);
if (!found) {
throw Error("Not a permission string");
@@ -36,7 +38,8 @@ function permFromString(s: string): DenoPermissions {
return {
write: Boolean(Number(found[1])),
net: Boolean(Number(found[2])),
- env: Boolean(Number(found[3]))
+ env: Boolean(Number(found[3])),
+ run: Boolean(Number(found[4]))
};
}
@@ -53,8 +56,10 @@ test(function permSerialization() {
for (const write of [true, false]) {
for (const net of [true, false]) {
for (const env of [true, false]) {
- const perms: DenoPermissions = { write, net, env };
- testing.assertEqual(perms, permFromString(permToString(perms)));
+ for (const run of [true, false]) {
+ const perms: DenoPermissions = { write, net, env, run };
+ testing.assertEqual(perms, permFromString(permToString(perms)));
+ }
}
}
}