mirror of https://github.com/tc39/test262.git
typeof ... fixups
This commit is contained in:
parent
12ca482cd4
commit
511ce3b2c1
|
@ -3,13 +3,50 @@
|
|||
|
||||
/*---
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof of BigInt and BigInt object
|
||||
info: >
|
||||
description: typeof BigInt literal and BigInt object
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
BigInt "bigint"
|
||||
Object(BigInt()) "object"
|
||||
|
||||
features: [BigInt]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof 0n, "bigint");
|
||||
assert.sameValue(typeof Object(0n), "object");
|
||||
assert.sameValue(
|
||||
typeof 0n,
|
||||
"bigint",
|
||||
"typeof 0n === 'bigint'"
|
||||
);
|
||||
assert.sameValue(
|
||||
typeof BigInt(0n),
|
||||
"bigint",
|
||||
"typeof BigInt(0n) === 'bigint'"
|
||||
);
|
||||
assert.sameValue(
|
||||
typeof BigInt(0),
|
||||
"bigint",
|
||||
"typeof BigInt(0) === 'bigint'"
|
||||
);
|
||||
assert.sameValue(
|
||||
typeof Object(BigInt(0n)),
|
||||
"object",
|
||||
"typeof Object(BigInt(0n)) === 'object'"
|
||||
);
|
||||
assert.sameValue(
|
||||
typeof Object(BigInt(0)),
|
||||
"object",
|
||||
"typeof Object(BigInt(0)) === 'object'"
|
||||
);
|
||||
assert.sameValue(
|
||||
typeof Object(0n),
|
||||
"object",
|
||||
"typeof Object(0n) === 'object'"
|
||||
);
|
||||
|
|
|
@ -2,26 +2,31 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Result of applying "typeof" operator to boolean is "boolean"
|
||||
es5id: 11.4.3_A3.3
|
||||
es6id: 12.5.6.1
|
||||
description: typeof (boolean value) === "boolean"
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof Boolean literal
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
Boolean "boolean"
|
||||
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof true,
|
||||
"boolean",
|
||||
'#1: typeof true === "boolean". Actual: ' + (typeof true)
|
||||
'typeof true === "boolean"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof false,
|
||||
"boolean",
|
||||
'#2: typeof false === "boolean". Actual: ' + (typeof false)
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof !-1,
|
||||
"boolean",
|
||||
'#3: typeof !-1 === "boolean". Actual: ' + (typeof !-1)
|
||||
'typeof false === "boolean"'
|
||||
);
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof Object (standard exotic and does not implement [[Call]]) === "object"
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
Object (standard exotic and does not implement [[Call]]) "object"
|
||||
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof this,
|
||||
"object",
|
||||
'typeof this === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Object(),
|
||||
"object",
|
||||
'typeof new Object() === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Array(),
|
||||
"object",
|
||||
'typeof new Array() === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new String(),
|
||||
"object",
|
||||
'typeof new String() === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Boolean(),
|
||||
"object",
|
||||
'typeof new Boolean() === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Number(),
|
||||
"object",
|
||||
'typeof new Number() === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Date(),
|
||||
"object",
|
||||
'typeof new Date() === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Error(),
|
||||
"object",
|
||||
' typeof new Error() === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new RegExp(),
|
||||
"object",
|
||||
' typeof new RegExp() === "object"'
|
||||
);
|
||||
|
|
@ -2,22 +2,35 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
There are two types of Function objects. Internal functions
|
||||
are built-in objects of the language, such as parseInt and Math.exp
|
||||
es5id: 10.1.1_A2_T1
|
||||
es6id: 12.5.6.1
|
||||
description: Checking types of parseInt and Math.exp
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof Object (implements [[Call]]) === "function"
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
Object (implements [[Call]]) "function"
|
||||
|
||||
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof Math.exp,
|
||||
"function",
|
||||
'#1: typeof Math.exp!=="function" '+typeof Math.exp
|
||||
'typeof Math.exp === "function"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof parseInt,
|
||||
"function",
|
||||
'#2: typeof parseInt!=="function" '+typeof parseInt
|
||||
'typeof parseInt === "function"'
|
||||
);
|
||||
|
||||
// TODO: should this be expanded to check all built-ins?
|
||||
// that might be excessive...
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof Object (ordinary and does not implement [[Call]]) === "object"
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
Object (ordinary and does not implement [[Call]]) "object"
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof Math,
|
||||
"object",
|
||||
'typeof Math === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Reflect,
|
||||
"object",
|
||||
'typeof Reflect === "object"'
|
||||
);
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: Operator "typeof" uses GetValue
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Set val to ? GetValue(val).
|
||||
...
|
||||
|
||||
GetValue ( V ):
|
||||
|
||||
...
|
||||
If IsUnresolvableReference(V) is true, throw a ReferenceError exception.
|
||||
|
||||
---*/
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
typeof x.x;
|
||||
});
|
|
@ -2,28 +2,43 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Operator "typeof" uses GetValue
|
||||
es5id: 11.4.3_A2_T1
|
||||
es6id: 12.5.6.1
|
||||
description: Either Type(x) is not Reference or GetBase(x) is not null
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: Operator "typeof" uses GetValue
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Set val to ? GetValue(val).
|
||||
...
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof 0,
|
||||
"number",
|
||||
'#1: typeof 0 === "number". Actual: ' + (typeof 0)
|
||||
);
|
||||
var count = 0;
|
||||
|
||||
Object.defineProperties(this, {
|
||||
x: {
|
||||
value: 1
|
||||
},
|
||||
y: {
|
||||
get() {
|
||||
count++;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var x = 0;
|
||||
assert.sameValue(
|
||||
typeof x,
|
||||
"number",
|
||||
'#2: typeof x === "number". Actual: ' + (typeof x)
|
||||
'typeof x === "number"'
|
||||
);
|
||||
|
||||
var x = new Object();
|
||||
assert.sameValue(
|
||||
typeof x,
|
||||
"object",
|
||||
'#3: var x = new Object(); typeof x === "object". Actual: ' + (typeof x)
|
||||
typeof y,
|
||||
"number",
|
||||
'typeof y === "number"'
|
||||
);
|
||||
|
||||
assert.sameValue(count, 1);
|
||||
|
|
|
@ -2,64 +2,75 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
Result of applying "typeof" operator to the object that is native and
|
||||
implements [[Call]] is "function"
|
||||
es5id: 11.4.3_A3.7
|
||||
es6id: 12.5.6.1
|
||||
description: typeof (object with [[Call]]) === "function"
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof Object (implements [[Call]]) === "function"
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
Object (implements [[Call]]) "function"
|
||||
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Function(),
|
||||
"function",
|
||||
'#1: typeof new Function() === "function". Actual: ' + (typeof new Function())
|
||||
'typeof new Function() === "function"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Function(),
|
||||
"function",
|
||||
'#2: typeof Function() === "function". Actual: ' + (typeof Function())
|
||||
'typeof Function() === "function"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Object,
|
||||
"function",
|
||||
'#3: typeof Object === "function". Actual: ' + (typeof Object)
|
||||
'typeof Object === "function"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof String,
|
||||
"function",
|
||||
'#4: typeof String === "function". Actual: ' + (typeof String)
|
||||
'typeof String === "function"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Boolean,
|
||||
"function",
|
||||
'#5: typeof Boolean === "function". Actual: ' + (typeof Boolean)
|
||||
'typeof Boolean === "function"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Number,
|
||||
"function",
|
||||
'#6: typeof Number === "function". Actual: ' + (typeof Number)
|
||||
'typeof Number === "function"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Date,
|
||||
"function",
|
||||
'#7: typeof Date === "function". Actual: ' + (typeof Date)
|
||||
'typeof Date === "function"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Error,
|
||||
"function",
|
||||
'#8: typeof Error === "function". Actual: ' + (typeof Error)
|
||||
'typeof Error === "function"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof RegExp,
|
||||
"function",
|
||||
'#9: typeof RegExp === "function". Actual: ' + (typeof RegExp)
|
||||
'typeof RegExp === "function"'
|
||||
);
|
||||
|
||||
// TODO: Should this be extended to include all built-ins?
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
Result of applying "typeof" operator to the object that is native and
|
||||
doesn't implement [[Call]] is "object"
|
||||
es5id: 11.4.3_A3.6
|
||||
es6id: 12.5.6.1
|
||||
description: typeof (object without [[Call]]) === "object"
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof this,
|
||||
"object",
|
||||
'#1: typeof this === "object". Actual: ' + (typeof this)
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Object(),
|
||||
"object",
|
||||
'#2: typeof new Object() === "object". Actual: ' + (typeof new Object())
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Array(1,2,3),
|
||||
"object",
|
||||
'#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3))
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Array(1,2,3),
|
||||
"object",
|
||||
'#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3))
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new String("x"),
|
||||
"object",
|
||||
'#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x"))
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Boolean(true),
|
||||
"object",
|
||||
'#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true))
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Number(1),
|
||||
"object",
|
||||
'#7: typeof new Number(1) === "object". Actual: ' + (typeof new Number(1))
|
||||
);
|
||||
|
||||
//The Math object does not have a [[Construct]] property;
|
||||
//it is not possible to use the Math object as a constructor with the new operator.
|
||||
//The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a object.
|
||||
assert.sameValue(
|
||||
typeof Math,
|
||||
"object",
|
||||
'#8: typeof Math === "object". Actual: ' + (typeof Math)
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Date(),
|
||||
"object",
|
||||
'#9: typeof new Date() === "object". Actual: ' + (typeof new Date())
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new Error(),
|
||||
"object",
|
||||
'#10: typeof new Error() === "object". Actual: ' + (typeof new Error())
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof new RegExp(),
|
||||
"object",
|
||||
'#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp())
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof RegExp(),
|
||||
"object",
|
||||
'#12: typeof RegExp() === "object". Actual: ' + (typeof RegExp())
|
||||
);
|
|
@ -2,20 +2,30 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Result of applying "typeof" operator to null is "object"
|
||||
es5id: 11.4.3_A3.2
|
||||
es6id: 12.5.6.1
|
||||
description: typeof null === "object"
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof Object (implements [[Call]]) === "function"
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
Null "object"
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof null,
|
||||
"object",
|
||||
'#1: typeof null === "object". Actual: ' + (typeof null)
|
||||
'typeof null === "object"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof RegExp("0").exec("1"),
|
||||
"object",
|
||||
'#2: typeof RegExp("0").exec("1") === "object". Actual: ' + (typeof RegExp("0").exec("1"))
|
||||
'typeof RegExp("0").exec("1") === "object"'
|
||||
);
|
||||
|
|
|
@ -2,38 +2,48 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Result of appying "typeof" operator to number is "number"
|
||||
es5id: 11.4.3_A3.4
|
||||
es6id: 12.5.6.1
|
||||
description: typeof (number value) === "number"
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof Number literal
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
Number "number"
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof 1,
|
||||
"number",
|
||||
'typeof 1 === "number". Actual: ' + (typeof 1)
|
||||
'typeof 1 === "number"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof NaN,
|
||||
"number",
|
||||
'typeof NaN === "number". Actual: ' + (typeof NaN)
|
||||
'typeof NaN === "number"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Infinity,
|
||||
"number",
|
||||
'typeof Infinity === "number". Actual: ' + (typeof Infinity)
|
||||
'typeof Infinity === "number"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof -Infinity,
|
||||
"number",
|
||||
'typeof -Infinity === "number". Actual: ' + (typeof -Infinity)
|
||||
'typeof -Infinity === "number"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Math.PI,
|
||||
"number",
|
||||
'typeof Math.PI === "number". Actual: ' + (typeof Math.PI)
|
||||
'typeof Math.PI === "number"'
|
||||
);
|
||||
|
|
|
@ -2,44 +2,54 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Result of appying "typeof" operator to string is "string"
|
||||
es5id: 11.4.3_A3.5
|
||||
es6id: 12.5.6.1
|
||||
description: typeof (string value) === "string"
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof String literal
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
String "string"
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof "1",
|
||||
"string",
|
||||
'#1: typeof "1" === "string". Actual: ' + (typeof "1")
|
||||
'typeof "1" === "string"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof "NaN",
|
||||
"string",
|
||||
'#2: typeof "NaN" === "string". Actual: ' + (typeof "NaN")
|
||||
'typeof "NaN" === "string"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof "Infinity",
|
||||
"string",
|
||||
'#3: typeof "Infinity" === "string". Actual: ' + (typeof "Infinity")
|
||||
'typeof "Infinity" === "string"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof "",
|
||||
"string",
|
||||
'#4: typeof "" === "string". Actual: ' + (typeof "")
|
||||
'typeof "" === "string"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof "true",
|
||||
"string",
|
||||
'#5: typeof "true" === "string". Actual: ' + (typeof "true")
|
||||
'typeof "true" === "string"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Date(),
|
||||
"string",
|
||||
'#6: typeof Date() === "string". Actual: ' + (typeof Date())
|
||||
'typeof Date() === "string"'
|
||||
);
|
||||
|
|
|
@ -1,18 +1,45 @@
|
|||
// Copyright (C) 2013 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.5.6.1
|
||||
description: >
|
||||
typeof Symbol() returns 'symbol'.
|
||||
typeof Object(Symbol()) returns 'object'.
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof Symbol() and Object(Symbol)
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
Symbol "symbol"
|
||||
Object(Symbol()) "object"
|
||||
|
||||
features: [Symbol]
|
||||
---*/
|
||||
assert.sameValue(typeof Symbol('A'), 'symbol', "`typeof Symbol('A')` is `'symbol'`");
|
||||
assert.sameValue(typeof Symbol(), 'symbol', "`typeof Symbol()` is `'symbol'`");
|
||||
|
||||
var symA = Symbol();
|
||||
assert.sameValue(typeof symA, 'symbol', "`typeof symA` is `'symbol'`, after executing `var symA = Symbol();`");
|
||||
assert.sameValue(
|
||||
typeof Symbol(),
|
||||
"symbol",
|
||||
"typeof Symbol() === 'symbol'"
|
||||
);
|
||||
|
||||
var symB = Object(Symbol());
|
||||
assert.sameValue(typeof symB, 'object', "`typeof symB` is `'object'`, after executing `var symB = Object(Symbol());`");
|
||||
assert.sameValue(
|
||||
typeof Symbol("A"),
|
||||
"symbol",
|
||||
"typeof Symbol('A') === 'symbol'"
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Object(Symbol()),
|
||||
"object",
|
||||
"typeof Object(Symbol()) === 'object'"
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof Object(Symbol("A")),
|
||||
"object",
|
||||
"typeof Object(Symbol('A')) === 'object'"
|
||||
);
|
||||
|
||||
|
|
|
@ -2,20 +2,29 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Result of applying "typeof" operator to undefined is "undefined"
|
||||
es5id: 11.4.3_A3.1
|
||||
es6id: 12.5.6.1
|
||||
description: typeof undefined === "undefined"
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: typeof undefined and void 0
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
Return a String according to Table 35.
|
||||
|
||||
#table-35
|
||||
|
||||
Undefined "undefined"
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof undefined,
|
||||
"undefined",
|
||||
'#1: typeof undefined === "undefined". Actual: ' + (typeof undefined)
|
||||
'typeof undefined === "undefined"'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
typeof void 0,
|
||||
"undefined",
|
||||
'#2: typeof void 0 === "undefined". Actual: ' + (typeof void 0)
|
||||
'typeof void 0 === "undefined"'
|
||||
);
|
||||
|
|
|
@ -2,12 +2,22 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Operator "typeof" uses GetValue
|
||||
es5id: 11.4.3_A2_T2
|
||||
es6id: 12.5.6.1
|
||||
description: If GetBase(x) is null, return "undefined"
|
||||
esid: sec-typeof-operator-runtime-semantics-evaluation
|
||||
description: If IsUnresolvableReference(val) is true, return "undefined".
|
||||
info: |
|
||||
The typeof Operator
|
||||
|
||||
Runtime Semantics: Evaluation
|
||||
|
||||
...
|
||||
If Type(val) is Reference, then
|
||||
If IsUnresolvableReference(val) is true, return "undefined".
|
||||
...
|
||||
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof x, "undefined", '#1: typeof x === "undefined". Actual: ' + (typeof x)
|
||||
typeof x,
|
||||
"undefined",
|
||||
"typeof x === 'undefined'"
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue