blob: cc09a5d4d5b002fceec518a7af650886e1296ac9 [file] [log] [blame]
This test checks that object literals are serialized properly. It's needed in part because JavaScriptCore converts numeric property names to string and back.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS compileAndSerialize('a = { 1: null }') is 'a = { 1: null }'
PASS compileAndSerialize('a = { 0: null }') is 'a = { 0: null }'
PASS compileAndSerialize('a = { 1.0: null }') is 'a = { 1.0: null }'
PASS compileAndSerialize('a = { "1.0": null }') is 'a = { "1.0": null }'
PASS compileAndSerialize('a = { 1e-500: null }') is 'a = { 1e-500: null }'
PASS compileAndSerialize('a = { 1e-300: null }') is 'a = { 1e-300: null }'
PASS compileAndSerialize('a = { 1e300: null }') is 'a = { 1e300: null }'
PASS compileAndSerialize('a = { 1e500: null }') is 'a = { 1e500: null }'
PASS compileAndSerialize('a = { NaN: null }') is 'a = { NaN: null }'
PASS compileAndSerialize('a = { Infinity: null }') is 'a = { Infinity: null }'
PASS compileAndSerialize('a = { "1": null }') is 'a = { "1": null }'
PASS compileAndSerialize('a = { "1hi": null }') is 'a = { "1hi": null }'
PASS compileAndSerialize('a = { "\'": null }') is 'a = { "\'": null }'
PASS compileAndSerialize('a = { "\\"": null }') is 'a = { "\\"": null }'
PASS compileAndSerialize('a = { get x() { } }') is 'a = { get x() { } }'
PASS compileAndSerialize('a = { set x(y) { } }') is 'a = { set x(y) { } }'
PASS compileAndSerialize('a = { --1: null }') threw exception SyntaxError: Unexpected token '--'.
PASS compileAndSerialize('a = { -NaN: null }') threw exception SyntaxError: Unexpected token '-'.
PASS compileAndSerialize('a = { -0: null }') threw exception SyntaxError: Unexpected token '-'.
PASS compileAndSerialize('a = { -0.0: null }') threw exception SyntaxError: Unexpected token '-'.
PASS compileAndSerialize('a = { -Infinity: null }') threw exception SyntaxError: Unexpected token '-'.
PASS successfullyParsed is true
TEST COMPLETE