blob: 0d0d890d6aaad28e652becc45ffa8b7b60008fef [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 '--'. Expected a property name..
PASS compileAndSerialize('a = { -NaN: null }') threw exception SyntaxError: Unexpected token '-'. Expected a property name..
PASS compileAndSerialize('a = { -0: null }') threw exception SyntaxError: Unexpected token '-'. Expected a property name..
PASS compileAndSerialize('a = { -0.0: null }') threw exception SyntaxError: Unexpected token '-'. Expected a property name..
PASS compileAndSerialize('a = { -Infinity: null }') threw exception SyntaxError: Unexpected token '-'. Expected a property name..
PASS successfullyParsed is true
TEST COMPLETE