0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

feat(std/node): Added os.type (#8591)

This commit is contained in:
MVEMCJSUNPE 2020-12-15 04:13:22 -06:00 committed by GitHub
parent a5a151389e
commit 7a9766dd18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View file

@ -190,9 +190,18 @@ export function totalmem(): number {
return Deno.systemMemoryInfo().total;
}
/** Not yet implemented */
/** Returns operating system type (i.e. 'Windows_NT', 'Linux', 'Darwin') */
export function type(): string {
notImplemented(SEE_GITHUB_ISSUE);
switch (Deno.build.os) {
case "windows":
return "Windows_NT";
case "linux":
return "Linux";
case "darwin":
return "Darwin";
default:
throw Error("unreachable");
}
}
/** Not yet implemented */

View file

@ -47,6 +47,13 @@ Deno.test({
},
});
Deno.test({
name: "type is a string",
fn() {
assertEquals(typeof os.type(), "string");
},
});
Deno.test({
name: "getPriority(): PID must be a 32 bit integer",
fn() {
@ -245,13 +252,6 @@ Deno.test({
Error,
"Not implemented",
);
assertThrows(
() => {
os.type();
},
Error,
"Not implemented",
);
assertThrows(
() => {
os.uptime();