diff options
author | uki00a <uki00a@gmail.com> | 2020-07-08 23:35:45 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 10:35:45 -0400 |
commit | a2bf61d1ae3ba2ff746a98ad2f0a96b6fc7782d0 (patch) | |
tree | d7d074acd7de7ecdc3094c5f6b0c5ded696f3e39 /cli/tests/unit/os_test.ts | |
parent | 231899695d410d8d8c14c0936682a90e98bc6fd3 (diff) |
feat(unstable): Deno.ppid (#6539)
Diffstat (limited to 'cli/tests/unit/os_test.ts')
-rw-r--r-- | cli/tests/unit/os_test.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/tests/unit/os_test.ts b/cli/tests/unit/os_test.ts index b737d939a..e969464e5 100644 --- a/cli/tests/unit/os_test.ts +++ b/cli/tests/unit/os_test.ts @@ -111,6 +111,28 @@ unitTest(function osPid(): void { assert(Deno.pid > 0); }); +unitTest(function osPpid(): void { + assert(Deno.ppid > 0); +}); + +unitTest( + { perms: { run: true, read: true } }, + async function osPpidIsEqualToPidOfParentProcess(): Promise<void> { + const decoder = new TextDecoder(); + const process = Deno.run({ + cmd: [Deno.execPath(), "eval", "-p", "--unstable", "Deno.ppid"], + stdout: "piped", + env: { NO_COLOR: "true" }, + }); + const output = await process.output(); + process.close(); + + const expected = Deno.pid; + const actual = parseInt(decoder.decode(output)); + assertEquals(actual, expected); + } +); + unitTest({ perms: { read: true } }, function execPath(): void { assertNotEquals(Deno.execPath(), ""); }); |