diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Object/S9.9_A5.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/S9.9_A5.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Object/S9.9_A5.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/S9.9_A5.js b/js/src/tests/test262/built-ins/Object/S9.9_A5.js new file mode 100644 index 0000000000..5f130f03ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/S9.9_A5.js @@ -0,0 +1,66 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToObject conversion from String: create a new String object + whose [[value]] property is set to the value of the string +es5id: 9.9_A5 +description: Converting from various strings to Object +---*/ +assert.sameValue( + Object("some string").valueOf(), + "some string", + 'Object("some string").valueOf() must return "some string"' +); + +assert.sameValue( + typeof Object("some string"), + "object", + 'The value of `typeof Object("some string")` is expected to be "object"' +); + +assert.sameValue( + Object("some string").constructor.prototype, + String.prototype, + 'The value of Object("some string").constructor.prototype is expected to equal the value of String.prototype' +); + +assert.sameValue(Object("").valueOf(), "", 'Object("").valueOf() must return ""'); +assert.sameValue(typeof Object(""), "object", 'The value of `typeof Object("")` is expected to be "object"'); + +assert.sameValue( + Object("").constructor.prototype, + String.prototype, + 'The value of Object("").constructor.prototype is expected to equal the value of String.prototype' +); + +assert.sameValue(Object("\r\t\b\n\v\f").valueOf(), "\r\t\b\n\v\f", 'Object("rtbnvf").valueOf() must return "rtbnvf"'); + +assert.sameValue( + typeof Object("\r\t\b\n\v\f"), + "object", + 'The value of `typeof Object("rtbnvf")` is expected to be "object"' +); + +assert.sameValue( + Object("\r\t\b\n\v\f").constructor.prototype, + String.prototype, + 'The value of Object("rtbnvf").constructor.prototype is expected to equal the value of String.prototype' +); + +assert.sameValue(Object(String(10)).valueOf(), "10", 'Object(String(10)).valueOf() must return "10"'); + +assert.sameValue( + typeof Object(String(10)), + "object", + 'The value of `typeof Object(String(10))` is expected to be "object"' +); + +assert.sameValue( + Object(String(10)).constructor.prototype, + String.prototype, + 'The value of Object(String(10)).constructor.prototype is expected to equal the value of String.prototype' +); + +reportCompare(0, 0); |