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:
parent
a5a151389e
commit
7a9766dd18
2 changed files with 18 additions and 9 deletions
|
@ -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 */
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue