blob: 6fb1775b053188f0fe3e38f5a7b48d8b9e0ca160 [file] [log] [blame]
basic tests for object literal shorthand construction
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS !!{a} is true
PASS ({a}).a === 1 is true
PASS ({a}).a === a is true
PASS ({foo})['foo'] === foo is true
PASS Object.getOwnPropertyDescriptor({a}, 'a').enumerable is true
PASS Object.getOwnPropertyDescriptor({a}, 'a').configurable is true
PASS Object.getOwnPropertyDescriptor({a}, 'a').writable is true
PASS Object.keys({a,b}).join() is "a,b"
PASS Object.keys({b,a}).join() is "b,a"
PASS equivalent({a}, {a:a}) is true
PASS equivalent({a}, {a:a}) is true
PASS equivalent({a,}, {a:a}) is true
PASS equivalent({a,a}, {a:a}) is true
PASS equivalent({a,b}, {a:a, b:b}) is true
PASS equivalent({ a , b }, {a:a, b:b}) is true
PASS equivalent({a,b,}, {a:a, b:b}) is true
PASS equivalent({a,b,a}, {a:a, b:b}) is true
PASS equivalent({b,a,a}, {b:b, a:a}) is true
PASS !equivalent({a}, {b:a}) is true
PASS !equivalent({b}, {a:b}) is true
PASS !equivalent({a,b}, {a:b, b:a}) is true
PASS equivalent({foo}, {foo:foo}) is true
PASS equivalent({foo}, {foo:foo}) is true
PASS equivalent({foo,}, {foo:foo}) is true
PASS equivalent({foo,foo}, {foo:foo}) is true
PASS equivalent({foo,bar}, {foo:foo, bar:bar}) is true
PASS equivalent({ foo , bar }, {foo:foo, bar:bar}) is true
PASS equivalent({foo,bar,}, {foo:foo, bar:bar}) is true
PASS equivalent({foo,bar,foo}, {foo:foo, bar:bar}) is true
PASS equivalent({bar,foo,foo}, {bar:bar, foo:foo}) is true
PASS equivalent({foo,bar,foo}, {foo:foo, bar:bar}) is true
PASS equivalent({bar,foo,foo}, {bar:bar, foo:foo}) is true
PASS !equivalent({foo}, {bar:foo}) is true
PASS !equivalent({bar}, {foo:bar}) is true
PASS !equivalent({foo,bar}, {foo:bar, bar:foo}) is true
PASS equivalent({a, b:b, c}, {a, b, c}) is true
PASS equivalent({a:a, b, c:c}, {a, b, c}) is true
PASS equivalent({a, b, c:c}, {a, b, c}) is true
PASS equivalent({'a':a, b, c:c}, {a, b, c}) is true
PASS equivalent({nest:{a}}.nest, {nest: {a:a}}.nest) is true
PASS equivalent({nest:[{a}]}.nest[0], {nest: [{a:a}]}.nest[0]) is true
PASS equivalent([{nest:[{a}]}][0].nest[0], [{nest: [{a:a}]}][0].nest[0]) is true
PASS equivalent({a,b,t,x,f,nul,un,fun,foo,bar}, {a:a, b:b, t:t, x:x, f:f, nul:null, un:un, fun:fun, foo:foo, bar:bar}) is true
PASS equivalent({eval}, {eval: eval}) is true
PASS ({noSuchIdentifier}) threw exception ReferenceError: Can't find variable: noSuchIdentifier.
PASS ({a,noSuchIdentifier}) threw exception ReferenceError: Can't find variable: noSuchIdentifier.
PASS ({noSuchIdentifier,a}) threw exception ReferenceError: Can't find variable: noSuchIdentifier.
PASS ({a,b,noSuchIdentifier}) threw exception ReferenceError: Can't find variable: noSuchIdentifier.
PASS ({get}) threw exception ReferenceError: Can't find variable: get.
PASS ({set}) threw exception ReferenceError: Can't find variable: set.
PASS equivalent({get}, {get: 1}) is true
PASS equivalent({set}, {set: 2}) is true
PASS ({get x(){ return true; }}).x is true
PASS ({get 'x'(){ return true; }}).x is true
PASS ({get 42(){ return true; }})['42'] is true
PASS !!Object.getOwnPropertyDescriptor({set x(value){}}, 'x').set is true
PASS !!Object.getOwnPropertyDescriptor({set 'x'(value){}}, 'x').set is true
PASS !!Object.getOwnPropertyDescriptor({set 42(value){}}, '42').set is true
PASS this.__proto__ = [] threw exception TypeError: Cannot set prototype of immutable prototype object.
PASS ({__proto__: this.__proto__}) instanceof Array is false
PASS __proto__ = [] threw exception TypeError: Object.prototype.__proto__ called on null or undefined.
PASS ({__proto__: __proto__}) instanceof Array threw exception TypeError: undefined is not an object (evaluating '__proto__').
SyntaxErrors
PASS ({break}) threw exception SyntaxError: Cannot use the keyword 'break' as a shorthand property name..
PASS ({case}) threw exception SyntaxError: Cannot use the keyword 'case' as a shorthand property name..
PASS ({catch}) threw exception SyntaxError: Cannot use the keyword 'catch' as a shorthand property name..
PASS ({class}) threw exception SyntaxError: Cannot use the keyword 'class' as a shorthand property name..
PASS ({const}) threw exception SyntaxError: Cannot use the keyword 'const' as a shorthand property name..
PASS ({continue}) threw exception SyntaxError: Cannot use the keyword 'continue' as a shorthand property name..
PASS ({debugger}) threw exception SyntaxError: Cannot use the keyword 'debugger' as a shorthand property name..
PASS ({default}) threw exception SyntaxError: Cannot use the keyword 'default' as a shorthand property name..
PASS ({delete}) threw exception SyntaxError: Cannot use the keyword 'delete' as a shorthand property name..
PASS ({do}) threw exception SyntaxError: Cannot use the keyword 'do' as a shorthand property name..
PASS ({else}) threw exception SyntaxError: Cannot use the keyword 'else' as a shorthand property name..
PASS ({enum}) threw exception SyntaxError: Cannot use the reserved word 'enum' as a shorthand property name..
PASS ({export}) threw exception SyntaxError: Cannot use the keyword 'export' as a shorthand property name..
PASS ({extends}) threw exception SyntaxError: Cannot use the keyword 'extends' as a shorthand property name..
PASS ({false}) threw exception SyntaxError: Cannot use the keyword 'false' as a shorthand property name..
PASS ({finally}) threw exception SyntaxError: Cannot use the keyword 'finally' as a shorthand property name..
PASS ({for}) threw exception SyntaxError: Cannot use the keyword 'for' as a shorthand property name..
PASS ({function}) threw exception SyntaxError: Cannot use the keyword 'function' as a shorthand property name..
PASS ({if}) threw exception SyntaxError: Cannot use the keyword 'if' as a shorthand property name..
PASS ({import}) threw exception SyntaxError: Cannot use the keyword 'import' as a shorthand property name..
PASS ({in}) threw exception SyntaxError: Cannot use the keyword 'in' as a shorthand property name..
PASS ({instanceof}) threw exception SyntaxError: Cannot use the keyword 'instanceof' as a shorthand property name..
PASS ({new}) threw exception SyntaxError: Cannot use the keyword 'new' as a shorthand property name..
PASS ({null}) threw exception SyntaxError: Cannot use the keyword 'null' as a shorthand property name..
PASS ({return}) threw exception SyntaxError: Cannot use the keyword 'return' as a shorthand property name..
PASS ({super}) threw exception SyntaxError: Cannot use the keyword 'super' as a shorthand property name..
PASS ({switch}) threw exception SyntaxError: Cannot use the keyword 'switch' as a shorthand property name..
PASS ({throw}) threw exception SyntaxError: Cannot use the keyword 'throw' as a shorthand property name..
PASS ({true}) threw exception SyntaxError: Cannot use the keyword 'true' as a shorthand property name..
PASS ({try}) threw exception SyntaxError: Cannot use the keyword 'try' as a shorthand property name..
PASS ({typeof}) threw exception SyntaxError: Cannot use the keyword 'typeof' as a shorthand property name..
PASS ({var}) threw exception SyntaxError: Cannot use the keyword 'var' as a shorthand property name..
PASS ({void}) threw exception SyntaxError: Cannot use the keyword 'void' as a shorthand property name..
PASS ({while}) threw exception SyntaxError: Cannot use the keyword 'while' as a shorthand property name..
PASS ({with}) threw exception SyntaxError: Cannot use the keyword 'with' as a shorthand property name..
Contextual Keywords
PASS ({let}) threw exception ReferenceError: Can't find variable: let.
PASS ({async}) threw exception ReferenceError: Can't find variable: async.
PASS ({yield}) threw exception ReferenceError: Can't find variable: yield.
PASS ({await}) threw exception ReferenceError: Can't find variable: await.
PASS "use strict"; ({let}) } threw exception SyntaxError: Cannot use 'let' as a shorthand property name in strict mode..
PASS function* generator() { ({yield}) } threw exception SyntaxError: Cannot use 'yield' as a shorthand property name in a generator function..
PASS async function func() { ({await}) } threw exception SyntaxError: Cannot use 'await' as a shorthand property name in an async function..
PASS successfullyParsed is true
TEST COMPLETE