MCPcopy Create free account
hub / github.com/nodejs/node / testTypeOf

Function testTypeOf

deps/v8/test/mjsunit/baseline/test-baseline.js:81–93  ·  view source on GitHub ↗
(o, t)

Source from the content-addressed store, hash-verified

79
80// Typeof
81function testTypeOf(o, t) {
82 let types = ['number', 'string', 'symbol', 'boolean', 'bigint', 'undefined',
83 'function', 'object'];
84 assertEquals(t, eval('run(()=>typeof ' + o + ')'),
85 `(()=>typeof ${o})() == ${t}`);
86 assertTrue(eval('run(()=>typeof ' + o + ' == "' + t + '")'),
87 `typeof ${o} == ${t}`);
88 var other_types = types.filter((x) => x !== t);
89 for (var other of other_types) {
90 assertFalse(eval('run(()=>typeof ' + o + ' == "' + other + '")'),
91 `typeof ${o} != ${other}`);
92 }
93}
94
95testTypeOf('undefined', 'undefined');
96testTypeOf('null', 'object');

Callers 1

test-baseline.jsFile · 0.85

Calls 5

filterMethod · 0.65
assertEqualsFunction · 0.50
evalFunction · 0.50
assertTrueFunction · 0.50
assertFalseFunction · 0.50

Tested by

no test coverage detected