From 45eb2f9b37c2c7498c58eb45f76667aaa4a7d731 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 23 Feb 2020 20:40:44 +0100 Subject: feat(std/node): add os Symbol.toPrimitive methods (#4073) Node's os module exports a number of methods that evaluate to themselves when coerced to a primitive. I.e., `"" + os.arch` and `os.arch()` evaluate to the same string, and now Deno's shims do too. --- std/node/os_test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'std/node/os_test.ts') diff --git a/std/node/os_test.ts b/std/node/os_test.ts index f825ae192..2ceff79a4 100644 --- a/std/node/os_test.ts +++ b/std/node/os_test.ts @@ -174,6 +174,17 @@ test({ } }); +test({ + name: "Primitive coercion works as expected", + fn() { + assertEquals(`${os.arch}`, os.arch()); + assertEquals(`${os.endianness}`, os.endianness()); + assertEquals(`${os.homedir}`, os.homedir()); + assertEquals(`${os.hostname}`, os.hostname()); + assertEquals(`${os.platform}`, os.platform()); + } +}); + test({ name: "APIs not yet implemented", fn() { -- cgit v1.2.3