1'use strict'; 2require('../common'); 3 4const assert = require('assert'); 5const symbol = Symbol('sym'); 6 7// Verify that getting via a symbol key returns undefined. 8assert.strictEqual(process.env[symbol], undefined); 9 10// Verify that assigning via a symbol key throws. 11// The message depends on the JavaScript engine and so will be different between 12// different JavaScript engines. Confirm that the `Error` is a `TypeError` only. 13assert.throws(() => { 14 process.env[symbol] = 42; 15}, TypeError); 16 17// Verify that assigning a symbol value throws. 18// The message depends on the JavaScript engine and so will be different between 19// different JavaScript engines. Confirm that the `Error` is a `TypeError` only. 20assert.throws(() => { 21 process.env.foo = symbol; 22}, TypeError); 23 24// Verify that using a symbol with the in operator returns false. 25assert.strictEqual(symbol in process.env, false); 26 27// Verify that deleting a symbol key returns true. 28assert.strictEqual(delete process.env[symbol], true); 29 30// Checks that well-known symbols like `Symbol.toStringTag` won’t throw. 31Object.prototype.toString.call(process.env); 32