1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 10:57:35 +00:00
serenity/Libraries/LibJS/Tests
Linus Groh fb89c324c5 LibJS: Implement spec-compliant OrdinaryToPrimitive
This renames Object::to_primitive() to Object::ordinary_to_primitive()
for two reasons:

- No confusion with Value::to_primitive()
- To match the spec's name

Also change existing uses of Object::to_primitive() to
Value::to_primitive() when the spec uses the latter (which will still
call Object::ordinary_to_primitive()). Object::to_string() has been
removed as it's not needed anymore (and nothing the spec uses).

This makes it possible to overwrite an object's toString and valueOf and
have them provide results for anything that uses to_primitive() - e.g.:

    const o = { toString: undefined, valueOf: () => 42 };
    Number(o) // 42, previously NaN
    ["foo", o].toString(); // "foo,42", previously "foo,[object Object]"
    ++o // 43, previously NaN

etc.
2020-11-04 19:33:49 +01:00
..
builtins LibJS: Implement RegExp.prototype.toString() as standalone function 2020-11-04 19:33:49 +01:00
classes LibJS: Rest parameter in setter functions is a syntax error 2020-10-20 20:27:58 +02:00
functions LibJS: Implement 'new.target' 2020-11-02 22:40:59 +01:00
iterators Everywhere: Fix typos 2020-10-02 16:03:17 +02:00
loops LibJS: Always insert semicolon after do-while statement if missing 2020-10-28 21:11:32 +01:00
operators LibJS: Fix crashing exception in Value::ordinary_has_instance() 2020-11-03 19:14:13 +01:00
add-values-to-primitive.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
automatic-semicolon-insertion.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
break-continue-syntax-errors.js LibJS: break or continue with nonexistent label is a syntax error 2020-10-08 23:27:16 +02:00
comments-basic.js LibJS: "-->" preceded by token on same line isn't start of HTML-like comment 2020-10-29 22:28:15 +01:00
computed-property-throws.js LibJS: Don't create "valid" PropertyName from null string 2020-11-04 15:31:39 +01:00
const-declaration-missing-initializer.js LibJS: Require initializer for 'const' variable declaration 2020-10-30 23:43:38 +01:00
const-reassignment.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
custom-@@hasInstance.js LibJS: Add Symbol.hasInstance tests 2020-07-14 20:15:19 +02:00
custom-@@toStringTag.js LibJS: Implement Symbol.toStringTag 2020-07-11 23:13:29 +02:00
debugger-statement.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
empty-statements.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
exception-in-catch-block.js LibJS: Check validity of computed_property_name() result before using it 2020-09-12 11:29:39 +02:00
exception-ReferenceError.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
exponentiation-basic.js Everywhere: Fix typos 2020-10-02 16:03:17 +02:00
if-statement-function-declaration.js LibJS: Function declarations in if statement clauses 2020-10-31 15:25:12 +01:00
indexed-access-string-object.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
invalid-lhs-in-assignment.js LibJS: Make assignment to CallExpression a syntax error in strict mode 2020-10-05 09:25:04 +02:00
labels.js LibJS: break or continue with nonexistent label is a syntax error 2020-10-08 23:27:16 +02:00
let-scoping.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
new-expression.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
numeric-literals-basic.js LibJS: Don't parse numeric literal containing 8 or 9 as octal 2020-10-28 21:11:32 +01:00
object-basic.js LibJS: Rest parameter in setter functions is a syntax error 2020-10-20 20:27:58 +02:00
object-expression-computed-property.js LibJS: Fix PropertyName::from_value() for negative and non-int numbers 2020-10-08 10:02:47 +02:00
object-getter-setter-shorthand.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
object-method-shorthand.js LibJS: Add tests for symbol object integration 2020-07-09 23:33:00 +02:00
object-spread.js LibJS: Integrate iterator protocol into language features 2020-07-14 17:58:42 +02:00
ordinary-to-primitive.js LibJS: Implement spec-compliant OrdinaryToPrimitive 2020-11-04 19:33:49 +01:00
parser-declaration-in-single-statement-context.js LibJS: Distinguish between statement and declaration 2020-10-23 19:13:06 +02:00
parser-line-terminators.js LibJS: Tweak generated source in 'new Function()' to match ES 2015 spec 2020-10-29 22:27:55 +01:00
parser-unary-associativity.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
program-strict-mode.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
return.js LibJS: Fix return statements not working properly in loops 2020-10-08 23:23:55 +02:00
strict-mode-blocks.js LibJS: Strict mode is now handled by Functions and Programs, not Blocks 2020-10-04 10:46:12 +02:00
strict-mode-errors.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
string-escapes.js LibJS: Use GenericLexer for Token::string_value() 2020-10-29 11:52:31 +01:00
string-spread.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
switch-basic.js LibJS: Multiple 'default' clauses in switch statement are a syntax error 2020-10-19 11:30:14 +02:00
switch-break.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
tagged-template-literals.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
template-literals.js LibJS: Parse line continuations in string literals properly 2020-10-25 15:16:47 +01:00
test-common-tests.js LibJS: Restrict toEval() failures to SyntaxError 2020-10-28 21:11:32 +01:00
test-common.js LibJS: Restrict toEval() failures to SyntaxError 2020-10-28 21:11:32 +01:00
throw-basic.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
to-number-basic.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
to-number-exception.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
try-catch-finally-nested.js LibJS: Stop unwinding and reset exception for TryStatement finalizer 2020-09-12 09:31:16 +02:00
try-catch-finally.js LibJS: Allow try statement with only finally clause 2020-10-24 16:34:01 +02:00
update-expression-on-member-expression.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
update-expressions-basic.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
use-strict-directive.js LibJS: Fix "use strict" directive false positives 2020-11-02 13:13:54 +01:00
var-multiple-declarator.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
var-scoping.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
variable-undefined.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00