summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r--Libraries/LibJS/Tests/add-values-to-primitive.js6
-rw-r--r--Libraries/LibJS/Tests/arguments-object.js15
-rw-r--r--Libraries/LibJS/Tests/automatic-semicolon-insertion.js65
-rw-r--r--Libraries/LibJS/Tests/break-continue-syntax-errors.js17
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.from.js69
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.isArray.js26
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.js53
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.of.js59
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js150
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.concat.js43
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.every.js55
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.fill.js20
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js68
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.find.js65
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.findIndex.js68
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.forEach.js70
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.includes.js18
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.indexOf.js25
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.join.js24
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.lastIndexOf.js22
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js57
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.pop.js29
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.push.js23
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js113
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js118
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.reverse.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.shift.js23
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js39
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.some.js37
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.sort.js204
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js49
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js62
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.toString.js66
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.unshift.js23
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.prototype.values.js44
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/array-basic.js57
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/array-length-setter.js37
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/array-shrink-during-find-crash.js19
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/array-simple-and-generic-storage-initialization.js15
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/array-spread.js25
-rw-r--r--Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.isView.js27
-rw-r--r--Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.js13
-rw-r--r--Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.prototype.byteLength.js6
-rw-r--r--Libraries/LibJS/Tests/builtins/BigInt/BigInt.js68
-rw-r--r--Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.@@toStringTag.js3
-rw-r--r--Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toString.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.valueOf.js12
-rw-r--r--Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js80
-rw-r--r--Libraries/LibJS/Tests/builtins/BigInt/bigint-minus.js8
-rw-r--r--Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js31
-rw-r--r--Libraries/LibJS/Tests/builtins/Boolean/Boolean.js32
-rw-r--r--Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.js5
-rw-r--r--Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.toString.js17
-rw-r--r--Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.valueOf.js16
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.UTC.js51
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.js77
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.now.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.parse.js32
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDate.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDay.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getFullYear.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getHours.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMilliseconds.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMinutes.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMonth.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getSeconds.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getTime.js6
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCDate.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCDay.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCFullYear.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCHours.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMilliseconds.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMinutes.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMonth.js26
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCSeconds.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.prototype.toISOString.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Error/Error.js18
-rw-r--r--Libraries/LibJS/Tests/builtins/Error/Error.prototype.name.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/Error/Error.prototype.toString.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Function/Function.js53
-rw-r--r--Libraries/LibJS/Tests/builtins/Function/Function.prototype.@@hasInstance.js8
-rw-r--r--Libraries/LibJS/Tests/builtins/Function/Function.prototype.apply.js51
-rw-r--r--Libraries/LibJS/Tests/builtins/Function/Function.prototype.bind.js149
-rw-r--r--Libraries/LibJS/Tests/builtins/Function/Function.prototype.call.js53
-rw-r--r--Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js17
-rw-r--r--Libraries/LibJS/Tests/builtins/Infinity/Infinity.js22
-rw-r--r--Libraries/LibJS/Tests/builtins/JSON/JSON.@@toStringTag.js4
-rw-r--r--Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js11
-rw-r--r--Libraries/LibJS/Tests/builtins/JSON/JSON.parse.js37
-rw-r--r--Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-exception-in-property-getter.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js30
-rw-r--r--Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-proxy.js11
-rw-r--r--Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js38
-rw-r--r--Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-space.js47
-rw-r--r--Libraries/LibJS/Tests/builtins/JSON/JSON.stringify.js71
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math-constants.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.@@toStringTag.js4
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.abs.js14
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.acosh.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.asin.js15
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.asinh.js6
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.atan.js12
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.atan2.js28
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.atanh.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.cbrt.js12
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.ceil.js13
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.clz32.js44
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.cos.js14
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.cosh.js7
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.exp.js13
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.expm1.js13
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.floor.js13
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.fround.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.hypot.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.log.js8
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.log10.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.log1p.js8
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.log2.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.max.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.min.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.pow.js25
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.sign.js36
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.sin.js15
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.sinh.js6
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.sqrt.js4
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.tan.js14
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.tanh.js8
-rw-r--r--Libraries/LibJS/Tests/builtins/Math/Math.trunc.js12
-rw-r--r--Libraries/LibJS/Tests/builtins/NaN/NaN.js13
-rw-r--r--Libraries/LibJS/Tests/builtins/Number/Number-constants.js11
-rw-r--r--Libraries/LibJS/Tests/builtins/Number/Number.isFinite.js24
-rw-r--r--Libraries/LibJS/Tests/builtins/Number/Number.isInteger.js32
-rw-r--r--Libraries/LibJS/Tests/builtins/Number/Number.isNaN.js25
-rw-r--r--Libraries/LibJS/Tests/builtins/Number/Number.isSafeInteger.js24
-rw-r--r--Libraries/LibJS/Tests/builtins/Number/Number.js33
-rw-r--r--Libraries/LibJS/Tests/builtins/Number/Number.parseFloat.js5
-rw-r--r--Libraries/LibJS/Tests/builtins/Number/Number.prototype.js4
-rw-r--r--Libraries/LibJS/Tests/builtins/Number/Number.prototype.toString.js83
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.defineProperty.js242
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.entries.js64
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertyDescriptor.js61
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertyNames.js14
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.getPrototypeOf.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.is.js54
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.isExtensible.js18
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.js13
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.keys.js51
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.preventExtensions.js67
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.prototype.constructor.js18
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.prototype.hasOwnProperty.js13
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.prototype.isPrototypeOf.js18
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.prototype.js5
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.prototype.propertyIsEnumerable.js15
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.prototype.toLocaleString.js35
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.prototype.toString.js20
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.setPrototypeOf.js43
-rw-r--r--Libraries/LibJS/Tests/builtins/Object/Object.values.js51
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-apply.js36
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-construct.js72
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-defineProperty.js133
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-deleteProperty.js58
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-get.js96
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getOwnPropertyDescriptor.js220
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getPrototypeOf.js95
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-has.js74
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-isExtensible.js39
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-preventExtensions.js59
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js99
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-setPrototypeOf.js96
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.js37
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.apply.js44
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.construct.js75
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.defineProperty.js82
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.deleteProperty.js66
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.get.js67
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.getOwnPropertyDescriptor.js41
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.getPrototypeOf.js37
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.has.js45
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.isExtensible.js33
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.ownKeys.js51
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.preventExtensions.js42
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.set.js102
-rw-r--r--Libraries/LibJS/Tests/builtins/Reflect/Reflect.setPrototypeOf.js57
-rw-r--r--Libraries/LibJS/Tests/builtins/RegExp/RegExp.js8
-rw-r--r--Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.exec.js58
-rw-r--r--Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.flags.js11
-rw-r--r--Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.source.js8
-rw-r--r--Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.test.js58
-rw-r--r--Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.toString.js6
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.fromCharCode.js17
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype-generic-functions.js39
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.charAt.js20
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.charCodeAt.js21
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.concat.js17
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.endsWith.js42
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.includes.js12
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.indexOf.js8
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.lastIndexOf.js22
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.padEnd.js18
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.padStart.js18
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.repeat.js25
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.slice.js17
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.split.js35
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.startsWith.js36
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.substr.js16
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.substring.js14
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.toLowerCase.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.toString.js6
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.toUpperCase.js9
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.trim.js58
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.valueOf.js12
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.raw.js31
-rw-r--r--Libraries/LibJS/Tests/builtins/Symbol/Symbol.for.js23
-rw-r--r--Libraries/LibJS/Tests/builtins/Symbol/Symbol.js19
-rw-r--r--Libraries/LibJS/Tests/builtins/Symbol/Symbol.keyFor.js24
-rw-r--r--Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.@@toStringTag.js3
-rw-r--r--Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.toString.js25
-rw-r--r--Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.valueOf.js15
-rw-r--r--Libraries/LibJS/Tests/builtins/Symbol/well-known-symbol-existence.js15
-rw-r--r--Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.BYTES_PER_ELEMENT.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js133
-rw-r--r--Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.length.js19
-rw-r--r--Libraries/LibJS/Tests/builtins/TypedArray/typed-array-basic.js86
-rw-r--r--Libraries/LibJS/Tests/builtins/functions/isFinite.js23
-rw-r--r--Libraries/LibJS/Tests/builtins/functions/isNaN.js26
-rw-r--r--Libraries/LibJS/Tests/builtins/functions/parseFloat.js59
-rw-r--r--Libraries/LibJS/Tests/classes/class-advanced-extends.js35
-rw-r--r--Libraries/LibJS/Tests/classes/class-basic.js5
-rw-r--r--Libraries/LibJS/Tests/classes/class-constructor.js67
-rw-r--r--Libraries/LibJS/Tests/classes/class-errors.js100
-rw-r--r--Libraries/LibJS/Tests/classes/class-expressions.js68
-rw-r--r--Libraries/LibJS/Tests/classes/class-getters.js75
-rw-r--r--Libraries/LibJS/Tests/classes/class-inheritance.js133
-rw-r--r--Libraries/LibJS/Tests/classes/class-methods.js51
-rw-r--r--Libraries/LibJS/Tests/classes/class-setters.js108
-rw-r--r--Libraries/LibJS/Tests/classes/class-static-getters.js87
-rw-r--r--Libraries/LibJS/Tests/classes/class-static-setters.js112
-rw-r--r--Libraries/LibJS/Tests/classes/class-static.js72
-rw-r--r--Libraries/LibJS/Tests/classes/class-strict-mode.js19
-rw-r--r--Libraries/LibJS/Tests/comments-basic.js35
-rw-r--r--Libraries/LibJS/Tests/computed-property-throws.js19
-rw-r--r--Libraries/LibJS/Tests/const-declaration-missing-initializer.js5
-rw-r--r--Libraries/LibJS/Tests/const-reassignment.js17
-rw-r--r--Libraries/LibJS/Tests/custom-@@hasInstance.js9
-rw-r--r--Libraries/LibJS/Tests/custom-@@toStringTag.js26
-rw-r--r--Libraries/LibJS/Tests/debugger-statement.js3
-rw-r--r--Libraries/LibJS/Tests/empty-statements.js19
-rw-r--r--Libraries/LibJS/Tests/exception-ReferenceError.js3
-rw-r--r--Libraries/LibJS/Tests/exception-in-catch-block.js25
-rw-r--r--Libraries/LibJS/Tests/exponentiation-basic.js37
-rw-r--r--Libraries/LibJS/Tests/functions/arrow-functions.js164
-rw-r--r--Libraries/LibJS/Tests/functions/constructor-basic.js11
-rw-r--r--Libraries/LibJS/Tests/functions/function-TypeError.js47
-rw-r--r--Libraries/LibJS/Tests/functions/function-default-parameters.js143
-rw-r--r--Libraries/LibJS/Tests/functions/function-duplicate-parameters.js45
-rw-r--r--Libraries/LibJS/Tests/functions/function-hoisting.js39
-rw-r--r--Libraries/LibJS/Tests/functions/function-length.js23
-rw-r--r--Libraries/LibJS/Tests/functions/function-missing-arg.js10
-rw-r--r--Libraries/LibJS/Tests/functions/function-name.js57
-rw-r--r--Libraries/LibJS/Tests/functions/function-new-target.js25
-rw-r--r--Libraries/LibJS/Tests/functions/function-prototype-writable.js10
-rw-r--r--Libraries/LibJS/Tests/functions/function-rest-params.js47
-rw-r--r--Libraries/LibJS/Tests/functions/function-spread.js38
-rw-r--r--Libraries/LibJS/Tests/functions/function-strict-mode.js60
-rw-r--r--Libraries/LibJS/Tests/functions/function-this-in-arguments.js16
-rw-r--r--Libraries/LibJS/Tests/if-statement-function-declaration.js41
-rw-r--r--Libraries/LibJS/Tests/indexed-access-string-object.js15
-rw-r--r--Libraries/LibJS/Tests/invalid-lhs-in-assignment.js32
-rw-r--r--Libraries/LibJS/Tests/iterators/%IteratorPrototype%.js12
-rw-r--r--Libraries/LibJS/Tests/iterators/array-iterator.js53
-rw-r--r--Libraries/LibJS/Tests/iterators/string-iterator.js48
-rw-r--r--Libraries/LibJS/Tests/labels.js47
-rw-r--r--Libraries/LibJS/Tests/let-scoping.js14
-rw-r--r--Libraries/LibJS/Tests/loops/break-basic.js30
-rw-r--r--Libraries/LibJS/Tests/loops/continue-basic.js10
-rw-r--r--Libraries/LibJS/Tests/loops/do-while-basic.js24
-rw-r--r--Libraries/LibJS/Tests/loops/for-basic.js15
-rw-r--r--Libraries/LibJS/Tests/loops/for-head-errors.js23
-rw-r--r--Libraries/LibJS/Tests/loops/for-in-basic.js45
-rw-r--r--Libraries/LibJS/Tests/loops/for-no-curlies.js5
-rw-r--r--Libraries/LibJS/Tests/loops/for-of-basic.js100
-rw-r--r--Libraries/LibJS/Tests/loops/for-scopes.js18
-rw-r--r--Libraries/LibJS/Tests/loops/while-basic.js25
-rw-r--r--Libraries/LibJS/Tests/new-expression.js53
-rw-r--r--Libraries/LibJS/Tests/numeric-literals-basic.js52
-rw-r--r--Libraries/LibJS/Tests/object-basic.js169
-rw-r--r--Libraries/LibJS/Tests/object-expression-computed-property.js12
-rw-r--r--Libraries/LibJS/Tests/object-getter-setter-shorthand.js62
-rw-r--r--Libraries/LibJS/Tests/object-method-shorthand.js50
-rw-r--r--Libraries/LibJS/Tests/object-spread.js117
-rw-r--r--Libraries/LibJS/Tests/operators/assignment-operators.js135
-rw-r--r--Libraries/LibJS/Tests/operators/binary-bitwise-and.js60
-rw-r--r--Libraries/LibJS/Tests/operators/binary-bitwise-left-shift.js60
-rw-r--r--Libraries/LibJS/Tests/operators/binary-bitwise-or.js60
-rw-r--r--Libraries/LibJS/Tests/operators/binary-bitwise-right-shift.js62
-rw-r--r--Libraries/LibJS/Tests/operators/binary-bitwise-unsigned-right-shift.js62
-rw-r--r--Libraries/LibJS/Tests/operators/binary-bitwise-xor.js60
-rw-r--r--Libraries/LibJS/Tests/operators/binary-relational.js729
-rw-r--r--Libraries/LibJS/Tests/operators/bitwise-not.js23
-rw-r--r--Libraries/LibJS/Tests/operators/comma-operator.js24
-rw-r--r--Libraries/LibJS/Tests/operators/delete-basic.js61
-rw-r--r--Libraries/LibJS/Tests/operators/delete-global-variable.js9
-rw-r--r--Libraries/LibJS/Tests/operators/delete-globalThis-property-crash.js8
-rw-r--r--Libraries/LibJS/Tests/operators/in-operator-basic.js32
-rw-r--r--Libraries/LibJS/Tests/operators/instanceof-basic.js36
-rw-r--r--Libraries/LibJS/Tests/operators/logical-and.js50
-rw-r--r--Libraries/LibJS/Tests/operators/logical-expressions-short-circuit.js13
-rw-r--r--Libraries/LibJS/Tests/operators/logical-nullish-coalescing.js50
-rw-r--r--Libraries/LibJS/Tests/operators/logical-or.js50
-rw-r--r--Libraries/LibJS/Tests/operators/modulo-basic.js16
-rw-r--r--Libraries/LibJS/Tests/operators/ternary-basic.js20
-rw-r--r--Libraries/LibJS/Tests/operators/typeof-basic.js27
-rw-r--r--Libraries/LibJS/Tests/operators/void-basic.js14
-rw-r--r--Libraries/LibJS/Tests/ordinary-to-primitive.js23
-rw-r--r--Libraries/LibJS/Tests/parseInt.js59
-rw-r--r--Libraries/LibJS/Tests/parser-declaration-in-single-statement-context.js6
-rw-r--r--Libraries/LibJS/Tests/parser-line-terminators.js66
-rw-r--r--Libraries/LibJS/Tests/parser-unary-associativity.js14
-rw-r--r--Libraries/LibJS/Tests/program-strict-mode.js18
-rw-r--r--Libraries/LibJS/Tests/return.js53
-rw-r--r--Libraries/LibJS/Tests/runtime-error-call-stack-size.js21
-rw-r--r--Libraries/LibJS/Tests/strict-mode-blocks.js25
-rw-r--r--Libraries/LibJS/Tests/strict-mode-errors.js15
-rw-r--r--Libraries/LibJS/Tests/string-escapes.js63
-rw-r--r--Libraries/LibJS/Tests/string-spread.js25
-rw-r--r--Libraries/LibJS/Tests/switch-basic.js78
-rw-r--r--Libraries/LibJS/Tests/switch-break.js20
-rw-r--r--Libraries/LibJS/Tests/tagged-template-literals.js108
-rw-r--r--Libraries/LibJS/Tests/template-literals.js65
-rw-r--r--Libraries/LibJS/Tests/test-common-tests.js417
-rw-r--r--Libraries/LibJS/Tests/test-common.js462
-rw-r--r--Libraries/LibJS/Tests/throw-basic.js34
-rw-r--r--Libraries/LibJS/Tests/to-number-basic.js75
-rw-r--r--Libraries/LibJS/Tests/to-number-exception.js25
-rw-r--r--Libraries/LibJS/Tests/try-catch-finally-nested.js55
-rw-r--r--Libraries/LibJS/Tests/try-catch-finally.js172
-rw-r--r--Libraries/LibJS/Tests/update-expression-on-member-expression.js8
-rw-r--r--Libraries/LibJS/Tests/update-expressions-basic.js53
-rw-r--r--Libraries/LibJS/Tests/use-strict-directive.js61
-rw-r--r--Libraries/LibJS/Tests/var-multiple-declarator.js8
-rw-r--r--Libraries/LibJS/Tests/var-scoping.js17
-rw-r--r--Libraries/LibJS/Tests/variable-undefined.js14
-rw-r--r--Libraries/LibJS/Tests/with-basic.js24
346 files changed, 0 insertions, 14468 deletions
diff --git a/Libraries/LibJS/Tests/add-values-to-primitive.js b/Libraries/LibJS/Tests/add-values-to-primitive.js
deleted file mode 100644
index 3bef2209ba..0000000000
--- a/Libraries/LibJS/Tests/add-values-to-primitive.js
+++ /dev/null
@@ -1,6 +0,0 @@
-test("adding objects", () => {
- expect([] + []).toBe("");
- expect([] + {}).toBe("[object Object]");
- expect({} + {}).toBe("[object Object][object Object]");
- expect({} + []).toBe("[object Object]");
-});
diff --git a/Libraries/LibJS/Tests/arguments-object.js b/Libraries/LibJS/Tests/arguments-object.js
deleted file mode 100644
index 17d9a141b8..0000000000
--- a/Libraries/LibJS/Tests/arguments-object.js
+++ /dev/null
@@ -1,15 +0,0 @@
-test("basic arguments object", () => {
- function foo() {
- return arguments.length;
- }
- expect(foo()).toBe(0);
- expect(foo(1)).toBe(1);
- expect(foo(1, 2)).toBe(2);
- expect(foo(1, 2, 3)).toBe(3);
-
- function bar() {
- return arguments[1];
- }
- expect(bar("hello", "friends", ":^)")).toBe("friends");
- expect(bar("hello")).toBe(undefined);
-});
diff --git a/Libraries/LibJS/Tests/automatic-semicolon-insertion.js b/Libraries/LibJS/Tests/automatic-semicolon-insertion.js
deleted file mode 100644
index 998b0b6622..0000000000
--- a/Libraries/LibJS/Tests/automatic-semicolon-insertion.js
+++ /dev/null
@@ -1,65 +0,0 @@
-test("Issue #1829, if-else without braces or semicolons", () => {
- const source = `if (1)
- foo;
-else
- bar;
-
-if (1)
- foo
-else
- bar
-
-if (1)
- foo
-else
- bar;`;
-
- expect(source).toEval();
-});
-
-test("break/continue, variable declaration, do-while, and return asi", () => {
- const source = `function foo() {
- label:
- for (var i = 0; i < 4; i++) {
- break // semicolon inserted here
- continue // semicolon inserted here
-
- break label // semicolon inserted here
- continue label // semicolon inserted here
- }
-
- var j // semicolon inserted here
-
- do {
- } while (1 === 2) // semicolon inserted here
-
- return // semicolon inserted here
- 1;
-var curly/* semicolon inserted here */}
-
-return foo();`;
-
- expect(source).toEvalTo(undefined);
-});
-
-test("more break and continue asi", () => {
- const source = `let counter = 0;
-let outer;
-
-outer:
-for (let i = 0; i < 5; ++i) {
- for (let j = 0; j < 5; ++j) {
- continue // semicolon inserted here
- outer // semicolon inserted here
- }
- counter++;
-}
-
-return counter;`;
-
- expect(source).toEvalTo(5);
-});
-
-test("eof with no semicolon", () => {
- expect("var eof").toEval();
-});
diff --git a/Libraries/LibJS/Tests/break-continue-syntax-errors.js b/Libraries/LibJS/Tests/break-continue-syntax-errors.js
deleted file mode 100644
index 106118823f..0000000000
--- a/Libraries/LibJS/Tests/break-continue-syntax-errors.js
+++ /dev/null
@@ -1,17 +0,0 @@
-test("'break' syntax errors", () => {
- expect("break").not.toEval();
- expect("break label").not.toEval();
- expect("{ break }").not.toEval();
- expect("{ break label }").not.toEval();
- expect("label: { break label }").toEval();
-});
-
-test("'continue' syntax errors", () => {
- expect("continue").not.toEval();
- expect("continue label").not.toEval();
- expect("{ continue }").not.toEval();
- expect("{ continue label }").not.toEval();
- expect("label: { continue label }").not.toEval();
-
- expect("switch (true) { case true: continue; }").not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.from.js b/Libraries/LibJS/Tests/builtins/Array/Array.from.js
deleted file mode 100644
index 0a015f8141..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.from.js
+++ /dev/null
@@ -1,69 +0,0 @@
-test("length is 1", () => {
- expect(Array.from).toHaveLength(1);
-});
-
-describe("normal behavior", () => {
- test("empty array", () => {
- var a = Array.from([]);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(0);
- });
-
- test("empty string", () => {
- var a = Array.from("");
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(0);
- });
-
- test("non-empty array", () => {
- var a = Array.from([5, 8, 1]);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(3);
- expect(a[0]).toBe(5);
- expect(a[1]).toBe(8);
- expect(a[2]).toBe(1);
- });
-
- test("non-empty string", () => {
- var a = Array.from("what");
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(4);
- expect(a[0]).toBe("w");
- expect(a[1]).toBe("h");
- expect(a[2]).toBe("a");
- expect(a[3]).toBe("t");
- });
-
- test("shallow array copy", () => {
- var a = [1, 2, 3];
- var b = Array.from([a]);
- expect(b instanceof Array).toBeTrue();
- expect(b).toHaveLength(1);
- b[0][0] = 4;
- expect(a[0]).toBe(4);
- });
-
- test("from iterator", () => {
- function rangeIterator(begin, end) {
- return {
- [Symbol.iterator]() {
- let value = begin - 1;
- return {
- next() {
- if (value < end) {
- value += 1;
- }
- return { value: value, done: value >= end };
- },
- };
- },
- };
- }
-
- var a = Array.from(rangeIterator(8, 10));
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(2);
- expect(a[0]).toBe(8);
- expect(a[1]).toBe(9);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.isArray.js b/Libraries/LibJS/Tests/builtins/Array/Array.isArray.js
deleted file mode 100644
index bbe12a8c44..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.isArray.js
+++ /dev/null
@@ -1,26 +0,0 @@
-test("length is 1", () => {
- expect(Array.isArray).toHaveLength(1);
-});
-
-test("arguments that evaluate to false", () => {
- expect(Array.isArray()).toBeFalse();
- expect(Array.isArray("1")).toBeFalse();
- expect(Array.isArray("foo")).toBeFalse();
- expect(Array.isArray(1)).toBeFalse();
- expect(Array.isArray(1, 2, 3)).toBeFalse();
- expect(Array.isArray(undefined)).toBeFalse();
- expect(Array.isArray(null)).toBeFalse();
- expect(Array.isArray(Infinity)).toBeFalse();
- expect(Array.isArray({})).toBeFalse();
-});
-
-test("arguments that evaluate to true", () => {
- expect(Array.isArray([])).toBeTrue();
- expect(Array.isArray([1])).toBeTrue();
- expect(Array.isArray([1, 2, 3])).toBeTrue();
- expect(Array.isArray(new Array())).toBeTrue();
- expect(Array.isArray(new Array(10))).toBeTrue();
- expect(Array.isArray(new Array("a", "b", "c"))).toBeTrue();
- // FIXME: Array.prototype is supposed to be an array!
- // expect(Array.isArray(Array.prototype)).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.js b/Libraries/LibJS/Tests/builtins/Array/Array.js
deleted file mode 100644
index 652e366d2f..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.js
+++ /dev/null
@@ -1,53 +0,0 @@
-test("constructor properties", () => {
- expect(Array).toHaveLength(1);
- expect(Array.name).toBe("Array");
- expect(Array.prototype.length).toBe(0);
-});
-
-describe("errors", () => {
- test("invalid array length", () => {
- [-1, -100, -0.1, 0.1, 1.23, Infinity, -Infinity, NaN].forEach(value => {
- expect(() => {
- new Array(value);
- }).toThrowWithMessage(RangeError, "Invalid array length");
- });
- });
-});
-
-describe("normal behavior", () => {
- test("typeof", () => {
- expect(typeof Array()).toBe("object");
- expect(typeof new Array()).toBe("object");
- });
-
- test("constructor with single numeric argument", () => {
- var a = new Array(5);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(5);
- });
-
- test("constructor with single non-numeric argument", () => {
- var a = new Array("5");
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(1);
- expect(a[0]).toBe("5");
- });
-
- test("constructor with multiple numeric arguments", () => {
- var a = new Array(1, 2, 3);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(3);
- expect(a[0]).toBe(1);
- expect(a[1]).toBe(2);
- expect(a[2]).toBe(3);
- });
-
- test("constructor with single array argument", () => {
- var a = new Array([1, 2, 3]);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(1);
- expect(a[0][0]).toBe(1);
- expect(a[0][1]).toBe(2);
- expect(a[0][2]).toBe(3);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.of.js b/Libraries/LibJS/Tests/builtins/Array/Array.of.js
deleted file mode 100644
index 8e03470263..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.of.js
+++ /dev/null
@@ -1,59 +0,0 @@
-test("length is 0", () => {
- expect(Array.of).toHaveLength(0);
-});
-
-describe("normal behavior", () => {
- test("single numeric argument", () => {
- var a = Array.of(5);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(1);
- expect(a[0]).toBe(5);
- });
-
- test("single non-numeric argument", () => {
- var a = Array.of("5");
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(1);
- expect(a[0]).toBe("5");
- });
-
- test("single infinite numeric argument", () => {
- var a = Array.of(Infinity);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(1);
- expect(a[0]).toBe(Infinity);
- });
-
- test("multiple numeric arguments", () => {
- var a = Array.of(1, 2, 3);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(3);
- expect(a[0]).toBe(1);
- expect(a[1]).toBe(2);
- expect(a[2]).toBe(3);
- });
-
- test("single array argument", () => {
- var a = Array.of([1, 2, 3]);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(1);
- expect(a[0][0]).toBe(1);
- expect(a[0][1]).toBe(2);
- expect(a[0][2]).toBe(3);
- });
-
- test("getter property is included in returned array", () => {
- var t = [1, 2, 3];
- Object.defineProperty(t, 3, {
- get() {
- return 4;
- },
- });
- var a = Array.of(...t);
- expect(a).toHaveLength(4);
- expect(a[0]).toBe(1);
- expect(a[1]).toBe(2);
- expect(a[2]).toBe(3);
- expect(a[3]).toBe(4);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js
deleted file mode 100644
index a8afde0ea3..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js
+++ /dev/null
@@ -1,150 +0,0 @@
-describe("ability to work with generic non-array objects", () => {
- test("push, pop", () => {
- [undefined, "foo", -42, 0].forEach(length => {
- const o = { length };
-
- expect(Array.prototype.push.call(o, "foo")).toBe(1);
- expect(o).toHaveLength(1);
- expect(o[0]).toBe("foo");
- expect(Array.prototype.push.call(o, "bar", "baz")).toBe(3);
- expect(o).toHaveLength(3);
- expect(o[0]).toBe("foo");
- expect(o[1]).toBe("bar");
- expect(o[2]).toBe("baz");
-
- expect(Array.prototype.pop.call(o)).toBe("baz");
- expect(o).toHaveLength(2);
- expect(Array.prototype.pop.call(o)).toBe("bar");
- expect(o).toHaveLength(1);
- expect(Array.prototype.pop.call(o)).toBe("foo");
- expect(o).toHaveLength(0);
- expect(Array.prototype.pop.call(o)).toBeUndefined();
- expect(o).toHaveLength(0);
-
- o.length = length;
- expect(Array.prototype.pop.call(o)).toBeUndefined();
- expect(o).toHaveLength(0);
- });
- });
-
- test("splice", () => {
- const o = { length: 3, 0: "hello", 2: "serenity" };
- const removed = Array.prototype.splice.call(o, 0, 2, "hello", "friends");
- expect(o).toHaveLength(3);
- expect(o[0]).toBe("hello");
- expect(o[1]).toBe("friends");
- expect(o[2]).toBe("serenity");
- expect(removed).toHaveLength(2);
- expect(removed[0]).toBe("hello");
- expect(removed[1]).toBeUndefined();
- });
-
- test("join", () => {
- expect(Array.prototype.join.call({})).toBe("");
- expect(Array.prototype.join.call({ length: "foo" })).toBe("");
- expect(Array.prototype.join.call({ length: 3 })).toBe(",,");
- expect(Array.prototype.join.call({ length: 2, 0: "foo", 1: "bar" })).toBe("foo,bar");
- expect(Array.prototype.join.call({ length: 2, 0: "foo", 1: "bar", 2: "baz" })).toBe(
- "foo,bar"
- );
- expect(Array.prototype.join.call({ length: 3, 1: "bar" }, "~")).toBe("~bar~");
- expect(Array.prototype.join.call({ length: 3, 0: "foo", 1: "bar", 2: "baz" }, "~")).toBe(
- "foo~bar~baz"
- );
- });
-
- // FIXME: test-js asserts when this is just called "toString" ಠ_ಠ
- test("toString (FIXME)", () => {
- expect(Array.prototype.toString.call({})).toBe("[object Object]");
- expect(Array.prototype.toString.call({ join: "foo" })).toBe("[object Object]");
- expect(Array.prototype.toString.call({ join: () => "foo" })).toBe("foo");
- });
-
- test("indexOf", () => {
- expect(Array.prototype.indexOf.call({})).toBe(-1);
- expect(Array.prototype.indexOf.call({ 0: undefined })).toBe(-1);
- expect(Array.prototype.indexOf.call({ length: 1, 0: undefined })).toBe(0);
- expect(Array.prototype.indexOf.call({ length: 1, 2: "foo" }, "foo")).toBe(-1);
- expect(Array.prototype.indexOf.call({ length: 5, 2: "foo" }, "foo")).toBe(2);
- expect(Array.prototype.indexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", 3)).toBe(4);
- });
-
- test("lastIndexOf", () => {
- expect(Array.prototype.lastIndexOf.call({})).toBe(-1);
- expect(Array.prototype.lastIndexOf.call({ 0: undefined })).toBe(-1);
- expect(Array.prototype.lastIndexOf.call({ length: 1, 0: undefined })).toBe(0);
- expect(Array.prototype.lastIndexOf.call({ length: 1, 2: "foo" }, "foo")).toBe(-1);
- expect(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo" }, "foo")).toBe(2);
- expect(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo")).toBe(4);
- expect(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", -2)).toBe(
- 2
- );
- });
-
- test("includes", () => {
- expect(Array.prototype.includes.call({})).toBeFalse();
- expect(Array.prototype.includes.call({ 0: undefined })).toBeFalse();
- expect(Array.prototype.includes.call({ length: 1, 0: undefined })).toBeTrue();
- expect(Array.prototype.includes.call({ length: 1, 2: "foo" }, "foo")).toBeFalse();
- expect(Array.prototype.includes.call({ length: 5, 2: "foo" }, "foo")).toBeTrue();
- });
-
- const o = { length: 5, 0: "foo", 1: "bar", 3: "baz" };
-
- test("every", () => {
- const visited = [];
- Array.prototype.every.call(o, value => {
- visited.push(value);
- return true;
- });
- expect(visited).toEqual(["foo", "bar", "baz"]);
- });
-
- test("find, findIndex", () => {
- ["find", "findIndex"].forEach(name => {
- const visited = [];
- Array.prototype[name].call(o, value => {
- visited.push(value);
- return false;
- });
- expect(visited).toEqual(["foo", "bar", undefined, "baz", undefined]);
- });
- });
-
- test("filter, forEach, map, some", () => {
- ["filter", "forEach", "map", "some"].forEach(name => {
- const visited = [];
- Array.prototype[name].call(o, value => {
- visited.push(value);
- return false;
- });
- expect(visited).toEqual(["foo", "bar", "baz"]);
- });
- });
-
- test("reduce", () => {
- const visited = [];
- Array.prototype.reduce.call(
- o,
- (_, value) => {
- visited.push(value);
- return false;
- },
- "initial"
- );
- expect(visited).toEqual(["foo", "bar", "baz"]);
- });
-
- test("reduceRight", () => {
- const visited = [];
- Array.prototype.reduceRight.call(
- o,
- (_, value) => {
- visited.push(value);
- return false;
- },
- "initial"
- );
- expect(visited).toEqual(["baz", "bar", "foo"]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.concat.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.concat.js
deleted file mode 100644
index c19b0ec13f..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.concat.js
+++ /dev/null
@@ -1,43 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.concat).toHaveLength(1);
-});
-
-describe("normal behavior", () => {
- var array = ["hello"];
-
- test("no arguments", () => {
- var concatenated = array.concat();
- expect(array).toHaveLength(1);
- expect(concatenated).toHaveLength(1);
- });
-
- test("single argument", () => {
- var concatenated = array.concat("friends");
- expect(array).toHaveLength(1);
- expect(concatenated).toHaveLength(2);
- expect(concatenated[0]).toBe("hello");
- expect(concatenated[1]).toBe("friends");
- });
-
- test("single array argument", () => {
- var concatenated = array.concat([1, 2, 3]);
- expect(array).toHaveLength(1);
- expect(concatenated).toHaveLength(4);
- expect(concatenated[0]).toBe("hello");
- expect(concatenated[1]).toBe(1);
- expect(concatenated[2]).toBe(2);
- expect(concatenated[3]).toBe(3);
- });
-
- test("multiple arguments", () => {
- var concatenated = array.concat(false, "serenity", { name: "libjs" }, [1, [2, 3]]);
- expect(array).toHaveLength(1);
- expect(concatenated).toHaveLength(6);
- expect(concatenated[0]).toBe("hello");
- expect(concatenated[1]).toBeFalse();
- expect(concatenated[2]).toBe("serenity");
- expect(concatenated[3]).toEqual({ name: "libjs" });
- expect(concatenated[4]).toBe(1);
- expect(concatenated[5]).toEqual([2, 3]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.every.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.every.js
deleted file mode 100644
index 0215f5b244..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.every.js
+++ /dev/null
@@ -1,55 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.every).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("requires at least one argument", () => {
- expect(() => {
- [].every();
- }).toThrowWithMessage(TypeError, "Array.prototype.every() requires at least one argument");
- });
-
- test("callback must be a function", () => {
- expect(() => {
- [].every(undefined);
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-});
-
-describe("normal behavior", () => {
- test("basic functionality", () => {
- var arrayOne = ["serenity", { test: "serenity" }];
- var arrayTwo = [true, false, 1, 2, 3, "3"];
-
- expect(arrayOne.every(value => value === "hello")).toBeFalse();
- expect(arrayOne.every(value => value === "serenity")).toBeFalse();
- expect(arrayOne.every((value, index, arr) => index < 2)).toBeTrue();
- expect(arrayOne.every(value => typeof value === "string")).toBeFalse();
- expect(arrayOne.every(value => arrayOne.pop())).toBeTrue();
-
- expect(arrayTwo.every((value, index, arr) => index > 0)).toBeFalse();
- expect(arrayTwo.every((value, index, arr) => index >= 0)).toBeTrue();
- expect(arrayTwo.every(value => typeof value !== "string")).toBeFalse();
- expect(arrayTwo.every(value => typeof value === "number")).toBeFalse();
- expect(arrayTwo.every(value => value > 0)).toBeFalse();
- expect(arrayTwo.every(value => value >= 0 && value < 4)).toBeTrue();
- expect(arrayTwo.every(value => arrayTwo.pop())).toBeTrue();
-
- expect(["", "hello", "friends", "serenity"].every(value => value.length >= 0)).toBeTrue();
- });
-
- test("empty array", () => {
- expect([].every(value => value === 1)).toBeTrue();
- });
-
- test("elements past the initial array size are ignored", () => {
- var array = [1, 2, 3, 4, 5];
-
- expect(
- arrayTwo.every((value, index, arr) => {
- arr.push(6);
- return value <= 5;
- })
- ).toBeTrue();
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.fill.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.fill.js
deleted file mode 100644
index 2773ec42cb..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.fill.js
+++ /dev/null
@@ -1,20 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.fill).toHaveLength(1);
-});
-
-test("basic functionality", () => {
- var array = [1, 2, 3, 4];
-
- expect(array.fill(0, 2, 4)).toEqual([1, 2, 0, 0]);
- expect(array.fill(5, 1)).toEqual([1, 5, 5, 5]);
- expect(array.fill(6)).toEqual([6, 6, 6, 6]);
-
- expect([1, 2, 3].fill(4)).toEqual([4, 4, 4]);
- expect([1, 2, 3].fill(4, 1)).toEqual([1, 4, 4]);
- expect([1, 2, 3].fill(4, 1, 2)).toEqual([1, 4, 3]);
- expect([1, 2, 3].fill(4, 3, 3)).toEqual([1, 2, 3]);
- expect([1, 2, 3].fill(4, -3, -2)).toEqual([4, 2, 3]);
- expect([1, 2, 3].fill(4, NaN, NaN)).toEqual([1, 2, 3]);
- expect([1, 2, 3].fill(4, 3, 5)).toEqual([1, 2, 3]);
- expect(Array(3).fill(4)).toEqual([4, 4, 4]);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js
deleted file mode 100644
index 6f481cddb8..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js
+++ /dev/null
@@ -1,68 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.filter).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("requires at least one argument", () => {
- expect(() => {
- [].filter();
- }).toThrowWithMessage(TypeError, "Array.prototype.filter() requires at least one argument");
- });
-
- test("callback must be a function", () => {
- expect(() => {
- [].filter(undefined);
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-});
-
-describe("normal behavior", () => {
- test("never calls callback with empty array", () => {
- var callbackCalled = 0;
- expect(
- [].filter(() => {
- callbackCalled++;
- })
- ).toEqual([]);
- expect(callbackCalled).toBe(0);
- });
-
- test("calls callback once for every item", () => {
- var callbackCalled = 0;
- expect(
- [1, 2, 3].filter(() => {
- callbackCalled++;
- })
- ).toEqual([]);
- expect(callbackCalled).toBe(3);
- });
-
- test("can filter based on callback return value", () => {
- var evenNumbers = [0, 1, 2, 3, 4, 5, 6, 7].filter(x => x % 2 === 0);
- expect(evenNumbers).toEqual([0, 2, 4, 6]);
-
- var fruits = [
- "Apple",
- "Banana",
- "Blueberry",
- "Grape",
- "Mango",
- "Orange",
- "Peach",
- "Pineapple",
- "Raspberry",
- "Watermelon",
- ];
- const filterItems = (arr, query) => {
- return arr.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) !== -1);
- };
- expect(filterItems(fruits, "Berry")).toEqual(["Blueberry", "Raspberry"]);
- expect(filterItems(fruits, "P")).toEqual([
- "Apple",
- "Grape",
- "Peach",
- "Pineapple",
- "Raspberry",
- ]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.find.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.find.js
deleted file mode 100644
index 4d12b61a11..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.find.js
+++ /dev/null
@@ -1,65 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.find).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("requires at least one argument", () => {
- expect(() => {
- [].find();
- }).toThrowWithMessage(TypeError, "Array.prototype.find() requires at least one argument");
- });
-
- test("callback must be a function", () => {
- expect(() => {
- [].find(undefined);
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-});
-
-describe("normal behavior", () => {
- test("basic functionality", () => {
- var array = ["hello", "friends", 1, 2, false];
-
- expect(array.find(value => value === "hello")).toBe("hello");
- expect(array.find((value, index, arr) => index === 1)).toBe("friends");
- expect(array.find(value => value == "1")).toBe(1);
- expect(array.find(value => value === 1)).toBe(1);
- expect(array.find(value => typeof value !== "string")).toBe(1);
- expect(array.find(value => typeof value === "boolean")).toBeFalse();
- expect(array.find(value => value > 1)).toBe(2);
- expect(array.find(value => value > 1 && value < 3)).toBe(2);
- expect(array.find(value => value > 100)).toBeUndefined();
- expect([].find(value => value === 1)).toBeUndefined();
- });
-
- test("never calls callback with empty array", () => {
- var callbackCalled = 0;
- expect(
- [].find(() => {
- callbackCalled++;
- })
- ).toBeUndefined();
- expect(callbackCalled).toBe(0);
- });
-
- test("calls callback once for every item", () => {
- var callbackCalled = 0;
- expect(
- [1, 2, 3].find(() => {
- callbackCalled++;
- })
- ).toBeUndefined();
- expect(callbackCalled).toBe(3);
- });
-
- test("empty slots are treated as undefined", () => {
- var callbackCalled = 0;
- expect(
- [1, , , "foo", , undefined, , ,].find(value => {
- callbackCalled++;
- return value === undefined;
- })
- ).toBeUndefined();
- expect(callbackCalled).toBe(2);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.findIndex.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.findIndex.js
deleted file mode 100644
index 751caa64be..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.findIndex.js
+++ /dev/null
@@ -1,68 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.findIndex).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("requires at least one argument", () => {
- expect(() => {
- [].findIndex();
- }).toThrowWithMessage(
- TypeError,
- "Array.prototype.findIndex() requires at least one argument"
- );
- });
-
- test("callback must be a function", () => {
- expect(() => {
- [].findIndex(undefined);
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-});
-
-describe("normal behavior", () => {
- test("basic functionality", () => {
- var array = ["hello", "friends", 1, 2, false];
-
- expect(array.findIndex(value => value === "hello")).toBe(0);
- expect(array.findIndex((value, index, arr) => index === 1)).toBe(1);
- expect(array.findIndex(value => value == "1")).toBe(2);
- expect(array.findIndex(value => value === 1)).toBe(2);
- expect(array.findIndex(value => typeof value !== "string")).toBe(2);
- expect(array.findIndex(value => typeof value === "boolean")).toBe(4);
- expect(array.findIndex(value => value > 1)).toBe(3);
- expect(array.findIndex(value => value > 1 && value < 3)).toBe(3);
- expect(array.findIndex(value => value > 100)).toBe(-1);
- expect([].findIndex(value => value === 1)).toBe(-1);
- });
-
- test("never calls callback with empty array", () => {
- var callbackCalled = 0;
- expect(
- [].findIndex(() => {
- callbackCalled++;
- })
- ).toBe(-1);
- expect(callbackCalled).toBe(0);
- });
-
- test("calls callback once for every item", () => {
- var callbackCalled = 0;
- expect(
- [1, 2, 3].findIndex(() => {
- callbackCalled++;
- })
- ).toBe(-1);
- expect(callbackCalled).toBe(3);
- });
-
- test("empty slots are treated as undefined", () => {
- var callbackCalled = 0;
- expect(
- [1, , , "foo", , undefined, , ,].findIndex(value => {
- callbackCalled++;
- return value === undefined;
- })
- ).toBe(1);
- expect(callbackCalled).toBe(2);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.forEach.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.forEach.js
deleted file mode 100644
index 8baa2d5635..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.forEach.js
+++ /dev/null
@@ -1,70 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.forEach).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("requires at least one argument", () => {
- expect(() => {
- [].forEach();
- }).toThrowWithMessage(
- TypeError,
- "Array.prototype.forEach() requires at least one argument"
- );
- });
-
- test("callback must be a function", () => {
- expect(() => {
- [].forEach(undefined);
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-});
-
-describe("normal behavior", () => {
- test("never calls callback with empty array", () => {
- var callbackCalled = 0;
- expect(
- [].forEach(() => {
- callbackCalled++;
- })
- ).toBeUndefined();
- expect(callbackCalled).toBe(0);
- });
-
- test("calls callback once for every item", () => {
- var callbackCalled = 0;
- expect(
- [1, 2, 3].forEach(() => {
- callbackCalled++;
- })
- ).toBeUndefined();
- expect(callbackCalled).toBe(3);
- });
-
- test("callback receives value and index", () => {
- var a = [1, 2, 3];
- a.forEach((value, index) => {
- expect(value).toBe(a[index]);
- expect(index).toBe(a[index] - 1);
- });
- });
-
- test("callback receives array", () => {
- var callbackCalled = 0;
- var a = [1, 2, 3];
- a.forEach((_, __, array) => {
- callbackCalled++;
- expect(a).toEqual(array);
- a.push("test");
- });
- expect(callbackCalled).toBe(3);
- expect(a).toEqual([1, 2, 3, "test", "test", "test"]);
- });
-
- test("this value can be modified", () => {
- var t = [];
- [1, 2, 3].forEach(function (value) {
- this.push(value);
- }, t);
- expect(t).toEqual([1, 2, 3]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.includes.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.includes.js
deleted file mode 100644
index 575cd84e1b..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.includes.js
+++ /dev/null
@@ -1,18 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.includes).toHaveLength(1);
-});
-
-test("basic functionality", () => {
- var array = ["hello", "friends", 1, 2, false];
-
- expect([].includes()).toBeFalse();
- expect([undefined].includes()).toBeTrue();
- expect(array.includes("hello")).toBeTrue();
- expect(array.includes(1)).toBeTrue();
- expect(array.includes(1, -3)).toBeTrue();
- expect(array.includes("serenity")).toBeFalse();
- expect(array.includes(false, -1)).toBeTrue();
- expect(array.includes(2, -1)).toBeFalse();
- expect(array.includes(2, -100)).toBeTrue();
- expect(array.includes("friends", 100)).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.indexOf.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.indexOf.js
deleted file mode 100644
index 74caab93ee..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.indexOf.js
+++ /dev/null
@@ -1,25 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.indexOf).toHaveLength(1);
-});
-
-test("basic functionality", () => {
- var array = ["hello", "friends", 1, 2, false];
-
- expect(array.indexOf("hello")).toBe(0);
- expect(array.indexOf("friends")).toBe(1);
- expect(array.indexOf(false)).toBe(4);
- expect(array.indexOf(false, 2)).toBe(4);
- expect(array.indexOf(false, -2)).toBe(4);
- expect(array.indexOf(1)).toBe(2);
- expect(array.indexOf(1, 1000)).toBe(-1);
- expect(array.indexOf(1, -1000)).toBe(2);
- expect(array.indexOf("serenity")).toBe(-1);
- expect(array.indexOf(false, -1)).toBe(4);
- expect(array.indexOf(2, -1)).toBe(-1);
- expect(array.indexOf(2, -2)).toBe(3);
- expect([].indexOf("serenity")).toBe(-1);
- expect([].indexOf("serenity", 10)).toBe(-1);
- expect([].indexOf("serenity", -10)).toBe(-1);
- expect([].indexOf()).toBe(-1);
- expect([undefined].indexOf()).toBe(0);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.join.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.join.js
deleted file mode 100644
index 30efb7e2b5..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.join.js
+++ /dev/null
@@ -1,24 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.join).toHaveLength(1);
-});
-
-test("basic functionality", () => {
- expect(["hello", "friends"].join()).toBe("hello,friends");
- expect(["hello", "friends"].join(undefined)).toBe("hello,friends");
- expect(["hello", "friends"].join(" ")).toBe("hello friends");
- expect(["hello", "friends", "foo"].join("~", "#")).toBe("hello~friends~foo");
- expect([].join()).toBe("");
- expect([null].join()).toBe("");
- expect([undefined].join()).toBe("");
- expect([undefined, null, ""].join()).toBe(",,");
- expect([1, null, 2, undefined, 3].join()).toBe("1,,2,,3");
- expect(Array(3).join()).toBe(",,");
-});
-
-test("circular references", () => {
- const a = ["foo", [], [1, 2, []], ["bar"]];
- a[1] = a;
- a[2][2] = a;
- // [ "foo", <circular>, [ 1, 2, <circular> ], [ "bar" ] ]
- expect(a.join()).toBe("foo,,1,2,,bar");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.lastIndexOf.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.lastIndexOf.js
deleted file mode 100644
index eb0f7c6b37..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.lastIndexOf.js
+++ /dev/null
@@ -1,22 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.lastIndexOf).toHaveLength(1);
-});
-
-test("basic functionality", () => {
- var array = [1, 2, 3, 1, "hello"];
-
- expect(array.lastIndexOf("hello")).toBe(4);
- expect(array.lastIndexOf("hello", 1000)).toBe(4);
- expect(array.lastIndexOf(1)).toBe(3);
- expect(array.lastIndexOf(1, -1)).toBe(3);
- expect(array.lastIndexOf(1, -2)).toBe(3);
- expect(array.lastIndexOf(2)).toBe(1);
- expect(array.lastIndexOf(2, -3)).toBe(1);
- expect(array.lastIndexOf(2, -4)).toBe(1);
- expect([].lastIndexOf("hello")).toBe(-1);
- expect([].lastIndexOf("hello", 10)).toBe(-1);
- expect([].lastIndexOf("hello", -10)).toBe(-1);
- expect([].lastIndexOf()).toBe(-1);
- expect([undefined].lastIndexOf()).toBe(0);
- expect([undefined, undefined, undefined].lastIndexOf()).toBe(2);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js
deleted file mode 100644
index a775fa8c32..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js
+++ /dev/null
@@ -1,57 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.map).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("requires at least one argument", () => {
- expect(() => {
- [].map();
- }).toThrowWithMessage(TypeError, "Array.prototype.map() requires at least one argument");
- });
-
- test("callback must be a function", () => {
- expect(() => {
- [].map(undefined);
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-});
-
-describe("normal behavior", () => {
- test("never calls callback with empty array", () => {
- var callbackCalled = 0;
- expect(
- [].map(() => {
- callbackCalled++;
- })
- ).toEqual([]);
- expect(callbackCalled).toBe(0);
- });
-
- test("calls callback once for every item", () => {
- var callbackCalled = 0;
- expect(
- [1, 2, 3].map(() => {
- callbackCalled++;
- })
- ).toEqual([undefined, undefined, undefined]);
- expect(callbackCalled).toBe(3);
- });
-
- test("can map based on callback return value", () => {
- expect(
- [undefined, null, true, "foo", 42, {}].map(
- (value, index) => "" + index + " -> " + value
- )
- ).toEqual([
- "0 -> undefined",
- "1 -> null",
- "2 -> true",
- "3 -> foo",
- "4 -> 42",
- "5 -> [object Object]",
- ]);
-
- var squaredNumbers = [0, 1, 2, 3, 4].map(x => x ** 2);
- expect(squaredNumbers).toEqual([0, 1, 4, 9, 16]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.pop.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.pop.js
deleted file mode 100644
index d1c34ad60e..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.pop.js
+++ /dev/null
@@ -1,29 +0,0 @@
-test("length is 0", () => {
- expect(Array.prototype.pop).toHaveLength(0);
-});
-
-describe("normal behavior", () => {
- test("array with elements", () => {
- var a = [1, 2, 3];
- expect(a.pop()).toBe(3);
- expect(a).toEqual([1, 2]);
- expect(a.pop()).toBe(2);
- expect(a).toEqual([1]);
- expect(a.pop()).toBe(1);
- expect(a).toEqual([]);
- expect(a.pop()).toBeUndefined();
- expect(a).toEqual([]);
- });
-
- test("empty array", () => {
- var a = [];
- expect(a.pop()).toBeUndefined();
- expect(a).toEqual([]);
- });
-
- test("array with empty slot", () => {
- var a = [,];
- expect(a.pop()).toBeUndefined();
- expect(a).toEqual([]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.push.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.push.js
deleted file mode 100644
index 209cd7a74d..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.push.js
+++ /dev/null
@@ -1,23 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.push).toHaveLength(1);
-});
-
-describe("normal behavior", () => {
- test("no argument", () => {
- var a = ["hello"];
- expect(a.push()).toBe(1);
- expect(a).toEqual(["hello"]);
- });
-
- test("single argument", () => {
- var a = ["hello"];
- expect(a.push("friends")).toBe(2);
- expect(a).toEqual(["hello", "friends"]);
- });
-
- test("multiple arguments", () => {
- var a = ["hello", "friends"];
- expect(a.push(1, 2, 3)).toBe(5);
- expect(a).toEqual(["hello", "friends", 1, 2, 3]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js
deleted file mode 100644
index 9b984fea03..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js
+++ /dev/null
@@ -1,113 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.reduce).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("requires at least one argument", () => {
- expect(() => {
- [].reduce();
- }).toThrowWithMessage(TypeError, "Array.prototype.reduce() requires at least one argument");
- });
-
- test("callback must be a function", () => {
- expect(() => {
- [].reduce(undefined);
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-
- test("reduce of empty array with no initial value", () => {
- expect(() => {
- [].reduce((a, x) => x);
- }).toThrowWithMessage(TypeError, "Reduce of empty array with no initial value");
- });
-
- test("reduce of array with only empty slots and no initial value", () => {
- expect(() => {
- [, ,].reduce((a, x) => x);
- }).toThrowWithMessage(TypeError, "Reduce of empty array with no initial value");
- });
-});
-
-describe("normal behavior", () => {
- test("basic functionality", () => {
- [1, 2].reduce(function () {
- expect(this).toBeUndefined();
- });
-
- var callbackCalled = 0;
- var callback = () => {
- callbackCalled++;
- return true;
- };
-
- expect([1].reduce(callback)).toBe(1);
- expect(callbackCalled).toBe(0);
-
- expect([, 1].reduce(callback)).toBe(1);
- expect(callbackCalled).toBe(0);
-
- callbackCalled = 0;
- expect([1, 2, 3].reduce(callback)).toBeTrue();
- expect(callbackCalled).toBe(2);
-
- callbackCalled = 0;
- expect([, , 1, 2, 3].reduce(callback)).toBeTrue();
- expect(callbackCalled).toBe(2);
-
- callbackCalled = 0;
- expect([1, , , 10, , 100, , ,].reduce(callback)).toBeTrue();
- expect(callbackCalled).toBe(2);
-
- var constantlySad = () => ":^(";
- var result = [].reduce(constantlySad, ":^)");
- expect(result).toBe(":^)");
-
- result = [":^0"].reduce(constantlySad, ":^)");
- expect(result).toBe(":^(");
-
- result = [":^0"].reduce(constantlySad);
- expect(result).toBe(":^0");
-
- result = [5, 4, 3, 2, 1].reduce((accum, elem) => accum + elem);
- expect(result).toBe(15);
-
- result = [1, 2, 3, 4, 5, 6].reduce((accum, elem) => accum + elem, 100);
- expect(result).toBe(121);
-
- result = [6, 5, 4, 3, 2, 1].reduce((accum, elem) => {
- return accum + elem;
- }, 100);
- expect(result).toBe(121);
-
- var indexes = [];
- result = ["foo", 1, true].reduce((a, v, i) => {
- indexes.push(i);
- });
- expect(result).toBeUndefined();
- expect(indexes.length).toBe(2);
- expect(indexes[0]).toBe(1);
- expect(indexes[1]).toBe(2);
-
- indexes = [];
- result = ["foo", 1, true].reduce((a, v, i) => {
- indexes.push(i);
- }, "foo");
- expect(result).toBeUndefined();
- expect(indexes).toEqual([0, 1, 2]);
-
- var mutable = { prop: 0 };
- result = ["foo", 1, true].reduce((a, v) => {
- a.prop = v;
- return a;
- }, mutable);
- expect(result).toBe(mutable);
- expect(result.prop).toBeTrue();
-
- var a1 = [1, 2];
- var a2 = null;
- a1.reduce((a, v, i, t) => {
- a2 = t;
- });
- expect(a1).toBe(a2);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js
deleted file mode 100644
index 3d718a0446..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js
+++ /dev/null
@@ -1,118 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.reduceRight).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("requires at least one argument", () => {
- expect(() => {
- [].reduceRight();
- }).toThrowWithMessage(
- TypeError,
- "Array.prototype.reduceRight() requires at least one argument"
- );
- });
-
- test("callback must be a function", () => {
- expect(() => {
- [].reduceRight(undefined);
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-
- test("reduce of empty array with no initial value", () => {
- expect(() => {
- [].reduceRight((a, x) => x);
- }).toThrowWithMessage(TypeError, "Reduce of empty array with no initial value");
- });
-
- test("reduce of array with only empty slots and no initial value", () => {
- expect(() => {
- [, ,].reduceRight((a, x) => x);
- }).toThrowWithMessage(TypeError, "Reduce of empty array with no initial value");
- });
-});
-
-describe("normal behavior", () => {
- test("basic functionality", () => {
- [1, 2].reduceRight(function () {
- expect(this).toBeUndefined();
- });
-
- var callbackCalled = 0;
- var callback = () => {
- callbackCalled++;
- return true;
- };
-
- expect([1].reduceRight(callback)).toBe(1);
- expect(callbackCalled).toBe(0);
-
- expect([1].reduceRight(callback)).toBe(1);
- expect(callbackCalled).toBe(0);
-
- callbackCalled = 0;
- expect([1, 2, 3].reduceRight(callback)).toBe(true);
- expect(callbackCalled).toBe(2);
-
- callbackCalled = 0;
- expect([1, 2, 3, ,].reduceRight(callback)).toBe(true);
- expect(callbackCalled).toBe(2);
-
- callbackCalled = 0;
- expect([, , , 1, , , 10, , 100, , ,].reduceRight(callback)).toBe(true);
- expect(callbackCalled).toBe(2);
-
- var constantlySad = () => ":^(";
- var result = [].reduceRight(constantlySad, ":^)");
- expect(result).toBe(":^)");
-
- result = [":^0"].reduceRight(constantlySad, ":^)");
- expect(result).toBe(":^(");
-
- result = [":^0"].reduceRight(constantlySad);
- expect(result).toBe(":^0");
-
- result = [5, 4, 3, 2, 1].reduceRight((accum, elem) => "" + accum + elem);
- expect(result).toBe("12345");
-
- result = [1, 2, 3, 4, 5, 6].reduceRight((accum, elem) => {
- return "" + accum + elem;
- }, 100);
- expect(result).toBe("100654321");
-
- result = [6, 5, 4, 3, 2, 1].reduceRight((accum, elem) => {
- return "" + accum + elem;
- }, 100);
- expect(result).toBe("100123456");
-
- var indexes = [];
- result = ["foo", 1, true].reduceRight((a, v, i) => {
- indexes.push(i);
- });
- expect(result).toBeUndefined();
- expect(indexes.length).toBe(2);
- expect(indexes[0]).toBe(1);
- expect(indexes[1]).toBe(0);
-
- indexes = [];
- result = ["foo", 1, true].reduceRight((a, v, i) => {
- indexes.push(i);
- }, "foo");
- expect(result).toBeUndefined();
- expect(indexes).toEqual([2, 1, 0]);
-
- var mutable = { prop: 0 };
- result = ["foo", 1, true].reduceRight((a, v) => {
- a.prop = v;
- return a;
- }, mutable);
- expect(result).toBe(mutable);
- expect(result.prop).toBe("foo");
-
- var a1 = [1, 2];
- var a2 = null;
- a1.reduceRight((a, v, i, t) => {
- a2 = t;
- });
- expect(a1).toBe(a2);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reverse.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reverse.js
deleted file mode 100644
index b2b71b15d6..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reverse.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("length is 0", () => {
- expect(Array.prototype.reverse).toHaveLength(0);
-});
-
-test("basic functionality", () => {
- var array = [1, 2, 3];
- expect(array.reverse()).toEqual([3, 2, 1]);
- expect(array).toEqual([3, 2, 1]);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.shift.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.shift.js
deleted file mode 100644
index 0e154eeeb6..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.shift.js
+++ /dev/null
@@ -1,23 +0,0 @@
-test("length is 0", () => {
- expect(Array.prototype.shift).toHaveLength(0);
-});
-
-describe("normal behavior", () => {
- test("array with elements", () => {
- var a = [1, 2, 3];
- expect(a.shift()).toBe(1);
- expect(a).toEqual([2, 3]);
- });
-
- test("empty array", () => {
- var a = [];
- expect(a.shift()).toBeUndefined();
- expect(a).toEqual([]);
- });
-
- test("array with empty slot", () => {
- var a = [,];
- expect(a.shift()).toBeUndefined();
- expect(a).toEqual([]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js
deleted file mode 100644
index c1c45be082..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js
+++ /dev/null
@@ -1,39 +0,0 @@
-test("length is 0", () => {
- expect(Array.prototype.slice).toHaveLength(2);
-});
-
-test("basic functionality", () => {
- var array = ["hello", "friends", "serenity", 1];
-
- var slice = array.slice();
- expect(array).toEqual(["hello", "friends", "serenity", 1]);
- expect(slice).toEqual(["hello", "friends", "serenity", 1]);
-
- slice = array.slice(1);
- expect(array).toEqual(["hello", "friends", "serenity", 1]);
- expect(slice).toEqual(["friends", "serenity", 1]);
-
- slice = array.slice(0, 2);
- expect(array).toEqual(["hello", "friends", "serenity", 1]);
- expect(slice).toEqual(["hello", "friends"]);
-
- slice = array.slice(-1);
- expect(array).toEqual(["hello", "friends", "serenity", 1]);
- expect(slice).toEqual([1]);
-
- slice = array.slice(1, 1);
- expect(array).toEqual(["hello", "friends", "serenity", 1]);
- expect(slice).toEqual([]);
-
- slice = array.slice(1, -1);
- expect(array).toEqual(["hello", "friends", "serenity", 1]);
- expect(slice).toEqual(["friends", "serenity"]);
-
- slice = array.slice(2, -1);
- expect(array).toEqual(["hello", "friends", "serenity", 1]);
- expect(slice).toEqual(["serenity"]);
-
- slice = array.slice(0, 100);
- expect(array).toEqual(["hello", "friends", "serenity", 1]);
- expect(slice).toEqual(["hello", "friends", "serenity", 1]);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.some.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.some.js
deleted file mode 100644
index ff9e62f2d1..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.some.js
+++ /dev/null
@@ -1,37 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.some).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("requires at least one argument", () => {
- expect(() => {
- [].some();
- }).toThrowWithMessage(TypeError, "Array.prototype.some() requires at least one argument");
- });
-
- test("callback must be a function", () => {
- expect(() => {
- [].some(undefined);
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-});
-
-test("basic functionality", () => {
- var array = ["hello", "friends", 1, 2, false, -42, { name: "serenityos" }];
-
- expect(array.some(value => value === "hello")).toBeTrue();
- expect(array.some(value => value === "serenity")).toBeFalse();
- expect(array.some((value, index, arr) => index === 1)).toBeTrue();
- expect(array.some(value => value == "1")).toBeTrue();
- expect(array.some(value => value === 1)).toBeTrue();
- expect(array.some(value => value === 13)).toBeFalse();
- expect(array.some(value => typeof value !== "string")).toBeTrue();
- expect(array.some(value => typeof value === "boolean")).toBeTrue();
- expect(array.some(value => value > 1)).toBeTrue();
- expect(array.some(value => value > 1 && value < 3)).toBeTrue();
- expect(array.some(value => value > 100)).toBeFalse();
- expect(array.some(value => value < 0)).toBeTrue();
- expect(array.some(value => array.pop())).toBeTrue();
- expect(["", "hello", "friends", "serenity"].some(value => value.length === 0)).toBeTrue();
- expect([].some(value => value === 1)).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.sort.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.sort.js
deleted file mode 100644
index 1b05995be2..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.sort.js
+++ /dev/null
@@ -1,204 +0,0 @@
-describe("Array.prototype.sort", () => {
- test("basic functionality", () => {
- expect(Array.prototype.sort).toHaveLength(1);
-
- var arr = ["c", "b", "d", "a"];
- expect(arr.sort()).toEqual(arr);
- expect(arr).toEqual(["a", "b", "c", "d"]);
-
- arr = ["aa", "a"];
- expect(arr.sort()).toEqual(arr);
- expect(arr).toEqual(["a", "aa"]);
-
- arr = [1, 0];
- expect(arr.sort()).toBe(arr); // should be exactly same object
- expect(arr).toEqual([0, 1]);
-
- // numbers are sorted as strings
- arr = [205, -123, 22, 200, 3, -20, -2, -1, 25, 2, 0, 1];
- expect(arr.sort()).toEqual([-1, -123, -2, -20, 0, 1, 2, 200, 205, 22, 25, 3]);
-
- // mix of data, including empty slots and undefined
- arr = ["2", Infinity, null, null, , undefined, 5, , undefined, null, 54, "5"];
- expect(arr.sort()).toEqual([
- "2",
- 5,
- "5",
- 54,
- Infinity,
- null,
- null,
- null,
- undefined,
- undefined,
- ,
- ,
- ]);
- expect(arr.length).toEqual(12);
-
- // undefined compare function
- arr = ["2", Infinity, null, null, , undefined, 5n, , undefined, null, 54, "5"];
- expect(arr.sort(undefined)).toEqual([
- "2",
- 5n,
- "5",
- 54,
- Infinity,
- null,
- null,
- null,
- undefined,
- undefined,
- ,
- ,
- ]);
- expect(arr.length).toEqual(12);
-
- // numeric data with compare function to sort numerically
- arr = [50, 500, 5, Infinity, -Infinity, 0, 10, -10, 1, -1, 5, 0, 15, Infinity];
- expect(arr.sort((a, b) => a - b)).toEqual([
- -Infinity,
- -10,
- -1,
- 0,
- 0,
- 1,
- 5,
- 5,
- 10,
- 15,
- 50,
- 500,
- Infinity,
- Infinity,
- ]);
- expect(arr.length).toEqual(14);
-
- // numeric data with compare function to sort reverse numerically
- arr = [50, 500, 5, Infinity, -Infinity, 0, 10, -10, 1, -1, 5, 0, 15, Infinity];
- expect(arr.sort((a, b) => b - a)).toEqual([
- Infinity,
- Infinity,
- 500,
- 50,
- 15,
- 10,
- 5,
- 5,
- 1,
- 0,
- 0,
- -1,
- -10,
- -Infinity,
- ]);
-
- // small/edge cases
- expect([].sort()).toEqual([]);
- expect([5].sort()).toEqual([5]);
- expect([5, 5].sort()).toEqual([5, 5]);
- expect([undefined].sort()).toEqual([undefined]);
- expect([undefined, undefined].sort()).toEqual([undefined, undefined]);
- expect([,].sort()).toEqual([,]);
- expect([, ,].sort()).toEqual([, ,]);
- expect([5, ,].sort()).toEqual([5, ,]);
- expect([, , 5].sort()).toEqual([5, , ,]);
-
- // sorting should be stable
- arr = [
- { sorted_key: 2, other_property: 1 },
- { sorted_key: 2, other_property: 2 },
- { sorted_key: 1, other_property: 3 },
- ];
- arr.sort((a, b) => a.sorted_key - b.sorted_key);
- expect(arr[1].other_property == 1);
- expect(arr[2].other_property == 2);
- });
-
- test("that it makes no unnecessary calls to compare function", () => {
- expectNoCallCompareFunction = function (a, b) {
- expect().fail();
- };
-
- expect([].sort(expectNoCallCompareFunction)).toEqual([]);
- expect([1].sort(expectNoCallCompareFunction)).toEqual([1]);
- expect([1, undefined].sort(expectNoCallCompareFunction)).toEqual([1, undefined]);
- expect([undefined, undefined].sort(expectNoCallCompareFunction)).toEqual([
- undefined,
- undefined,
- ]);
- expect([, , 1, ,].sort(expectNoCallCompareFunction)).toEqual([1, , , ,]);
- expect([undefined, , 1, , undefined, ,].sort(expectNoCallCompareFunction)).toEqual([
- 1,
- undefined,
- undefined,
- ,
- ,
- ,
- ]);
- });
-
- test("that it works on non-arrays", () => {
- var obj = { length: 0 };
- expect(Array.prototype.sort.call(obj)).toBe(obj);
- expect(obj).toEqual({ length: 0 });
-
- obj = { 0: 1, length: 0 };
- expect(Array.prototype.sort.call(obj, undefined)).toBe(obj);
- expect(obj).toEqual({ 0: 1, length: 0 });
-
- obj = { 0: 3, 1: 2, 2: 1, 3: 0, length: 2 };
- expect(Array.prototype.sort.call(obj)).toBe(obj);
- expect(obj).toEqual({ 0: 2, 1: 3, 2: 1, 3: 0, length: 2 });
-
- obj = { 0: 3, 1: 2, 2: 1, a: "b", hello: "friends!", length: 2 };
- expect(Array.prototype.sort.call(obj)).toBe(obj);
- expect(obj).toEqual({ 0: 2, 1: 3, 2: 1, 3: 0, a: "b", hello: "friends!", length: 2 });
-
- obj = { 0: 2, 1: 3, 2: 1, a: "b", hello: "friends!", length: 2 };
- expect(
- Array.prototype.sort.call(obj, (a, b) => {
- expect(a == 2 || a == 3).toBeTrue();
- expect(b == 2 || b == 3).toBeTrue();
- return b - a;
- })
- ).toBe(obj);
- expect(obj).toEqual({ 0: 3, 1: 2, 2: 1, 3: 0, a: "b", hello: "friends!", length: 2 });
- });
-
- test("that it handles abrupt completions correctly", () => {
- class TestError extends Error {
- constructor() {
- super();
- this.name = "TestError";
- }
- }
-
- arr = [1, 2, 3];
- expect(() =>
- arr.sort((a, b) => {
- throw new TestError();
- })
- ).toThrow(TestError);
-
- class DangerousToString {
- toString() {
- throw new TestError();
- }
- }
- arr = [new DangerousToString(), new DangerousToString()];
- expect(() => arr.sort()).toThrow(TestError);
- });
-
- test("that it does not use deleteProperty unnecessarily", () => {
- var obj = new Proxy(
- { 0: 5, 1: 4, 2: 3, length: 3 },
- {
- deleteProperty: function (target, property) {
- expect().fail();
- },
- }
- );
- Array.prototype.sort.call(obj);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js
deleted file mode 100644
index 245648760a..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js
+++ /dev/null
@@ -1,49 +0,0 @@
-test("length is 2", () => {
- expect(Array.prototype.splice).toHaveLength(2);
-});
-
-test("basic functionality", () => {
- var array = ["hello", "friends", "serenity", 1, 2];
- var removed = array.splice(3);
- expect(array).toEqual(["hello", "friends", "serenity"]);
- expect(removed).toEqual([1, 2]);
-
- array = ["hello", "friends", "serenity", 1, 2];
- removed = array.splice(-2);
- expect(array).toEqual(["hello", "friends", "serenity"]);
- expect(removed).toEqual([1, 2]);
-
- array = ["hello", "friends", "serenity", 1, 2];
- removed = array.splice(-2, 1);
- expect(array).toEqual(["hello", "friends", "serenity", 2]);
- expect(removed).toEqual([1]);
-
- array = ["serenity"];
- removed = array.splice(0, 0, "hello", "friends");
- expect(array).toEqual(["hello", "friends", "serenity"]);
- expect(removed).toEqual([]);
-
- array = ["goodbye", "friends", "serenity"];
- removed = array.splice(0, 1, "hello");
- expect(array).toEqual(["hello", "friends", "serenity"]);
- expect(removed).toEqual(["goodbye"]);
-
- array = ["foo", "bar", "baz"];
- removed = array.splice();
- expect(array).toEqual(["foo", "bar", "baz"]);
- expect(removed).toEqual([]);
-
- removed = array.splice(0, 123);
- expect(array).toEqual([]);
- expect(removed).toEqual(["foo", "bar", "baz"]);
-
- array = ["foo", "bar", "baz"];
- removed = array.splice(123, 123);
- expect(array).toEqual(["foo", "bar", "baz"]);
- expect(removed).toEqual([]);
-
- array = ["foo", "bar", "baz"];
- removed = array.splice(-123, 123);
- expect(array).toEqual([]);
- expect(removed).toEqual(["foo", "bar", "baz"]);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js
deleted file mode 100644
index 05854a1d0c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js
+++ /dev/null
@@ -1,62 +0,0 @@
-test("length is 0", () => {
- expect(Array.prototype.toLocaleString).toHaveLength(0);
-});
-
-describe("normal behavior", () => {
- test("array with no elements", () => {
- expect([].toLocaleString()).toBe("");
- });
-
- test("array with one element", () => {
- expect(["foo"].toLocaleString()).toBe("foo");
- });
-
- test("array with multiple elements", () => {
- expect(["foo", "bar", "baz"].toLocaleString()).toBe("foo,bar,baz");
- });
-
- test("null and undefined result in empty strings", () => {
- expect([null].toLocaleString()).toBe("");
- expect([undefined].toLocaleString()).toBe("");
- expect([undefined, null].toLocaleString()).toBe(",");
- });
-
- test("empty values result in empty strings", () => {
- expect(new Array(1).toLocaleString()).toBe("");
- expect(new Array(3).toLocaleString()).toBe(",,");
- var a = new Array(5);
- a[2] = "foo";
- a[4] = "bar";
- expect(a.toLocaleString()).toBe(",,foo,,bar");
- });
-
- test("getter property is included in returned string", () => {
- var a = ["foo"];
- Object.defineProperty(a, 1, {
- get() {
- return "bar";
- },
- });
- expect(a.toLocaleString()).toBe("foo,bar");
- });
-
- test("array with elements that have a custom toString() function", () => {
- var toStringCalled = 0;
- var o = {
- toString() {
- toStringCalled++;
- return "o";
- },
- };
- expect([o, undefined, o, null, o].toLocaleString()).toBe("o,,o,,o");
- expect(toStringCalled).toBe(3);
- });
-
- test("array with circular references", () => {
- const a = ["foo", [], [1, 2, []], ["bar"]];
- a[1] = a;
- a[2][2] = a;
- // [ "foo", <circular>, [ 1, 2, <circular> ], [ "bar" ] ]
- expect(a.toLocaleString()).toBe("foo,,1,2,,bar");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toString.js
deleted file mode 100644
index 1c18fb54ed..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toString.js
+++ /dev/null
@@ -1,66 +0,0 @@
-test("length is 0", () => {
- expect(Array.prototype.toString).toHaveLength(0);
-});
-
-describe("normal behavior", () => {
- test("array with no elements", () => {
- expect([].toString()).toBe("");
- });
-
- test("array with one element", () => {
- expect([1].toString()).toBe("1");
- });
-
- test("array with multiple elements", () => {
- expect([1, 2, 3].toString()).toBe("1,2,3");
- });
-
- test("string and array concatenation", () => {
- expect("rgb(" + [10, 11, 12] + ")").toBe("rgb(10,11,12)");
- });
-
- test("null and undefined result in empty strings", () => {
- expect([null].toString()).toBe("");
- expect([undefined].toString()).toBe("");
- expect([undefined, null].toString()).toBe(",");
- });
-
- test("empty values result in empty strings", () => {
- expect(new Array(1).toString()).toBe("");
- expect(new Array(3).toString()).toBe(",,");
- var a = new Array(5);
- a[2] = "foo";
- a[4] = "bar";
- expect(a.toString()).toBe(",,foo,,bar");
- });
-
- test("getter property is included in returned string", () => {
- var a = [1, 2, 3];
- Object.defineProperty(a, 3, {
- get() {
- return 10;
- },
- });
- expect(a.toString()).toBe("1,2,3,10");
- });
-
- test("array with elements that have a custom toString() function", () => {
- var toStringCalled = 0;
- var o = {
- toString() {
- toStringCalled++;
- return "o";
- },
- };
- expect([o, undefined, o, null, o].toString()).toBe("o,,o,,o");
- expect(toStringCalled).toBe(3);
- });
-
- test("array with circular references", () => {
- const a = ["foo", [], [1, 2, []], ["bar"]];
- a[1] = a;
- a[2][2] = a;
- // [ "foo", <circular>, [ 1, 2, <circular> ], [ "bar" ] ]
- expect(a.toString()).toBe("foo,,1,2,,bar");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.unshift.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.unshift.js
deleted file mode 100644
index 8e65e89775..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.unshift.js
+++ /dev/null
@@ -1,23 +0,0 @@
-test("length is 1", () => {
- expect(Array.prototype.unshift).toHaveLength(1);
-});
-
-describe("normal behavior", () => {
- test("no argument", () => {
- var a = ["hello"];
- expect(a.unshift()).toBe(1);
- expect(a).toEqual(["hello"]);
- });
-
- test("single argument", () => {
- var a = ["hello"];
- expect(a.unshift("friends")).toBe(2);
- expect(a).toEqual(["friends", "hello"]);
- });
-
- test("multiple arguments", () => {
- var a = ["friends", "hello"];
- expect(a.unshift(1, 2, 3)).toBe(5);
- expect(a).toEqual([1, 2, 3, "friends", "hello"]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.values.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.values.js
deleted file mode 100644
index 368f34429f..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.values.js
+++ /dev/null
@@ -1,44 +0,0 @@
-test("length", () => {
- expect(Array.prototype.values.length).toBe(0);
-});
-
-test("basic functionality", () => {
- const a = [1, 2, 3];
- const it = a.values();
- expect(it.next()).toEqual({ value: 1, done: false });
- expect(it.next()).toEqual({ value: 2, done: false });
- expect(it.next()).toEqual({ value: 3, done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
-});
-
-test("works when applied to non-object", () => {
- [true, false, 9, 2n, Symbol()].forEach(primitive => {
- const it = [].values.call(primitive);
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
- });
-});
-
-test("item added to array before exhaustion is accessible", () => {
- const a = [1, 2];
- const it = a.values();
- expect(it.next()).toEqual({ value: 1, done: false });
- expect(it.next()).toEqual({ value: 2, done: false });
- a.push(3);
- expect(it.next()).toEqual({ value: 3, done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
-});
-
-test("item added to array after exhaustion is inaccessible", () => {
- const a = [1, 2];
- const it = a.values();
- expect(it.next()).toEqual({ value: 1, done: false });
- expect(it.next()).toEqual({ value: 2, done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
- a.push(3);
- expect(it.next()).toEqual({ value: undefined, done: true });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/array-basic.js b/Libraries/LibJS/Tests/builtins/Array/array-basic.js
deleted file mode 100644
index d6e6976421..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/array-basic.js
+++ /dev/null
@@ -1,57 +0,0 @@
-test("basic functionality", () => {
- var a = [1, 2, 3];
-
- expect(typeof a).toBe("object");
- expect(a).toHaveLength(3);
- expect(a[0]).toBe(1);
- expect(a[1]).toBe(2);
- expect(a[2]).toBe(3);
-
- a[1] = 5;
- expect(a[1]).toBe(5);
- expect(a).toHaveLength(3);
-
- a.push(7);
- expect(a[3]).toBe(7);
- expect(a).toHaveLength(4);
-
- a = [,];
- expect(a).toHaveLength(1);
- expect(a.toString()).toBe("");
- expect(a[0]).toBeUndefined();
-
- a = [, , , ,];
- expect(a).toHaveLength(4);
- expect(a.toString()).toBe(",,,");
- expect(a[0]).toBeUndefined();
- expect(a[1]).toBeUndefined();
- expect(a[2]).toBeUndefined();
- expect(a[3]).toBeUndefined();
-
- a = [1, , 2, , , 3];
- expect(a).toHaveLength(6);
- expect(a.toString()).toBe("1,,2,,,3");
- expect(a[0]).toBe(1);
- expect(a[1]).toBeUndefined();
- expect(a[2]).toBe(2);
- expect(a[3]).toBeUndefined();
- expect(a[4]).toBeUndefined();
- expect(a[5]).toBe(3);
-
- a = [1, , 2, , , 3];
- Object.defineProperty(a, 1, {
- get() {
- return this.getterSetterValue;
- },
- set(value) {
- this.getterSetterValue = value;
- },
- });
- expect(a).toHaveLength(6);
- expect(a.toString()).toBe("1,,2,,,3");
- expect(a.getterSetterValue).toBeUndefined();
- a[1] = 20;
- expect(a).toHaveLength(6);
- expect(a.toString()).toBe("1,20,2,,,3");
- expect(a.getterSetterValue).toBe(20);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/array-length-setter.js b/Libraries/LibJS/Tests/builtins/Array/array-length-setter.js
deleted file mode 100644
index 9a1043f5d4..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/array-length-setter.js
+++ /dev/null
@@ -1,37 +0,0 @@
-describe("errors", () => {
- test("invalid array length value", () => {
- var a = [1, 2, 3];
- [undefined, "foo", -1, Infinity, -Infinity, NaN].forEach(value => {
- expect(() => {
- a.length = value;
- }).toThrowWithMessage(RangeError, "Invalid array length");
- expect(a).toHaveLength(3);
- });
- });
-});
-
-describe("normal behavior", () => {
- test("extend array by setting length", () => {
- var a = [1, 2, 3];
- a.length = 5;
- expect(a).toEqual([1, 2, 3, undefined, undefined]);
- });
-
- test("truncate array by setting length", () => {
- var a = [1, 2, 3];
- a.length = 2;
- expect(a).toEqual([1, 2]);
- a.length = 0;
- expect(a).toEqual([]);
- });
-
- test("length value is coerced to number if possible", () => {
- var a = [1, 2, 3];
- a.length = "42";
- expect(a).toHaveLength(42);
- a.length = [];
- expect(a).toHaveLength(0);
- a.length = true;
- expect(a).toHaveLength(1);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/array-shrink-during-find-crash.js b/Libraries/LibJS/Tests/builtins/Array/array-shrink-during-find-crash.js
deleted file mode 100644
index d43c5d0d01..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/array-shrink-during-find-crash.js
+++ /dev/null
@@ -1,19 +0,0 @@
-test("Issue #1992, shrinking array during find() iteration", () => {
- var a, callbackCalled;
-
- callbackCalled = 0;
- a = [1, 2, 3, 4, 5];
- a.find(() => {
- callbackCalled++;
- a.pop();
- });
- expect(callbackCalled).toBe(5);
-
- callbackCalled = 0;
- a = [1, 2, 3, 4, 5];
- a.findIndex(() => {
- callbackCalled++;
- a.pop();
- });
- expect(callbackCalled).toBe(5);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/array-simple-and-generic-storage-initialization.js b/Libraries/LibJS/Tests/builtins/Array/array-simple-and-generic-storage-initialization.js
deleted file mode 100644
index 3202b02c33..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/array-simple-and-generic-storage-initialization.js
+++ /dev/null
@@ -1,15 +0,0 @@
-describe("Issue #3382", () => {
- test("Creating an array with simple storage (<= 200 initial elements)", () => {
- var a = Array(200);
- expect(a).toHaveLength(200);
- expect(a.push("foo")).toBe(201);
- expect(a).toHaveLength(201);
- });
-
- test("Creating an array with generic storage (> 200 initial elements)", () => {
- var a = Array(201);
- expect(a).toHaveLength(201);
- expect(a.push("foo")).toBe(202);
- expect(a).toHaveLength(202);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Array/array-spread.js b/Libraries/LibJS/Tests/builtins/Array/array-spread.js
deleted file mode 100644
index cb570edffe..0000000000
--- a/Libraries/LibJS/Tests/builtins/Array/array-spread.js
+++ /dev/null
@@ -1,25 +0,0 @@
-describe("errors", () => {
- test("cannot spread number in array", () => {
- expect(() => {
- [...1];
- }).toThrowWithMessage(TypeError, "1 is not iterable");
- });
-
- test("cannot spread object in array", () => {
- expect(() => {
- [...{}];
- }).toThrowWithMessage(TypeError, "[object Object] is not iterable");
- });
-});
-
-test("basic functionality", () => {
- expect([1, ...[2, 3], 4]).toEqual([1, 2, 3, 4]);
-
- let a = [2, 3];
- expect([1, ...a, 4]).toEqual([1, 2, 3, 4]);
-
- let obj = { a: [2, 3] };
- expect([1, ...obj.a, 4]).toEqual([1, 2, 3, 4]);
-
- expect([...[], ...[...[1, 2, 3]], 4]).toEqual([1, 2, 3, 4]);
-});
diff --git a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.isView.js b/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.isView.js
deleted file mode 100644
index db1be84067..0000000000
--- a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.isView.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// Update when more typed arrays get added
-const TYPED_ARRAYS = [
- Uint8Array,
- Uint16Array,
- Uint32Array,
- Int8Array,
- Int16Array,
- Int32Array,
- Float32Array,
- Float64Array,
-];
-
-test("basic functionality", () => {
- expect(ArrayBuffer.isView).toHaveLength(1);
-
- expect(ArrayBuffer.isView()).toBeFalse();
- expect(ArrayBuffer.isView(null)).toBeFalse();
- expect(ArrayBuffer.isView(undefined)).toBeFalse();
- expect(ArrayBuffer.isView([])).toBeFalse();
- expect(ArrayBuffer.isView({})).toBeFalse();
- expect(ArrayBuffer.isView(123)).toBeFalse();
- expect(ArrayBuffer.isView("foo")).toBeFalse();
- expect(ArrayBuffer.isView(new ArrayBuffer())).toBeFalse();
- TYPED_ARRAYS.forEach(T => {
- expect(ArrayBuffer.isView(new T())).toBeTrue();
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.js b/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.js
deleted file mode 100644
index 8fb05a250c..0000000000
--- a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.js
+++ /dev/null
@@ -1,13 +0,0 @@
-test("basic functionality", () => {
- expect(ArrayBuffer).toHaveLength(1);
- expect(ArrayBuffer.name).toBe("ArrayBuffer");
- expect(ArrayBuffer.prototype.constructor).toBe(ArrayBuffer);
- expect(new ArrayBuffer()).toBeInstanceOf(ArrayBuffer);
- expect(typeof new ArrayBuffer()).toBe("object");
-});
-
-test("ArrayBuffer constructor must be invoked with 'new'", () => {
- expect(() => {
- ArrayBuffer();
- }).toThrowWithMessage(TypeError, "ArrayBuffer constructor must be called with 'new'");
-});
diff --git a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.prototype.byteLength.js b/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.prototype.byteLength.js
deleted file mode 100644
index 9880e597aa..0000000000
--- a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.prototype.byteLength.js
+++ /dev/null
@@ -1,6 +0,0 @@
-test("basic functionality", () => {
- expect(new ArrayBuffer().byteLength).toBe(0);
- expect(new ArrayBuffer(1).byteLength).toBe(1);
- expect(new ArrayBuffer(64).byteLength).toBe(64);
- expect(new ArrayBuffer(123).byteLength).toBe(123);
-});
diff --git a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.js b/Libraries/LibJS/Tests/builtins/BigInt/BigInt.js
deleted file mode 100644
index 7e517754b7..0000000000
--- a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.js
+++ /dev/null
@@ -1,68 +0,0 @@
-describe("correct behavior", () => {
- test("basic functionality", () => {
- expect(BigInt).toHaveLength(1);
- expect(BigInt.name).toBe("BigInt");
- });
-
- test("constructor with numbers", () => {
- expect(BigInt(0)).toBe(0n);
- expect(BigInt(1)).toBe(1n);
- expect(BigInt(+1)).toBe(1n);
- expect(BigInt(-1)).toBe(-1n);
- expect(BigInt(123n)).toBe(123n);
- });
-
- test("constructor with strings", () => {
- expect(BigInt("")).toBe(0n);
- expect(BigInt("0")).toBe(0n);
- expect(BigInt("1")).toBe(1n);
- expect(BigInt("+1")).toBe(1n);
- expect(BigInt("-1")).toBe(-1n);
- expect(BigInt("-1")).toBe(-1n);
- expect(BigInt("42")).toBe(42n);
- expect(BigInt(" \n 00100 \n ")).toBe(100n);
- expect(BigInt("3323214327642987348732109829832143298746432437532197321")).toBe(
- 3323214327642987348732109829832143298746432437532197321n
- );
- });
-
- test("constructor with objects", () => {
- expect(BigInt([])).toBe(0n);
- });
-});
-
-describe("errors", () => {
- test('cannot be constructed with "new"', () => {
- expect(() => {
- new BigInt();
- }).toThrowWithMessage(TypeError, "BigInt is not a constructor");
- });
-
- test("invalid arguments", () => {
- expect(() => {
- BigInt(null);
- }).toThrowWithMessage(TypeError, "Cannot convert null to BigInt");
-
- expect(() => {
- BigInt(undefined);
- }).toThrowWithMessage(TypeError, "Cannot convert undefined to BigInt");
-
- expect(() => {
- BigInt(Symbol());
- }).toThrowWithMessage(TypeError, "Cannot convert symbol to BigInt");
-
- ["foo", "123n", "1+1", {}, function () {}].forEach(value => {
- expect(() => {
- BigInt(value);
- }).toThrowWithMessage(SyntaxError, `Invalid value for BigInt: ${value}`);
- });
- });
-
- test("invalid numeric arguments", () => {
- [1.23, Infinity, -Infinity, NaN].forEach(value => {
- expect(() => {
- BigInt(value);
- }).toThrowWithMessage(RangeError, "BigInt argument must be an integer");
- });
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.@@toStringTag.js b/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.@@toStringTag.js
deleted file mode 100644
index 44812778a4..0000000000
--- a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.@@toStringTag.js
+++ /dev/null
@@ -1,3 +0,0 @@
-test("basic functionality", () => {
- expect(BigInt.prototype[Symbol.toStringTag]).toBe("BigInt");
-});
diff --git a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js
deleted file mode 100644
index 1c111c516d..0000000000
--- a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- expect(BigInt.prototype.toLocaleString).toHaveLength(0);
- expect(BigInt(123).toLocaleString()).toBe("123");
-});
-
-test("calling with non-BigInt |this|", () => {
- expect(() => {
- BigInt.prototype.toLocaleString.call("foo");
- }).toThrowWithMessage(TypeError, "Not a BigInt object");
-});
diff --git a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toString.js b/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toString.js
deleted file mode 100644
index 040dec60d9..0000000000
--- a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toString.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- expect(BigInt.prototype.toString).toHaveLength(0);
- expect(BigInt(123).toString()).toBe("123");
-});
-
-test("calling with non-BigInt |this|", () => {
- expect(() => {
- BigInt.prototype.toString.call("foo");
- }).toThrowWithMessage(TypeError, "Not a BigInt object");
-});
diff --git a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.valueOf.js b/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.valueOf.js
deleted file mode 100644
index d30a81f824..0000000000
--- a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.valueOf.js
+++ /dev/null
@@ -1,12 +0,0 @@
-test("basic functionality", () => {
- expect(BigInt.prototype.valueOf).toHaveLength(0);
- expect(typeof BigInt(123).valueOf()).toBe("bigint");
- // FIXME: Uncomment once we support Object() with argument
- // expect(typeof Object(123n).valueOf()).toBe("bigint");
-});
-
-test("calling with non-BigInt |this|", () => {
- expect(() => {
- BigInt.prototype.valueOf.call("foo");
- }).toThrowWithMessage(TypeError, "Not a BigInt object");
-});
diff --git a/Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js b/Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js
deleted file mode 100644
index b3fc47d0ad..0000000000
--- a/Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js
+++ /dev/null
@@ -1,80 +0,0 @@
-describe("correct behavior", () => {
- test("typeof bigint", () => {
- expect(typeof 1n).toBe("bigint");
- });
-
- test("bigint string coercion", () => {
- expect("" + 123n).toBe("123");
- });
-
- test("arithmetic operators", () => {
- let bigint = 123n;
- expect(-bigint).toBe(-123n);
-
- expect(12n + 34n).toBe(46n);
- expect(12n - 34n).toBe(-22n);
- expect(8n * 12n).toBe(96n);
- expect(123n / 10n).toBe(12n);
- expect(2n ** 3n).toBe(8n);
- expect(5n % 3n).toBe(2n);
- expect(
- 45977665298704210987n +
- (714320987142450987412098743217984576n / 4598741987421098765327980n) * 987498743n
- ).toBe(199365500239020623962n);
- });
-
- test("bitwise operators", () => {
- expect(12n & 5n).toBe(4n);
- expect(1n | 2n).toBe(3n);
- expect(5n ^ 3n).toBe(6n);
- expect(~1n).toBe(-2n);
- });
-
- test("increment operators", () => {
- let bigint = 1n;
- expect(bigint++).toBe(1n);
- expect(bigint).toBe(2n);
- expect(bigint--).toBe(2n);
- expect(bigint).toBe(1n);
- expect(++bigint).toBe(2n);
- expect(bigint).toBe(2n);
- expect(--bigint).toBe(1n);
- expect(bigint).toBe(1n);
- });
-
- test("weak equality operators", () => {
- expect(1n == 1n).toBeTrue();
- expect(1n == 1).toBeTrue();
- expect(1 == 1n).toBeTrue();
- expect(1n == 1.23).toBeFalse();
- expect(1.23 == 1n).toBeFalse();
-
- expect(1n != 1n).toBeFalse();
- expect(1n != 1).toBeFalse();
- expect(1 != 1n).toBeFalse();
- expect(1n != 1.23).toBeTrue();
- expect(1.23 != 1n).toBeTrue();
- });
-
- test("strong equality operators", () => {
- expect(1n === 1n).toBeTrue();
- expect(1n === 1).toBeFalse();
- expect(1 === 1n).toBeFalse();
- expect(1n === 1.23).toBeFalse();
- expect(1.23 === 1n).toBeFalse();
-
- expect(1n !== 1n).toBeFalse();
- expect(1n !== 1).toBeTrue();
- expect(1 !== 1n).toBeTrue();
- expect(1n !== 1.23).toBeTrue();
- expect(1.23 !== 1n).toBeTrue();
- });
-});
-
-describe("errors", () => {
- test("conversion to number", () => {
- expect(() => {
- +123n;
- }).toThrowWithMessage(TypeError, "Cannot convert BigInt to number");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/BigInt/bigint-minus.js b/Libraries/LibJS/Tests/builtins/BigInt/bigint-minus.js
deleted file mode 100644
index 5d88f85ce2..0000000000
--- a/Libraries/LibJS/Tests/builtins/BigInt/bigint-minus.js
+++ /dev/null
@@ -1,8 +0,0 @@
-describe("minus behavior", () => {
- test("the basics", () => {
- expect(3n - 4n).toBe(-1n);
- expect(3n - -4n).toBe(7n);
- expect(-3n - -4n).toBe(-1n);
- expect(-3n - 4n).toBe(-7n);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js b/Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js
deleted file mode 100644
index de80b92b3a..0000000000
--- a/Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js
+++ /dev/null
@@ -1,31 +0,0 @@
-const doTest = (operatorName, executeOperation) => {
- [1, null, undefined].forEach(value => {
- const messageSuffix = operatorName === "unsigned right-shift" ? "" : " and other type";
-
- expect(() => {
- executeOperation(1n, value);
- }).toThrowWithMessage(
- TypeError,
- `Cannot use ${operatorName} operator with BigInt${messageSuffix}`
- );
- });
-};
-
-[
- ["addition", (a, b) => a + b],
- ["subtraction", (a, b) => a - b],
- ["multiplication", (a, b) => a * b],
- ["division", (a, b) => a / b],
- ["modulo", (a, b) => a % b],
- ["exponentiation", (a, b) => a ** b],
- ["bitwise OR", (a, b) => a | b],
- ["bitwise AND", (a, b) => a & b],
- ["bitwise XOR", (a, b) => a ^ b],
- ["left-shift", (a, b) => a << b],
- ["right-shift", (a, b) => a >> b],
- ["unsigned right-shift", (a, b) => a >>> b],
-].forEach(testCase => {
- test(`using ${testCase[0]} operator with BigInt and other type`, () => {
- doTest(testCase[0], testCase[1]);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Boolean/Boolean.js b/Libraries/LibJS/Tests/builtins/Boolean/Boolean.js
deleted file mode 100644
index a2cf07b998..0000000000
--- a/Libraries/LibJS/Tests/builtins/Boolean/Boolean.js
+++ /dev/null
@@ -1,32 +0,0 @@
-test("constructor properties", () => {
- expect(Boolean).toHaveLength(1);
- expect(Boolean.name).toBe("Boolean");
-});
-
-test("typeof", () => {
- expect(typeof new Boolean()).toBe("object");
- expect(typeof Boolean()).toBe("boolean");
- expect(typeof Boolean(true)).toBe("boolean");
-});
-
-test("basic functionality", () => {
- var foo = new Boolean(true);
- var bar = new Boolean(true);
-
- expect(foo).not.toBe(bar);
- expect(foo.valueOf()).toBe(bar.valueOf());
-
- expect(Boolean()).toBeFalse();
- expect(Boolean(false)).toBeFalse();
- expect(Boolean(null)).toBeFalse();
- expect(Boolean(undefined)).toBeFalse();
- expect(Boolean(NaN)).toBeFalse();
- expect(Boolean("")).toBeFalse();
- expect(Boolean(0.0)).toBeFalse();
- expect(Boolean(-0.0)).toBeFalse();
- expect(Boolean(true)).toBeTrue();
- expect(Boolean("0")).toBeTrue();
- expect(Boolean({})).toBeTrue();
- expect(Boolean([])).toBeTrue();
- expect(Boolean(1)).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.js b/Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.js
deleted file mode 100644
index d818d91edb..0000000000
--- a/Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.js
+++ /dev/null
@@ -1,5 +0,0 @@
-test("basic functionality", () => {
- expect(typeof Boolean.prototype).toBe("object");
- expect(Boolean.prototype.valueOf()).toBeFalse();
- expect(Boolean.prototype).not.toHaveProperty("length");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.toString.js
deleted file mode 100644
index 506b23feac..0000000000
--- a/Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.toString.js
+++ /dev/null
@@ -1,17 +0,0 @@
-test("basic functionality", () => {
- var foo = true;
- expect(foo.toString()).toBe("true");
- expect(true.toString()).toBe("true");
-
- expect(Boolean.prototype.toString.call(true)).toBe("true");
- expect(Boolean.prototype.toString.call(false)).toBe("false");
-
- expect(new Boolean(true).toString()).toBe("true");
- expect(new Boolean(false).toString()).toBe("false");
-});
-
-test("errors on non-boolean |this|", () => {
- expect(() => {
- Boolean.prototype.toString.call("foo");
- }).toThrowWithMessage(TypeError, "Not a Boolean object");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.valueOf.js b/Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.valueOf.js
deleted file mode 100644
index d510523c5b..0000000000
--- a/Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.valueOf.js
+++ /dev/null
@@ -1,16 +0,0 @@
-test("basic functionality", () => {
- var foo = true;
- expect(foo.valueOf()).toBeTrue();
- expect(true.valueOf()).toBeTrue();
-
- expect(Boolean.prototype.valueOf.call(true)).toBeTrue();
- expect(Boolean.prototype.valueOf.call(false)).toBeFalse();
-
- expect(new Boolean().valueOf()).toBeFalse();
-});
-
-test("errors on non-boolean |this|", () => {
- expect(() => {
- Boolean.prototype.valueOf.call("foo");
- }).toThrowWithMessage(TypeError, "Not a Boolean object");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.UTC.js b/Libraries/LibJS/Tests/builtins/Date/Date.UTC.js
deleted file mode 100644
index d5c8082729..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.UTC.js
+++ /dev/null
@@ -1,51 +0,0 @@
-test("basic functionality", () => {
- expect(Date.UTC(2020)).toBe(1577836800000);
- expect(Date.UTC(2000, 10)).toBe(973036800000);
- expect(Date.UTC(1980, 5, 30)).toBe(331171200000);
- expect(Date.UTC(1980, 5, 30, 13)).toBe(331218000000);
- expect(Date.UTC(1970, 5, 30, 13, 30)).toBe(15600600000);
- expect(Date.UTC(1970, 0, 1, 0, 0, 59)).toBe(59000);
- expect(Date.UTC(1970, 0, 1, 0, 0, 0, 999)).toBe(999);
-
- expect(Date.UTC(1969, 11, 31, 23, 59, 59, 817)).toBe(-183);
-
- expect(Date.UTC(1799, 0)).toBe(-5396198400000);
- expect(Date.UTC(1800, 0)).toBe(-5364662400000);
- expect(Date.UTC(1801, 0)).toBe(-5333126400000);
- expect(Date.UTC(1802, 0)).toBe(-5301590400000);
- expect(Date.UTC(1803, 0)).toBe(-5270054400000);
- expect(Date.UTC(1804, 0)).toBe(-5238518400000);
-
- expect(Date.UTC(1999, 0)).toBe(915148800000);
- expect(Date.UTC(2000, 0)).toBe(946684800000);
- expect(Date.UTC(2001, 0)).toBe(978307200000);
- expect(Date.UTC(2002, 0)).toBe(1009843200000);
- expect(Date.UTC(2003, 0)).toBe(1041379200000);
- expect(Date.UTC(2004, 0)).toBe(1072915200000);
-
- expect(Date.UTC(20000, 0)).toBe(568971820800000);
-});
-
-test("leap year", () => {
- expect(Date.UTC(2020, 2, 1)).toBe(1583020800000);
-});
-
-test("out of range", () => {
- expect(Date.UTC(2020, -20)).toBe(1525132800000);
- expect(Date.UTC(2020, 20)).toBe(1630454400000);
-
- expect(Date.UTC(2020, 1, -10)).toBe(1579564800000);
- expect(Date.UTC(2020, 1, 40)).toBe(1583884800000);
-
- expect(Date.UTC(2020, 1, 15, -50)).toBe(1581544800000);
- expect(Date.UTC(2020, 1, 15, 50)).toBe(1581904800000);
-
- expect(Date.UTC(2020, 1, 15, 12, -123)).toBe(1581760620000);
- expect(Date.UTC(2020, 1, 15, 12, 123)).toBe(1581775380000);
-
- expect(Date.UTC(2020, 1, 15, 12, 30, -123)).toBe(1581769677000);
- expect(Date.UTC(2020, 1, 15, 12, 30, 123)).toBe(1581769923000);
-
- expect(Date.UTC(2020, 1, 15, 12, 30, 30, -2345)).toBe(1581769827655);
- expect(Date.UTC(2020, 1, 15, 12, 30, 30, 2345)).toBe(1581769832345);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.js b/Libraries/LibJS/Tests/builtins/Date/Date.js
deleted file mode 100644
index cc76212e22..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.js
+++ /dev/null
@@ -1,77 +0,0 @@
-test("basic functionality", () => {
- expect(Date).toHaveLength(7);
- expect(Date.name === "Date");
- expect(Date.prototype).not.toHaveProperty("length");
-});
-
-test("string constructor", () => {
- // The string constructor is the same as calling the timestamp constructor with the result of Date.parse(arguments).
- // Since that has exhaustive tests in Date.parse.js, just do some light smoke testing here.
- expect(new Date("2017-09-07T21:08:59.001Z").toISOString()).toBe("2017-09-07T21:08:59.001Z");
-});
-
-test("timestamp constructor", () => {
- // The timestamp constructor takes a timestamp in milliseconds since the start of the epoch, in UTC.
-
- // 50 days and 1234 milliseconds after the start of the epoch.
- // Most Date methods return values in local time, but since timezone offsets are less than 17 days,
- // these checks will pass in all timezones.
- let timestamp = 50 * 24 * 60 * 60 * 1000 + 1234;
-
- let date = new Date(timestamp);
- expect(date.getTime()).toBe(timestamp); // getTime() returns the timestamp in UTC.
- expect(date.getMilliseconds()).toBe(234);
- expect(date.getSeconds()).toBe(1);
- expect(date.getFullYear()).toBe(1970);
- expect(date.getMonth()).toBe(1); // Feb
-});
-
-test("tuple constructor", () => {
- // The tuple constructor takes a date in local time.
- expect(new Date(2019, 11).getFullYear()).toBe(2019);
- expect(new Date(2019, 11).getMonth()).toBe(11);
- expect(new Date(2019, 11).getDate()).toBe(1); // getDay() returns day of week, getDate() returns day in month
- expect(new Date(2019, 11).getHours()).toBe(0);
- expect(new Date(2019, 11).getMinutes()).toBe(0);
- expect(new Date(2019, 11).getSeconds()).toBe(0);
- expect(new Date(2019, 11).getMilliseconds()).toBe(0);
- expect(new Date(2019, 11).getDay()).toBe(0);
-
- let date = new Date(2019, 11, 15, 9, 16, 14, 123); // Note: Month is 0-based.
- expect(date.getFullYear()).toBe(2019);
- expect(date.getMonth()).toBe(11);
- expect(date.getDate()).toBe(15);
- expect(date.getHours()).toBe(9);
- expect(date.getMinutes()).toBe(16);
- expect(date.getSeconds()).toBe(14);
- expect(date.getMilliseconds()).toBe(123);
- expect(date.getDay()).toBe(0);
-
- // getTime() returns a time stamp in UTC, but we can at least check it's in the right interval, which will be true independent of the local timezone if the range is big enough.
- let timestamp_lower_bound = 1575072000000; // 2019-12-01T00:00:00Z
- let timestamp_upper_bound = 1577750400000; // 2019-12-31T00:00:00Z
- expect(date.getTime()).toBeGreaterThan(timestamp_lower_bound);
- expect(date.getTime()).toBeLessThan(timestamp_upper_bound);
-});
-
-test("tuple constructor overflow", () => {
- let date = new Date(2019, 13, 33, 30, 70, 80, 2345);
- expect(date.getFullYear()).toBe(2020);
- expect(date.getMonth()).toBe(2);
- expect(date.getDate()).toBe(5);
- expect(date.getHours()).toBe(7);
- expect(date.getMinutes()).toBe(11);
- expect(date.getSeconds()).toBe(22);
- expect(date.getMilliseconds()).toBe(345);
- expect(date.getDay()).toBe(4);
-
- let date = new Date(2019, -13, -33, -30, -70, -80, -2345);
- expect(date.getFullYear()).toBe(2017);
- expect(date.getMonth()).toBe(9);
- expect(date.getDate()).toBe(26);
- expect(date.getHours()).toBe(16);
- expect(date.getMinutes()).toBe(48);
- expect(date.getSeconds()).toBe(37);
- expect(date.getMilliseconds()).toBe(655);
- expect(date.getDay()).toBe(4);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.now.js b/Libraries/LibJS/Tests/builtins/Date/Date.now.js
deleted file mode 100644
index 46c1b6d8cd..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.now.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- var last = 0;
- for (var i = 0; i < 100; ++i) {
- var now = Date.now();
- expect(now).not.toBeNaN();
- expect(now).toBeGreaterThan(1580000000000);
- expect(now).toBeGreaterThanOrEqual(last);
- last = now;
- }
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.parse.js b/Libraries/LibJS/Tests/builtins/Date/Date.parse.js
deleted file mode 100644
index ca2766ae34..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.parse.js
+++ /dev/null
@@ -1,32 +0,0 @@
-test("basic functionality", () => {
- expect(Date.parse("2020")).toBe(1577836800000);
- expect(Date.parse("2000-11")).toBe(973036800000);
- expect(Date.parse("1980-06-30")).toBe(331171200000);
- expect(Date.parse("1970-06-30T13:30Z")).toBe(15600600000);
- expect(Date.parse("1970-01-01T00:00:59Z")).toBe(59000);
- expect(Date.parse("1970-01-01T00:00:00.999Z")).toBe(999);
- expect(Date.parse("2020T13:14+15:16")).toBe(1577829480000);
- expect(Date.parse("2020T13:14-15:16")).toBe(1577939400000);
- expect(Date.parse("2020T23:59Z")).toBe(1577923140000);
-
- expect(Date.parse("+020000")).toBe(568971820800000);
- expect(Date.parse("+020000-01")).toBe(568971820800000);
- expect(Date.parse("+020000-01T00:00:00.000Z")).toBe(568971820800000);
-
- expect(Date.parse(2020)).toBe(1577836800000);
-
- expect(Date.parse("+1980")).toBe(NaN);
- expect(Date.parse("1980-")).toBe(NaN);
- expect(Date.parse("1980-05-")).toBe(NaN);
- expect(Date.parse("1980-05-00T")).toBe(NaN);
- expect(Date.parse("1980-05-00T15:15:")).toBe(NaN);
- expect(Date.parse("1980-05-00T15:15:15.")).toBe(NaN);
- expect(Date.parse("1980-5-30")).toBe(NaN);
- expect(Date.parse("1980-05-30T13")).toBe(NaN);
- expect(Date.parse("1980-05-30T13:4")).toBe(NaN);
- expect(Date.parse("1980-05-30T13:40+")).toBe(NaN);
- expect(Date.parse("1980-05-30T13:40+1")).toBe(NaN);
- expect(Date.parse("1980-05-30T13:40+1:10")).toBe(NaN);
- expect(Date.parse("1970-06-30T13:30Zoo")).toBe(NaN);
- expect(Date.parse("2020T13:30.40:")).toBe(NaN);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDate.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDate.js
deleted file mode 100644
index 647e43a997..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDate.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- let d = new Date();
- expect(d.getDate()).toBe(d.getDate());
- expect(d.getDate()).not.toBeNaN();
- expect(d.getDate()).toBeGreaterThanOrEqual(1);
- expect(d.getDate()).toBeLessThanOrEqual(31);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDay.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDay.js
deleted file mode 100644
index 534efeeee5..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDay.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getDay()).toBe(d.getDay());
- expect(d.getDay()).not.toBeNaN();
- expect(d.getDay()).toBeGreaterThanOrEqual(0);
- expect(d.getDay()).toBeLessThanOrEqual(6);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getFullYear.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getFullYear.js
deleted file mode 100644
index 3748e835cf..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getFullYear.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getFullYear()).toBe(d.getFullYear());
- expect(d.getFullYear()).not.toBeNaN();
- expect(d.getFullYear()).toBe(d.getFullYear());
- expect(d.getFullYear()).toBeGreaterThanOrEqual(2020);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getHours.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getHours.js
deleted file mode 100644
index 7e562288f2..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getHours.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getHours()).toBe(d.getHours());
- expect(d.getHours()).not.toBeNaN();
- expect(d.getHours()).toBeGreaterThanOrEqual(0);
- expect(d.getHours()).toBeLessThanOrEqual(23);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMilliseconds.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMilliseconds.js
deleted file mode 100644
index 90c686f729..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMilliseconds.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getMilliseconds()).toBe(d.getMilliseconds());
- expect(d.getMilliseconds()).not.toBeNaN();
- expect(d.getMilliseconds()).toBeGreaterThanOrEqual(0);
- expect(d.getMilliseconds()).toBeLessThanOrEqual(999);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMinutes.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMinutes.js
deleted file mode 100644
index 5b87b8251d..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMinutes.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getMinutes()).toBe(d.getMinutes());
- expect(d.getMinutes()).not.toBeNaN();
- expect(d.getMinutes()).toBeGreaterThanOrEqual(0);
- expect(d.getMinutes()).toBeLessThanOrEqual(59);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMonth.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMonth.js
deleted file mode 100644
index 7d52866ce7..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMonth.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getMonth()).toBe(d.getMonth());
- expect(d.getMonth()).not.toBeNaN();
- expect(d.getMonth()).toBeGreaterThanOrEqual(0);
- expect(d.getMonth()).toBeLessThanOrEqual(11);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getSeconds.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getSeconds.js
deleted file mode 100644
index df30881c9a..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getSeconds.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getSeconds()).toBe(d.getSeconds());
- expect(d.getSeconds()).not.toBeNaN();
- expect(d.getSeconds()).toBeGreaterThanOrEqual(0);
- expect(d.getSeconds()).toBeLessThanOrEqual(59);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getTime.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getTime.js
deleted file mode 100644
index b9ada6fcc9..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getTime.js
+++ /dev/null
@@ -1,6 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getTime()).toBe(d.getTime());
- expect(d.getTime()).not.toBeNaN();
- expect(d.getTime()).toBeGreaterThanOrEqual(1580000000000);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCDate.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCDate.js
deleted file mode 100644
index d207385bad..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCDate.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- let d = new Date();
- expect(d.getUTCDate()).toBe(d.getUTCDate());
- expect(d.getUTCDate()).not.toBeNaN();
- expect(d.getUTCDate()).toBeGreaterThanOrEqual(1);
- expect(d.getUTCDate()).toBeLessThanOrEqual(31);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCDay.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCDay.js
deleted file mode 100644
index aec696be4a..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCDay.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getUTCDay()).toBe(d.getUTCDay());
- expect(d.getUTCDay()).not.toBeNaN();
- expect(d.getUTCDay()).toBeGreaterThanOrEqual(0);
- expect(d.getUTCDay()).toBeLessThanOrEqual(6);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCFullYear.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCFullYear.js
deleted file mode 100644
index 50336d8178..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCFullYear.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getUTCFullYear()).toBe(d.getUTCFullYear());
- expect(d.getUTCFullYear()).not.toBeNaN();
- expect(d.getUTCFullYear()).toBe(d.getUTCFullYear());
- expect(d.getUTCFullYear()).toBeGreaterThanOrEqual(2020);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCHours.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCHours.js
deleted file mode 100644
index 298ed178e5..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCHours.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getUTCHours()).toBe(d.getUTCHours());
- expect(d.getUTCHours()).not.toBeNaN();
- expect(d.getUTCHours()).toBeGreaterThanOrEqual(0);
- expect(d.getUTCHours()).toBeLessThanOrEqual(23);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMilliseconds.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMilliseconds.js
deleted file mode 100644
index f53ea70428..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMilliseconds.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getUTCMilliseconds()).toBe(d.getUTCMilliseconds());
- expect(d.getUTCMilliseconds()).not.toBeNaN();
- expect(d.getUTCMilliseconds()).toBeGreaterThanOrEqual(0);
- expect(d.getUTCMilliseconds()).toBeLessThanOrEqual(999);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMinutes.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMinutes.js
deleted file mode 100644
index 6b1146331c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMinutes.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getUTCMinutes()).toBe(d.getUTCMinutes());
- expect(d.getUTCMinutes()).not.toBeNaN();
- expect(d.getUTCMinutes()).toBeGreaterThanOrEqual(0);
- expect(d.getUTCMinutes()).toBeLessThanOrEqual(59);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMonth.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMonth.js
deleted file mode 100644
index ed6ed64d97..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCMonth.js
+++ /dev/null
@@ -1,26 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getUTCMonth()).toBe(d.getUTCMonth());
- expect(d.getUTCMonth()).not.toBeNaN();
- expect(d.getUTCMonth()).toBeGreaterThanOrEqual(0);
- expect(d.getUTCMonth()).toBeLessThanOrEqual(11);
-
- expect(new Date(Date.UTC(2020, 11)).getUTCMonth()).toBe(11);
-});
-
-test("leap years", () => {
- expect(new Date(Date.UTC(2019, 1, 29)).getUTCDate()).toBe(1);
- expect(new Date(Date.UTC(2019, 1, 29)).getUTCMonth()).toBe(2);
- expect(new Date(Date.UTC(2100, 1, 29)).getUTCDate()).toBe(1);
- expect(new Date(Date.UTC(2100, 1, 29)).getUTCMonth()).toBe(2);
-
- expect(new Date(Date.UTC(2000, 1, 29)).getUTCDate()).toBe(29);
- expect(new Date(Date.UTC(2000, 1, 29)).getUTCMonth()).toBe(1);
- expect(new Date(Date.UTC(2020, 1, 29)).getUTCDate()).toBe(29);
- expect(new Date(Date.UTC(2020, 1, 29)).getUTCMonth()).toBe(1);
-
- expect(new Date(Date.UTC(2019, 2, 1)).getUTCDate()).toBe(1);
- expect(new Date(Date.UTC(2019, 2, 1)).getUTCMonth()).toBe(2);
- expect(new Date(Date.UTC(2020, 2, 1)).getUTCDate()).toBe(1);
- expect(new Date(Date.UTC(2020, 2, 1)).getUTCMonth()).toBe(2);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCSeconds.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCSeconds.js
deleted file mode 100644
index d087a3c4c8..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.getUTCSeconds.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- var d = new Date();
- expect(d.getUTCSeconds()).toBe(d.getUTCSeconds());
- expect(d.getUTCSeconds()).not.toBeNaN();
- expect(d.getUTCSeconds()).toBeGreaterThanOrEqual(0);
- expect(d.getUTCSeconds()).toBeLessThanOrEqual(59);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toISOString.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toISOString.js
deleted file mode 100644
index 2b380fc24d..0000000000
--- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toISOString.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- expect(new Date(1597955034555).toISOString()).toBe("2020-08-20T20:23:54.555Z");
- expect(new Date(Date.UTC(22020)).toISOString()).toBe("+022020-01-01T00:00:00.000Z");
- expect(new Date(Date.UTC(1950)).toISOString()).toBe("1950-01-01T00:00:00.000Z");
- expect(new Date(Date.UTC(1800)).toISOString()).toBe("1800-01-01T00:00:00.000Z");
- expect(new Date(Date.UTC(-100)).toISOString()).toBe("-000100-01-01T00:00:00.000Z");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Error/Error.js b/Libraries/LibJS/Tests/builtins/Error/Error.js
deleted file mode 100644
index a452bd7a88..0000000000
--- a/Libraries/LibJS/Tests/builtins/Error/Error.js
+++ /dev/null
@@ -1,18 +0,0 @@
-test("basic functionality", () => {
- expect(Error).toHaveLength(1);
- expect(Error.name).toBe("Error");
-});
-
-test("name", () => {
- [Error(), Error(undefined), Error("test"), Error(42), Error(null)].forEach(error => {
- expect(error.name).toBe("Error");
- });
-});
-
-test("message", () => {
- expect(Error().message).toBe("");
- expect(Error(undefined).message).toBe("");
- expect(Error("test").message).toBe("test");
- expect(Error(42).message).toBe("42");
- expect(Error(null).message).toBe("null");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Error/Error.prototype.name.js b/Libraries/LibJS/Tests/builtins/Error/Error.prototype.name.js
deleted file mode 100644
index acfcb039fb..0000000000
--- a/Libraries/LibJS/Tests/builtins/Error/Error.prototype.name.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- expect(Error.prototype).not.toHaveProperty("length");
-
- var changedInstance = new Error("");
- changedInstance.name = "NewCustomError";
- expect(changedInstance.name).toBe("NewCustomError");
-
- var normalInstance = new Error("");
- expect(normalInstance.name).toBe("Error");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Error/Error.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Error/Error.prototype.toString.js
deleted file mode 100644
index b5d2f7dceb..0000000000
--- a/Libraries/LibJS/Tests/builtins/Error/Error.prototype.toString.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- expect(Error().toString()).toBe("Error");
- expect(Error(undefined).toString()).toBe("Error");
- expect(Error(null).toString()).toBe("Error: null");
- expect(Error("test").toString()).toBe("Error: test");
- expect(Error(42).toString()).toBe("Error: 42");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Function/Function.js b/Libraries/LibJS/Tests/builtins/Function/Function.js
deleted file mode 100644
index 9a972ab81d..0000000000
--- a/Libraries/LibJS/Tests/builtins/Function/Function.js
+++ /dev/null
@@ -1,53 +0,0 @@
-describe("correct behavior", () => {
- test("constructor properties", () => {
- expect(Function).toHaveLength(1);
- expect(Function.name).toBe("Function");
- expect(Function.prototype).toHaveLength(0);
- expect(Function.prototype.name).toBe("");
- });
-
- test("typeof", () => {
- expect(typeof Function()).toBe("function");
- expect(typeof new Function()).toBe("function");
- });
-
- test("basic functionality", () => {
- expect(Function()()).toBeUndefined();
- expect(new Function()()).toBeUndefined();
- expect(Function("return 42")()).toBe(42);
- expect(new Function("return 42")()).toBe(42);
- expect(new Function("foo", "return foo")(42)).toBe(42);
- expect(new Function("foo,bar", "return foo + bar")(1, 2)).toBe(3);
- expect(new Function("foo", "bar", "return foo + bar")(1, 2)).toBe(3);
- expect(new Function("foo", "bar,baz", "return foo + bar + baz")(1, 2, 3)).toBe(6);
- expect(new Function("foo", "bar", "baz", "return foo + bar + baz")(1, 2, 3)).toBe(6);
- expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(true)).toBe(
- 42
- );
- expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(false)).toBe(
- "bar"
- );
- expect(new Function("return typeof Function()")()).toBe("function");
- expect(new Function("x", "return function (y) { return x + y };")(1)(2)).toBe(3);
-
- expect(new Function("-->")()).toBeUndefined();
-
- expect(new Function().name).toBe("anonymous");
- expect(new Function().toString()).toBe("function anonymous() {\n ???\n}");
- });
-});
-
-describe("errors", () => {
- test("syntax error", () => {
- expect(() => {
- new Function("[");
- })
- // This might be confusing at first but keep in mind it's actually parsing
- // function anonymous() { [ }
- // This is in line with what other engines are reporting.
- .toThrowWithMessage(
- SyntaxError,
- "Unexpected token CurlyClose. Expected BracketClose (line: 4, column: 1)"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.@@hasInstance.js b/Libraries/LibJS/Tests/builtins/Function/Function.prototype.@@hasInstance.js
deleted file mode 100644
index d548a635fe..0000000000
--- a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.@@hasInstance.js
+++ /dev/null
@@ -1,8 +0,0 @@
-test("basic functionality", () => {
- expect(Function.prototype[Symbol.hasInstance]).toHaveLength(1);
-
- function Foo() {}
- const foo = new Foo();
-
- expect(Function.prototype[Symbol.hasInstance].call(Foo, foo)).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.apply.js b/Libraries/LibJS/Tests/builtins/Function/Function.prototype.apply.js
deleted file mode 100644
index 1c57e4a657..0000000000
--- a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.apply.js
+++ /dev/null
@@ -1,51 +0,0 @@
-test("basic functionality", () => {
- function Foo(arg) {
- this.foo = arg;
- }
- function Bar(arg) {
- this.bar = arg;
- }
- function FooBar(arg) {
- Foo.apply(this, [arg]);
- Bar.apply(this, [arg]);
- }
- function FooBarBaz(arg) {
- Foo.apply(this, [arg]);
- Bar.apply(this, [arg]);
- this.baz = arg;
- }
-
- expect(Function.prototype.apply).toHaveLength(2);
-
- var foo = new Foo("test");
- expect(foo.foo).toBe("test");
- expect(foo.bar).toBeUndefined();
- expect(foo.baz).toBeUndefined();
-
- var bar = new Bar("test");
- expect(bar.foo).toBeUndefined();
- expect(bar.bar).toBe("test");
- expect(bar.baz).toBeUndefined();
-
- var foobar = new FooBar("test");
- expect(foobar.foo).toBe("test");
- expect(foobar.bar).toBe("test");
- expect(foobar.baz).toBeUndefined();
-
- var foobarbaz = new FooBarBaz("test");
- expect(foobarbaz.foo).toBe("test");
- expect(foobarbaz.bar).toBe("test");
- expect(foobarbaz.baz).toBe("test");
-
- expect(Math.abs.apply(null, [-1])).toBe(1);
-
- var add = (x, y) => x + y;
- expect(add.apply(null, [1, 2])).toBe(3);
-
- var multiply = function (x, y) {
- return x * y;
- };
- expect(multiply.apply(null, [3, 4])).toBe(12);
-
- expect((() => this).apply("foo")).toBe(globalThis);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.bind.js b/Libraries/LibJS/Tests/builtins/Function/Function.prototype.bind.js
deleted file mode 100644
index 1bd5269f1d..0000000000
--- a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.bind.js
+++ /dev/null
@@ -1,149 +0,0 @@
-describe("basic behavior", () => {
- test("basic binding", () => {
- expect(Function.prototype.bind).toHaveLength(1);
-
- var charAt = String.prototype.charAt.bind("bar");
- expect(charAt(0) + charAt(1) + charAt(2)).toBe("bar");
-
- function getB() {
- return this.toUpperCase().charAt(0);
- }
- expect(getB.bind("bar")()).toBe("B");
- });
-
- test("bound functions work with array functions", () => {
- var Make3 = Number.bind(null, 3);
- expect([55].map(Make3)[0]).toBe(3);
-
- var MakeTrue = Boolean.bind(null, true);
-
- expect([1, 2, 3].filter(MakeTrue)).toHaveLength(3);
- expect(
- [1, 2, 3].reduce(
- function (acc, x) {
- return acc + x;
- }.bind(null, 4, 5)
- )
- ).toBe(9);
- expect(
- [1, 2, 3].reduce(
- function (acc, x) {
- return acc + x + this;
- }.bind(3)
- )
- ).toBe(12);
- });
-});
-
-describe("bound function arguments", () => {
- function sum(a, b, c) {
- return a + b + c;
- }
- var boundSum = sum.bind(null, 10, 5);
-
- test("arguments are bound to the function", () => {
- expect(boundSum()).toBeNaN();
- expect(boundSum(5)).toBe(20);
- expect(boundSum(5, 6, 7)).toBe(20);
- });
-
- test("arguments are appended to a BoundFunction's bound arguments", () => {
- expect(boundSum.bind(null, 5)()).toBe(20);
- });
-
- test("binding a constructor's arguments", () => {
- var Make5 = Number.bind(null, 5);
- expect(Make5()).toBe(5);
- expect(new Make5().valueOf()).toBe(5);
- });
-
- test("length property", () => {
- expect(sum).toHaveLength(3);
- expect(boundSum).toHaveLength(1);
- expect(boundSum.bind(null, 5)).toHaveLength(0);
- expect(boundSum.bind(null, 5, 6, 7, 8)).toHaveLength(0);
- });
-});
-
-describe("bound function |this|", () => {
- function identity() {
- return this;
- }
-
- test("captures global object as |this| if |this| is null or undefined", () => {
- expect(identity.bind()()).toBe(globalThis);
- expect(identity.bind(null)()).toBe(globalThis);
- expect(identity.bind(undefined)()).toBe(globalThis);
-
- function Foo() {
- expect(identity.bind()()).toBe(globalThis);
- expect(identity.bind(this)()).toBe(this);
- }
- new Foo();
- });
-
- test("does not capture global object as |this| if |this| is null or undefined in strict mode", () => {
- "use strict";
-
- function strictIdentity() {
- return this;
- }
-
- expect(strictIdentity.bind()()).toBeUndefined();
- expect(strictIdentity.bind(null)()).toBeNull();
- expect(strictIdentity.bind(undefined)()).toBeUndefined();
- });
-
- test("primitive |this| values are converted to objects", () => {
- expect(identity.bind("foo")()).toBeInstanceOf(String);
- expect(identity.bind(123)()).toBeInstanceOf(Number);
- expect(identity.bind(true)()).toBeInstanceOf(Boolean);
- });
-
- test("bound functions retain |this| values passed to them", () => {
- var obj = { foo: "bar" };
- expect(identity.bind(obj)()).toBe(obj);
- });
-
- test("bound |this| cannot be changed after being set", () => {
- expect(identity.bind("foo").bind(123)()).toBeInstanceOf(String);
- });
-
- test("arrow functions cannot be bound", () => {
- expect((() => this).bind("foo")()).toBe(globalThis);
- });
-});
-
-describe("bound function constructors", () => {
- function Bar() {
- this.x = 3;
- this.y = 4;
- }
-
- Bar.prototype.baz = "baz";
- var BoundBar = Bar.bind({ u: 5, v: 6 });
- var bar = new BoundBar();
-
- test("bound |this| value does not affect constructor", () => {
- expect(bar.x).toBe(3);
- expect(bar.y).toBe(4);
- expect(typeof bar.u).toBe("undefined");
- expect(typeof bar.v).toBe("undefined");
- });
-
- test("bound functions retain original prototype", () => {
- expect(bar.baz).toBe("baz");
- });
-
- test("bound functions do not have a prototype property", () => {
- expect(BoundBar).not.toHaveProperty("prototype");
- });
-});
-
-describe("errors", () => {
- test("does not accept non-function values", () => {
- expect(() => {
- Function.prototype.bind.call("foo");
- }).toThrowWithMessage(TypeError, "Not a Function object");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.call.js b/Libraries/LibJS/Tests/builtins/Function/Function.prototype.call.js
deleted file mode 100644
index 136f69b2bd..0000000000
--- a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.call.js
+++ /dev/null
@@ -1,53 +0,0 @@
-test("length", () => {
- expect(Function.prototype.call).toHaveLength(1);
-});
-
-test("basic functionality", () => {
- function Foo(arg) {
- this.foo = arg;
- }
- function Bar(arg) {
- this.bar = arg;
- }
- function FooBar(arg) {
- Foo.call(this, arg);
- Bar.call(this, arg);
- }
- function FooBarBaz(arg) {
- Foo.call(this, arg);
- Bar.call(this, arg);
- this.baz = arg;
- }
-
- var foo = new Foo("test");
- expect(foo.foo).toBe("test");
- expect(foo.bar).toBeUndefined();
- expect(foo.baz).toBeUndefined();
-
- var bar = new Bar("test");
- expect(bar.foo).toBeUndefined();
- expect(bar.bar).toBe("test");
- expect(bar.baz).toBeUndefined();
-
- var foobar = new FooBar("test");
- expect(foobar.foo).toBe("test");
- expect(foobar.bar).toBe("test");
- expect(foobar.baz).toBeUndefined();
-
- var foobarbaz = new FooBarBaz("test");
- expect(foobarbaz.foo).toBe("test");
- expect(foobarbaz.bar).toBe("test");
- expect(foobarbaz.baz).toBe("test");
-
- expect(Math.abs.call(null, -1)).toBe(1);
-
- var add = (x, y) => x + y;
- expect(add.call(null, 1, 2)).toBe(3);
-
- var multiply = function (x, y) {
- return x * y;
- };
- expect(multiply.call(null, 3, 4)).toBe(12);
-
- expect((() => this).call("foo")).toBe(globalThis);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js
deleted file mode 100644
index a8ed197930..0000000000
--- a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js
+++ /dev/null
@@ -1,17 +0,0 @@
-test("basic functionality", () => {
- expect(function () {}.toString()).toBe("function () {\n ???\n}");
- expect(function (foo) {}.toString()).toBe("function (foo) {\n ???\n}");
- expect(function (foo, bar, baz) {}.toString()).toBe("function (foo, bar, baz) {\n ???\n}");
- expect(
- function (foo, bar, baz) {
- if (foo) {
- return baz;
- } else if (bar) {
- return foo;
- }
- return bar + 42;
- }.toString()
- ).toBe("function (foo, bar, baz) {\n ???\n}");
- expect(console.debug.toString()).toBe("function debug() {\n [NativeFunction]\n}");
- expect(Function.toString()).toBe("function Function() {\n [FunctionConstructor]\n}");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Infinity/Infinity.js b/Libraries/LibJS/Tests/builtins/Infinity/Infinity.js
deleted file mode 100644
index 0c88544f7f..0000000000
--- a/Libraries/LibJS/Tests/builtins/Infinity/Infinity.js
+++ /dev/null
@@ -1,22 +0,0 @@
-test("basic functionality", () => {
- expect(Infinity + "").toBe("Infinity");
- expect(-Infinity + "").toBe("-Infinity");
- expect(Infinity).toBe(Infinity);
- expect(Infinity - 1).toBe(Infinity);
- expect(Infinity + 1).toBe(Infinity);
- expect(-Infinity).toBe(-Infinity);
- expect(-Infinity - 1).toBe(-Infinity);
- expect(-Infinity + 1).toBe(-Infinity);
- expect(1 / Infinity).toBe(0);
- expect(1 / -Infinity).toBe(-0);
- expect(1 / 0).toBe(Infinity);
- expect(-1 / 0).toBe(-Infinity);
- expect(-100).toBeLessThan(Infinity);
- expect(0).toBeLessThan(Infinity);
- expect(100).toBeLessThan(Infinity);
- expect(-Infinity).toBeLessThan(Infinity);
- expect(-100).toBeGreaterThan(-Infinity);
- expect(0).toBeGreaterThan(-Infinity);
- expect(100).toBeGreaterThan(-Infinity);
- expect(Infinity).toBeGreaterThan(-Infinity);
-});
diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.@@toStringTag.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.@@toStringTag.js
deleted file mode 100644
index 5a1e51f7c6..0000000000
--- a/Libraries/LibJS/Tests/builtins/JSON/JSON.@@toStringTag.js
+++ /dev/null
@@ -1,4 +0,0 @@
-test("basic functionality", () => {
- expect(JSON[Symbol.toStringTag]).toBe("JSON");
- expect(JSON.toString()).toBe("[object JSON]");
-});
diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js
deleted file mode 100644
index 4044e0200a..0000000000
--- a/Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js
+++ /dev/null
@@ -1,11 +0,0 @@
-test("basic functionality", () => {
- let string = `{"var1":10,"var2":"hello","var3":{"nested":5}}`;
-
- let object = JSON.parse(string, (key, value) =>
- typeof value === "number" ? value * 2 : value
- );
- expect(object).toEqual({ var1: 20, var2: "hello", var3: { nested: 10 } });
-
- object = JSON.parse(string, (key, value) => (typeof value === "number" ? undefined : value));
- expect(object).toEqual({ var2: "hello", var3: {} });
-});
diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.parse.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.parse.js
deleted file mode 100644
index 7f82392666..0000000000
--- a/Libraries/LibJS/Tests/builtins/JSON/JSON.parse.js
+++ /dev/null
@@ -1,37 +0,0 @@
-test("basic functionality", () => {
- expect(JSON.parse).toHaveLength(2);
-
- const properties = [
- ["5", 5],
- ["null", null],
- ["true", true],
- ["false", false],
- ['"test"', "test"],
- ['[1,2,"foo"]', [1, 2, "foo"]],
- ['{"foo":1,"bar":"baz"}', { foo: 1, bar: "baz" }],
- ];
-
- properties.forEach(testCase => {
- expect(JSON.parse(testCase[0])).toEqual(testCase[1]);
- });
-});
-
-test("syntax errors", () => {
- [
- undefined,
- NaN,
- -NaN,
- Infinity,
- -Infinity,
- '{ "foo" }',
- '{ foo: "bar" }',
- "[1,2,3,]",
- "[1,2,3, ]",
- '{ "foo": "bar",}',
- '{ "foo": "bar", }',
- ].forEach(test => {
- expect(() => {
- JSON.parse(test);
- }).toThrow(SyntaxError);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-exception-in-property-getter.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-exception-in-property-getter.js
deleted file mode 100644
index 18845f842b..0000000000
--- a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-exception-in-property-getter.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("Issue #3548, exception in property getter with replacer function", () => {
- const o = {
- get foo() {
- throw Error();
- },
- };
- expect(() => {
- JSON.stringify(o, (_, value) => value);
- }).toThrow(Error);
-});
diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js
deleted file mode 100644
index 3c2c8e3161..0000000000
--- a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js
+++ /dev/null
@@ -1,30 +0,0 @@
-test("basic functionality", () => {
- let o = {
- key1: "key1",
- key2: "key2",
- key3: "key3",
- };
-
- Object.defineProperty(o, "defined", {
- enumerable: true,
- get() {
- o.prop = "prop";
- return "defined";
- },
- });
-
- o.key4 = "key4";
-
- o[2] = 2;
- o[0] = 0;
- o[1] = 1;
-
- delete o.key1;
- delete o.key3;
-
- o.key1 = "key1";
-
- expect(JSON.stringify(o)).toBe(
- '{"0":0,"1":1,"2":2,"key2":"key2","defined":"defined","key4":"key4","key1":"key1"}'
- );
-});
diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-proxy.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-proxy.js
deleted file mode 100644
index eb4f4c85e8..0000000000
--- a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-proxy.js
+++ /dev/null
@@ -1,11 +0,0 @@
-test("basic functionality", () => {
- let p = new Proxy([], {
- get(_, key) {
- if (key === "length") return 3;
- return Number(key);
- },
- });
-
- expect(JSON.stringify(p)).toBe("[0,1,2]");
- expect(JSON.stringify([[new Proxy(p, {})]])).toBe("[[[0,1,2]]]");
-});
diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js
deleted file mode 100644
index 156edffee7..0000000000
--- a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js
+++ /dev/null
@@ -1,38 +0,0 @@
-test("basic functionality", () => {
- let o = {
- var1: "foo",
- var2: 42,
- arr: [
- 1,
- 2,
- {
- nested: {
- hello: "world",
- },
- get x() {
- return 10;
- },
- },
- ],
- obj: {
- subarr: [3],
- },
- };
-
- let string = JSON.stringify(o, (key, value) => {
- if (key === "hello") return undefined;
- if (value === 10) return 20;
- if (key === "subarr") return [3, 4, 5];
- return value;
- });
-
- expect(string).toBe(
- '{"var1":"foo","var2":42,"arr":[1,2,{"nested":{},"x":20}],"obj":{"subarr":[3,4,5]}}'
- );
-
- string = JSON.stringify(o, ["var1", "var1", "var2", "obj"]);
- expect(string).toBe('{"var1":"foo","var2":42,"obj":{}}');
-
- string = JSON.stringify(o, ["var1", "var1", "var2", "obj", "subarr"]);
- expect(string).toBe('{"var1":"foo","var2":42,"obj":{"subarr":[3]}}');
-});
diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-space.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-space.js
deleted file mode 100644
index 75873367bf..0000000000
--- a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-space.js
+++ /dev/null
@@ -1,47 +0,0 @@
-test("basic functionality", () => {
- let o = {
- foo: 1,
- bar: "baz",
- qux: {
- get x() {
- return 10;
- },
- y() {
- return 20;
- },
- arr: [1, 2, 3],
- },
- };
-
- let string = JSON.stringify(o, null, 4);
- let expected = `{
- "foo": 1,
- "bar": "baz",
- "qux": {
- "x": 10,
- "arr": [
- 1,
- 2,
- 3
- ]
- }
-}`;
-
- expect(string).toBe(expected);
-
- string = JSON.stringify(o, null, "abcd");
- expected = `{
-abcd"foo": 1,
-abcd"bar": "baz",
-abcd"qux": {
-abcdabcd"x": 10,
-abcdabcd"arr": [
-abcdabcdabcd1,
-abcdabcdabcd2,
-abcdabcdabcd3
-abcdabcd]
-abcd}
-}`;
-
- expect(string).toBe(expected);
-});
diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify.js
deleted file mode 100644
index 1e5c174312..0000000000
--- a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify.js
+++ /dev/null
@@ -1,71 +0,0 @@
-describe("correct behavior", () => {
- test("length", () => {
- expect(JSON.stringify).toHaveLength(3);
- });
-
- test("basic functionality", () => {
- [
- [5, "5"],
- [undefined, undefined],
- [null, "null"],
- [NaN, "null"],
- [-NaN, "null"],
- [Infinity, "null"],
- [-Infinity, "null"],
- [true, "true"],
- [false, "false"],
- ["test", '"test"'],
- [new Number(5), "5"],
- [new Boolean(false), "false"],
- [new String("test"), '"test"'],
- [() => {}, undefined],
- [[1, 2, "foo"], '[1,2,"foo"]'],
- [{ foo: 1, bar: "baz", qux() {} }, '{"foo":1,"bar":"baz"}'],
- [
- {
- var1: 1,
- var2: 2,
- toJSON(key) {
- let o = this;
- o.var2 = 10;
- return o;
- },
- },
- '{"var1":1,"var2":10}',
- ],
- ].forEach(testCase => {
- expect(JSON.stringify(testCase[0])).toEqual(testCase[1]);
- });
- });
-
- test("ignores non-enumerable properties", () => {
- let o = { foo: "bar" };
- Object.defineProperty(o, "baz", { value: "qux", enumerable: false });
- expect(JSON.stringify(o)).toBe('{"foo":"bar"}');
- });
-});
-
-describe("errors", () => {
- test("cannot serialize BigInt", () => {
- expect(() => {
- JSON.stringify(5n);
- }).toThrow(TypeError, "Cannot serialize BigInt value to JSON");
- });
-
- test("cannot serialize circular structures", () => {
- let bad1 = {};
- bad1.foo = bad1;
- let bad2 = [];
- bad2[5] = [[[bad2]]];
-
- let bad3a = { foo: "bar" };
- let bad3b = [1, 2, bad3a];
- bad3a.bad = bad3b;
-
- [bad1, bad2, bad3a].forEach(bad => {
- expect(() => {
- JSON.stringify(bad);
- }).toThrow(TypeError, "Cannot stringify circular object");
- });
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math-constants.js b/Libraries/LibJS/Tests/builtins/Math/Math-constants.js
deleted file mode 100644
index f8c75c269b..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math-constants.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- expect(Math.E).toBeCloseTo(2.718281);
- expect(Math.LN2).toBeCloseTo(0.693147);
- expect(Math.LN10).toBeCloseTo(2.302585);
- expect(Math.LOG2E).toBeCloseTo(1.442695);
- expect(Math.LOG10E).toBeCloseTo(0.434294);
- expect(Math.PI).toBeCloseTo(3.1415926);
- expect(Math.SQRT1_2).toBeCloseTo(0.707106);
- expect(Math.SQRT2).toBeCloseTo(1.414213);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.@@toStringTag.js b/Libraries/LibJS/Tests/builtins/Math/Math.@@toStringTag.js
deleted file mode 100644
index 69815a1499..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.@@toStringTag.js
+++ /dev/null
@@ -1,4 +0,0 @@
-test("basic functionality", () => {
- expect(Math[Symbol.toStringTag]).toBe("Math");
- expect(Math.toString()).toBe("[object Math]");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.abs.js b/Libraries/LibJS/Tests/builtins/Math/Math.abs.js
deleted file mode 100644
index a43482c28f..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.abs.js
+++ /dev/null
@@ -1,14 +0,0 @@
-test("basic functionality", () => {
- expect(Math.abs).toHaveLength(1);
-
- expect(Math.abs("-1")).toBe(1);
- expect(Math.abs(-2)).toBe(2);
- expect(Math.abs(null)).toBe(0);
- expect(Math.abs("")).toBe(0);
- expect(Math.abs([])).toBe(0);
- expect(Math.abs([2])).toBe(2);
- expect(Math.abs([1, 2])).toBeNaN();
- expect(Math.abs({})).toBeNaN();
- expect(Math.abs("string")).toBeNaN();
- expect(Math.abs()).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.acosh.js b/Libraries/LibJS/Tests/builtins/Math/Math.acosh.js
deleted file mode 100644
index 11d16aabeb..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.acosh.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("basic functionality", () => {
- expect(Math.acosh).toHaveLength(1);
-
- expect(Math.acosh(-1)).toBeNaN();
- expect(Math.acosh(0)).toBeNaN();
- expect(Math.acosh(0.5)).toBeNaN();
- expect(Math.acosh(1)).toBeCloseTo(0);
- expect(Math.acosh(2)).toBeCloseTo(1.316957);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.asin.js b/Libraries/LibJS/Tests/builtins/Math/Math.asin.js
deleted file mode 100644
index 928ce7be5c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.asin.js
+++ /dev/null
@@ -1,15 +0,0 @@
-test("basic functionality", () => {
- expect(Math.asin).toHaveLength(1);
-
- expect(Math.asin(0)).toBe(0);
- expect(Math.asin(null)).toBe(0);
- expect(Math.asin("")).toBe(0);
- expect(Math.asin([])).toBe(0);
- // FIXME(LibM): expect(Math.asin(1)).toBeCloseTo(1.5707963267948966);
- // FIXME(LibM): expect(Math.asin(-1)).toBeCloseTo(-1.5707963267948966);
- expect(Math.asin()).toBeNaN();
- expect(Math.asin(undefined)).toBeNaN();
- expect(Math.asin([1, 2, 3])).toBeNaN();
- expect(Math.asin({})).toBeNaN();
- expect(Math.asin("foo")).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.asinh.js b/Libraries/LibJS/Tests/builtins/Math/Math.asinh.js
deleted file mode 100644
index f52f6c2d0b..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.asinh.js
+++ /dev/null
@@ -1,6 +0,0 @@
-test("basic functionality", () => {
- expect(Math.asinh).toHaveLength(1);
-
- expect(Math.asinh(0)).toBeCloseTo(0);
- expect(Math.asinh(1)).toBeCloseTo(0.881373);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.atan.js b/Libraries/LibJS/Tests/builtins/Math/Math.atan.js
deleted file mode 100644
index ff526fa367..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.atan.js
+++ /dev/null
@@ -1,12 +0,0 @@
-test("basic functionality", () => {
- expect(Math.atan).toHaveLength(1);
-
- expect(Math.atan(0)).toBe(0);
- expect(Math.atan(-0)).toBe(-0);
- expect(Math.atan(NaN)).toBeNaN();
- expect(Math.atan(-2)).toBeCloseTo(-1.1071487177940904);
- expect(Math.atan(2)).toBeCloseTo(1.1071487177940904);
- expect(Math.atan(Infinity)).toBeCloseTo(Math.PI / 2);
- expect(Math.atan(-Infinity)).toBeCloseTo(-Math.PI / 2);
- expect(Math.atan(0.5)).toBeCloseTo(0.4636476090008061);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.atan2.js b/Libraries/LibJS/Tests/builtins/Math/Math.atan2.js
deleted file mode 100644
index 106fee51cc..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.atan2.js
+++ /dev/null
@@ -1,28 +0,0 @@
-test("basic functionality", () => {
- expect(Math.atan2).toHaveLength(2);
-
- expect(Math.atan2(90, 15)).toBeCloseTo(1.4056476493802699);
- expect(Math.atan2(15, 90)).toBeCloseTo(0.16514867741462683);
- expect(Math.atan2(+0, -0)).toBeCloseTo(Math.PI);
- expect(Math.atan2(-0, -0)).toBeCloseTo(-Math.PI);
- expect(Math.atan2(+0, +0)).toBe(0);
- expect(Math.atan2(-0, +0)).toBe(-0);
- expect(Math.atan2(+0, -1)).toBeCloseTo(Math.PI);
- expect(Math.atan2(-0, -1)).toBeCloseTo(-Math.PI);
- expect(Math.atan2(+0, 1)).toBe(0);
- expect(Math.atan2(-0, 1)).toBe(-0);
- expect(Math.atan2(-1, +0)).toBeCloseTo(-Math.PI / 2);
- expect(Math.atan2(-1, -0)).toBeCloseTo(-Math.PI / 2);
- expect(Math.atan2(1, +0)).toBeCloseTo(Math.PI / 2);
- expect(Math.atan2(1, -0)).toBeCloseTo(Math.PI / 2);
- expect(Math.atan2(1, -Infinity)).toBeCloseTo(Math.PI);
- expect(Math.atan2(-1, -Infinity)).toBeCloseTo(-Math.PI);
- expect(Math.atan2(1, +Infinity)).toBe(0);
- expect(Math.atan2(-1, +Infinity)).toBe(-0);
- expect(Math.atan2(+Infinity, 1)).toBeCloseTo(Math.PI / 2);
- expect(Math.atan2(-Infinity, 1)).toBeCloseTo(-Math.PI / 2);
- expect(Math.atan2(+Infinity, -Infinity)).toBeCloseTo((3 * Math.PI) / 4);
- expect(Math.atan2(-Infinity, -Infinity)).toBeCloseTo((-3 * Math.PI) / 4);
- expect(Math.atan2(+Infinity, +Infinity)).toBeCloseTo(Math.PI / 4);
- expect(Math.atan2(-Infinity, +Infinity)).toBeCloseTo(-Math.PI / 4);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.atanh.js b/Libraries/LibJS/Tests/builtins/Math/Math.atanh.js
deleted file mode 100644
index 54c8f5c54e..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.atanh.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- expect(Math.atanh).toHaveLength(1);
-
- expect(Math.atanh(-2)).toBeNaN();
- expect(Math.atanh(2)).toBeNaN();
- expect(Math.atanh(-1)).toBe(-Infinity);
- expect(Math.atanh(0)).toBe(0);
- expect(Math.atanh(0.5)).toBeCloseTo(0.549306);
- expect(Math.atanh(1)).toBe(Infinity);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.cbrt.js b/Libraries/LibJS/Tests/builtins/Math/Math.cbrt.js
deleted file mode 100644
index 414016a7af..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.cbrt.js
+++ /dev/null
@@ -1,12 +0,0 @@
-test("basic functionality", () => {
- expect(Math.cbrt).toHaveLength(1);
-
- expect(Math.cbrt(NaN)).toBeNaN();
- expect(Math.cbrt(-1)).toBe(-1);
- expect(Math.cbrt(-0)).toBe(-0);
- expect(Math.cbrt(-Infinity)).toBe(-Infinity);
- expect(Math.cbrt(1)).toBe(1);
- expect(Math.cbrt(Infinity)).toBe(Infinity);
- expect(Math.cbrt(null)).toBe(0);
- expect(Math.cbrt(2)).toBeCloseTo(1.259921);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.ceil.js b/Libraries/LibJS/Tests/builtins/Math/Math.ceil.js
deleted file mode 100644
index 93e35babca..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.ceil.js
+++ /dev/null
@@ -1,13 +0,0 @@
-test("basic functionality", () => {
- expect(Math.ceil).toHaveLength(1);
-
- expect(Math.ceil(0.95)).toBe(1);
- expect(Math.ceil(4)).toBe(4);
- expect(Math.ceil(7.004)).toBe(8);
- expect(Math.ceil(-0.95)).toBe(-0);
- expect(Math.ceil(-4)).toBe(-4);
- expect(Math.ceil(-7.004)).toBe(-7);
-
- expect(Math.ceil()).toBeNaN();
- expect(Math.ceil(NaN)).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.clz32.js b/Libraries/LibJS/Tests/builtins/Math/Math.clz32.js
deleted file mode 100644
index e80f9f023e..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.clz32.js
+++ /dev/null
@@ -1,44 +0,0 @@
-test("basic functionality", () => {
- expect(Math.clz32).toHaveLength(1);
-
- expect(Math.clz32(0)).toBe(32);
- expect(Math.clz32(1)).toBe(31);
- expect(Math.clz32(2)).toBe(30);
- expect(Math.clz32(3)).toBe(30);
- expect(Math.clz32(4)).toBe(29);
- expect(Math.clz32(5)).toBe(29);
- expect(Math.clz32(-1)).toBe(0);
- expect(Math.clz32(-10)).toBe(0);
- expect(Math.clz32(-100)).toBe(0);
- expect(Math.clz32(-1000)).toBe(0);
- expect(Math.clz32(-0.123)).toBe(32);
- expect(Math.clz32(0.123)).toBe(32);
- expect(Math.clz32(1.23)).toBe(31);
- expect(Math.clz32(12)).toBe(28);
- expect(Math.clz32(123)).toBe(25);
- expect(Math.clz32(1234)).toBe(21);
- expect(Math.clz32(12345)).toBe(18);
- expect(Math.clz32(123456)).toBe(15);
- expect(Math.clz32(1234567)).toBe(11);
- expect(Math.clz32(12345678)).toBe(8);
- expect(Math.clz32(123456789)).toBe(5);
- expect(Math.clz32(999999999)).toBe(2);
- expect(Math.clz32(9999999999)).toBe(1);
- expect(Math.clz32(99999999999)).toBe(1);
- expect(Math.clz32(999999999999)).toBe(0);
- expect(Math.clz32(9999999999999)).toBe(1);
- expect(Math.clz32(99999999999999)).toBe(3);
- expect(Math.clz32(999999999999999)).toBe(0);
-
- expect(Math.clz32()).toBe(32);
- expect(Math.clz32(NaN)).toBe(32);
- expect(Math.clz32(Infinity)).toBe(32);
- expect(Math.clz32(-Infinity)).toBe(32);
- expect(Math.clz32(false)).toBe(32);
- expect(Math.clz32(true)).toBe(31);
- expect(Math.clz32(null)).toBe(32);
- expect(Math.clz32(undefined)).toBe(32);
- expect(Math.clz32([])).toBe(32);
- expect(Math.clz32({})).toBe(32);
- expect(Math.clz32("foo")).toBe(32);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.cos.js b/Libraries/LibJS/Tests/builtins/Math/Math.cos.js
deleted file mode 100644
index 8186bc4199..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.cos.js
+++ /dev/null
@@ -1,14 +0,0 @@
-test("basic functionality", () => {
- expect(Math.cos).toHaveLength(1);
-
- expect(Math.cos(0)).toBe(1);
- expect(Math.cos(null)).toBe(1);
- expect(Math.cos("")).toBe(1);
- expect(Math.cos([])).toBe(1);
- expect(Math.cos(Math.PI)).toBe(-1);
- expect(Math.cos()).toBeNaN();
- expect(Math.cos(undefined)).toBeNaN();
- expect(Math.cos([1, 2, 3])).toBeNaN();
- expect(Math.cos({})).toBeNaN();
- expect(Math.cos("foo")).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.cosh.js b/Libraries/LibJS/Tests/builtins/Math/Math.cosh.js
deleted file mode 100644
index 928b427028..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.cosh.js
+++ /dev/null
@@ -1,7 +0,0 @@
-test("basic functionality", () => {
- expect(Math.cosh).toHaveLength(1);
-
- expect(Math.cosh(0)).toBe(1);
- expect(Math.cosh(1)).toBeCloseTo(1.5430806348152437);
- expect(Math.cosh(-1)).toBeCloseTo(1.5430806348152437);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.exp.js b/Libraries/LibJS/Tests/builtins/Math/Math.exp.js
deleted file mode 100644
index d7111be916..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.exp.js
+++ /dev/null
@@ -1,13 +0,0 @@
-test("basic functionality", () => {
- expect(Math.exp).toHaveLength(1);
-
- expect(Math.exp(0)).toBe(1);
- expect(Math.exp(-2)).toBeCloseTo(0.135335);
- expect(Math.exp(-1)).toBeCloseTo(0.367879);
- expect(Math.exp(1)).toBeCloseTo(2.718281);
- expect(Math.exp(2)).toBeCloseTo(7.389056);
-
- expect(Math.exp()).toBeNaN();
- expect(Math.exp(undefined)).toBeNaN();
- expect(Math.exp("foo")).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.expm1.js b/Libraries/LibJS/Tests/builtins/Math/Math.expm1.js
deleted file mode 100644
index 791eb8730a..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.expm1.js
+++ /dev/null
@@ -1,13 +0,0 @@
-test("basic functionality", () => {
- expect(Math.expm1).toHaveLength(1);
-
- expect(Math.expm1(0)).toBe(0);
- expect(Math.expm1(-2)).toBeCloseTo(-0.864664);
- expect(Math.expm1(-1)).toBeCloseTo(-0.63212);
- expect(Math.expm1(1)).toBeCloseTo(1.718281);
- expect(Math.expm1(2)).toBeCloseTo(6.389056);
-
- expect(Math.expm1()).toBeNaN();
- expect(Math.expm1(undefined)).toBeNaN();
- expect(Math.expm1("foo")).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.floor.js b/Libraries/LibJS/Tests/builtins/Math/Math.floor.js
deleted file mode 100644
index f1420fe202..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.floor.js
+++ /dev/null
@@ -1,13 +0,0 @@
-test("basic functionality", () => {
- expect(Math.floor).toHaveLength(1);
-
- expect(Math.floor(0.95)).toBe(0);
- expect(Math.floor(4)).toBe(4);
- expect(Math.floor(7.004)).toBe(7);
- expect(Math.floor(-0.95)).toBe(-1);
- expect(Math.floor(-4)).toBe(-4);
- expect(Math.floor(-7.004)).toBe(-8);
-
- expect(Math.floor()).toBeNaN();
- expect(Math.floor(NaN)).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.fround.js b/Libraries/LibJS/Tests/builtins/Math/Math.fround.js
deleted file mode 100644
index 34b6c3f29f..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.fround.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("basic functionality", () => {
- expect(Math.fround).toHaveLength(1);
-
- expect(Math.fround(0)).toBe(0);
- expect(Math.fround(1)).toBe(1);
- expect(Math.fround(1.337)).toBeCloseTo(1.3370000123977661);
- expect(Math.fround(1.5)).toBe(1.5);
- expect(Math.fround(NaN)).toBe(NaN);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.hypot.js b/Libraries/LibJS/Tests/builtins/Math/Math.hypot.js
deleted file mode 100644
index ee4b1ea1b7..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.hypot.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("basic functionality", () => {
- expect(Math.hypot(3, 4)).toBe(5);
- expect(Math.hypot(3, 4, 5)).toBeCloseTo(7.0710678118654755);
- expect(Math.hypot()).toBe(0);
- expect(Math.hypot(NaN)).toBe(NaN);
- expect(Math.hypot(3, 4, "foo")).toBe(NaN);
- expect(Math.hypot(3, 4, "5")).toBeCloseTo(7.0710678118654755);
- expect(Math.hypot(-3)).toBe(3);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.log.js b/Libraries/LibJS/Tests/builtins/Math/Math.log.js
deleted file mode 100644
index 9b19569dce..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.log.js
+++ /dev/null
@@ -1,8 +0,0 @@
-test("basic functionality", () => {
- expect(Math.log).toHaveLength(1);
-
- expect(Math.log(-1)).toBe(NaN);
- expect(Math.log(0)).toBe(-Infinity);
- expect(Math.log(1)).toBe(0);
- expect(Math.log(10)).toBeCloseTo(2.302585092994046);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.log10.js b/Libraries/LibJS/Tests/builtins/Math/Math.log10.js
deleted file mode 100644
index f63a0daa77..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.log10.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("basic functionality", () => {
- expect(Math.log10).toHaveLength(1);
-
- expect(Math.log10(2)).toBeCloseTo(0.3010299956639812);
- expect(Math.log10(1)).toBe(0);
- expect(Math.log10(0)).toBe(-Infinity);
- expect(Math.log10(-2)).toBe(NaN);
- expect(Math.log10(100000)).toBe(5);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.log1p.js b/Libraries/LibJS/Tests/builtins/Math/Math.log1p.js
deleted file mode 100644
index 5d35c1d03e..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.log1p.js
+++ /dev/null
@@ -1,8 +0,0 @@
-test("basic functionality", () => {
- expect(Math.log1p).toHaveLength(1);
-
- expect(Math.log1p(-2)).toBeNaN();
- expect(Math.log1p(-1)).toBe(-Infinity);
- expect(Math.log1p(0)).toBe(0);
- expect(Math.log1p(1)).toBeCloseTo(0.693147);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.log2.js b/Libraries/LibJS/Tests/builtins/Math/Math.log2.js
deleted file mode 100644
index efa84a2377..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.log2.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- expect(Math.log2).toHaveLength(1);
-
- expect(Math.log2(3)).toBeCloseTo(1.584962500721156);
- expect(Math.log2(2)).toBe(1);
- expect(Math.log2(1)).toBe(0);
- expect(Math.log2(0)).toBe(-Infinity);
- expect(Math.log2(-2)).toBe(NaN);
- expect(Math.log2(1024)).toBe(10);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.max.js b/Libraries/LibJS/Tests/builtins/Math/Math.max.js
deleted file mode 100644
index f99a39cc9c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.max.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- expect(Math.max).toHaveLength(2);
-
- expect(Math.max()).toBe(-Infinity);
- expect(Math.max(1)).toBe(1);
- expect(Math.max(2, 1)).toBe(2);
- expect(Math.max(1, 2, 3)).toBe(3);
- expect(Math.max(NaN)).toBeNaN();
- expect(Math.max("String", 1)).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.min.js b/Libraries/LibJS/Tests/builtins/Math/Math.min.js
deleted file mode 100644
index fedfcabe27..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("basic functionality", () => {
- expect(Math.min).toHaveLength(2);
-
- expect(Math.min(1)).toBe(1);
- expect(Math.min(2, 1)).toBe(1);
- expect(Math.min(1, 2, 3)).toBe(1);
- expect(Math.min(NaN)).toBeNaN();
- expect(Math.min("String", 1)).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.pow.js b/Libraries/LibJS/Tests/builtins/Math/Math.pow.js
deleted file mode 100644
index 036060b238..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.pow.js
+++ /dev/null
@@ -1,25 +0,0 @@
-test("basic functionality", () => {
- expect(Math.pow).toHaveLength(2);
-
- expect(Math.pow(2, 0)).toBe(1);
- expect(Math.pow(2, 1)).toBe(2);
- expect(Math.pow(2, 2)).toBe(4);
- expect(Math.pow(2, 3)).toBe(8);
- expect(Math.pow(2, -3)).toBe(0.125);
- expect(Math.pow(3, 2)).toBe(9);
- expect(Math.pow(0, 0)).toBe(1);
- expect(Math.pow(2, Math.pow(3, 2))).toBe(512);
- expect(Math.pow(Math.pow(2, 3), 2)).toBe(64);
- expect(Math.pow("2", "3")).toBe(8);
- expect(Math.pow("", [])).toBe(1);
- expect(Math.pow([], null)).toBe(1);
- expect(Math.pow(null, null)).toBe(1);
- expect(Math.pow(undefined, null)).toBe(1);
- expect(Math.pow(NaN, 2)).toBeNaN();
- expect(Math.pow(2, NaN)).toBeNaN();
- expect(Math.pow(undefined, 2)).toBeNaN();
- expect(Math.pow(2, undefined)).toBeNaN();
- expect(Math.pow(null, undefined)).toBeNaN();
- expect(Math.pow(2, "foo")).toBeNaN();
- expect(Math.pow("foo", 2)).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.sign.js b/Libraries/LibJS/Tests/builtins/Math/Math.sign.js
deleted file mode 100644
index a1e8a6eb72..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.sign.js
+++ /dev/null
@@ -1,36 +0,0 @@
-function isPositiveZero(value) {
- return value === 0 && 1 / value === Infinity;
-}
-
-function isNegativeZero(value) {
- return value === 0 && 1 / value === -Infinity;
-}
-
-test("basic functionality", () => {
- expect(Math.sign).toHaveLength(1);
-
- expect(Math.sign(0.0001)).toBe(1);
- expect(Math.sign(1)).toBe(1);
- expect(Math.sign(42)).toBe(1);
- expect(Math.sign(Infinity)).toBe(1);
- expect(isPositiveZero(Math.sign(0))).toBeTrue();
- expect(isPositiveZero(Math.sign(null))).toBeTrue();
- expect(isPositiveZero(Math.sign(""))).toBeTrue();
- expect(isPositiveZero(Math.sign([]))).toBeTrue();
-
- expect(Math.sign(-0.0001)).toBe(-1);
- expect(Math.sign(-1)).toBe(-1);
- expect(Math.sign(-42)).toBe(-1);
- expect(Math.sign(-Infinity)).toBe(-1);
- expect(isNegativeZero(Math.sign(-0))).toBeTrue();
- expect(isNegativeZero(Math.sign(-null))).toBeTrue();
- expect(isNegativeZero(Math.sign(-""))).toBeTrue();
- expect(isNegativeZero(Math.sign(-[]))).toBeTrue();
-
- expect(Math.sign()).toBeNaN();
- expect(Math.sign(undefined)).toBeNaN();
- expect(Math.sign([1, 2, 3])).toBeNaN();
- expect(Math.sign({})).toBeNaN();
- expect(Math.sign(NaN)).toBeNaN();
- expect(Math.sign("foo")).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.sin.js b/Libraries/LibJS/Tests/builtins/Math/Math.sin.js
deleted file mode 100644
index f5434d94c7..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.sin.js
+++ /dev/null
@@ -1,15 +0,0 @@
-test("basic functionality", () => {
- expect(Math.sin).toHaveLength(1);
-
- expect(Math.sin(0)).toBe(0);
- expect(Math.sin(null)).toBe(0);
- expect(Math.sin("")).toBe(0);
- expect(Math.sin([])).toBe(0);
- expect(Math.sin((Math.PI * 3) / 2)).toBe(-1);
- expect(Math.sin(Math.PI / 2)).toBe(1);
- expect(Math.sin()).toBeNaN();
- expect(Math.sin(undefined)).toBeNaN();
- expect(Math.sin([1, 2, 3])).toBeNaN();
- expect(Math.sin({})).toBeNaN();
- expect(Math.sin("foo")).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.sinh.js b/Libraries/LibJS/Tests/builtins/Math/Math.sinh.js
deleted file mode 100644
index 6ea3049c4c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.sinh.js
+++ /dev/null
@@ -1,6 +0,0 @@
-test("basic functionality", () => {
- expect(Math.sinh).toHaveLength(1);
-
- expect(Math.sinh(0)).toBe(0);
- expect(Math.sinh(1)).toBeCloseTo(1.1752011936438014);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.sqrt.js b/Libraries/LibJS/Tests/builtins/Math/Math.sqrt.js
deleted file mode 100644
index 1e7b2115e0..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.sqrt.js
+++ /dev/null
@@ -1,4 +0,0 @@
-test("basic functionality", () => {
- expect(Math.sqrt).toHaveLength(1);
- expect(Math.sqrt(9)).toBe(3);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.tan.js b/Libraries/LibJS/Tests/builtins/Math/Math.tan.js
deleted file mode 100644
index ef1f32f163..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.tan.js
+++ /dev/null
@@ -1,14 +0,0 @@
-test("basic functionality", () => {
- expect(Math.tan).toHaveLength(1);
-
- expect(Math.tan(0)).toBe(0);
- expect(Math.tan(null)).toBe(0);
- expect(Math.tan("")).toBe(0);
- expect(Math.tan([])).toBe(0);
- expect(Math.ceil(Math.tan(Math.PI / 4))).toBe(1);
- expect(Math.tan()).toBeNaN();
- expect(Math.tan(undefined)).toBeNaN();
- expect(Math.tan([1, 2, 3])).toBeNaN();
- expect(Math.tan({})).toBeNaN();
- expect(Math.tan("foo")).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.tanh.js b/Libraries/LibJS/Tests/builtins/Math/Math.tanh.js
deleted file mode 100644
index e24dae76c4..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.tanh.js
+++ /dev/null
@@ -1,8 +0,0 @@
-test("basic functionality", () => {
- expect(Math.tanh).toHaveLength(1);
-
- expect(Math.tanh(0)).toBe(0);
- expect(Math.tanh(Infinity)).toBe(1);
- expect(Math.tanh(-Infinity)).toBe(-1);
- expect(Math.tanh(1)).toBeCloseTo(0.7615941559557649);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.trunc.js b/Libraries/LibJS/Tests/builtins/Math/Math.trunc.js
deleted file mode 100644
index baf8418d1e..0000000000
--- a/Libraries/LibJS/Tests/builtins/Math/Math.trunc.js
+++ /dev/null
@@ -1,12 +0,0 @@
-test("basic functionality", () => {
- expect(Math.trunc).toHaveLength(1);
-
- expect(Math.trunc(13.37)).toBe(13);
- expect(Math.trunc(42.84)).toBe(42);
- expect(Math.trunc(0.123)).toBe(0);
- expect(Math.trunc(-0.123)).toBe(-0);
-
- expect(Math.trunc(NaN)).toBeNaN();
- expect(Math.trunc("foo")).toBeNaN();
- expect(Math.trunc()).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/NaN/NaN.js b/Libraries/LibJS/Tests/builtins/NaN/NaN.js
deleted file mode 100644
index 9c496238b9..0000000000
--- a/Libraries/LibJS/Tests/builtins/NaN/NaN.js
+++ /dev/null
@@ -1,13 +0,0 @@
-test("basic functionality", () => {
- const nan = undefined + 1;
-
- expect(nan + "").toBe("NaN");
- expect(NaN + "").toBe("NaN");
- expect(nan !== nan).toBeTrue();
- expect(NaN !== NaN).toBeTrue();
- expect(nan).toBeNaN();
- expect(NaN).toBeNaN();
- expect(0).not.toBeNaN();
- expect(!!nan).toBeFalse();
- expect(!!NaN).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Number/Number-constants.js b/Libraries/LibJS/Tests/builtins/Number/Number-constants.js
deleted file mode 100644
index 2958821546..0000000000
--- a/Libraries/LibJS/Tests/builtins/Number/Number-constants.js
+++ /dev/null
@@ -1,11 +0,0 @@
-test("basic functionality", () => {
- expect(Number.EPSILON).toBe(2 ** -52);
- expect(Number.EPSILON).toBeGreaterThan(0);
- expect(Number.MAX_SAFE_INTEGER).toBe(2 ** 53 - 1);
- expect(Number.MAX_SAFE_INTEGER + 1).toBe(Number.MAX_SAFE_INTEGER + 2);
- expect(Number.MIN_SAFE_INTEGER).toBe(-(2 ** 53 - 1));
- expect(Number.MIN_SAFE_INTEGER - 1).toBe(Number.MIN_SAFE_INTEGER - 2);
- expect(Number.POSITIVE_INFINITY).toBe(Infinity);
- expect(Number.NEGATIVE_INFINITY).toBe(-Infinity);
- expect(Number.NaN).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.isFinite.js b/Libraries/LibJS/Tests/builtins/Number/Number.isFinite.js
deleted file mode 100644
index 19a23c0292..0000000000
--- a/Libraries/LibJS/Tests/builtins/Number/Number.isFinite.js
+++ /dev/null
@@ -1,24 +0,0 @@
-test("basic functionality", () => {
- expect(Number.isFinite).toHaveLength(1);
- expect(Number.isFinite).not.toBe(isFinite);
-
- expect(Number.isFinite(0)).toBeTrue();
- expect(Number.isFinite(1.23)).toBeTrue();
- expect(Number.isFinite(42)).toBeTrue();
-
- expect(Number.isFinite("")).toBeFalse();
- expect(Number.isFinite("0")).toBeFalse();
- expect(Number.isFinite("42")).toBeFalse();
- expect(Number.isFinite(true)).toBeFalse();
- expect(Number.isFinite(false)).toBeFalse();
- expect(Number.isFinite(null)).toBeFalse();
- expect(Number.isFinite([])).toBeFalse();
- expect(Number.isFinite()).toBeFalse();
- expect(Number.isFinite(NaN)).toBeFalse();
- expect(Number.isFinite(undefined)).toBeFalse();
- expect(Number.isFinite(Infinity)).toBeFalse();
- expect(Number.isFinite(-Infinity)).toBeFalse();
- expect(Number.isFinite("foo")).toBeFalse();
- expect(Number.isFinite({})).toBeFalse();
- expect(Number.isFinite([1, 2, 3])).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.isInteger.js b/Libraries/LibJS/Tests/builtins/Number/Number.isInteger.js
deleted file mode 100644
index ff0bc9370c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Number/Number.isInteger.js
+++ /dev/null
@@ -1,32 +0,0 @@
-test("basic functionality", () => {
- expect(Number.isInteger).toHaveLength(1);
-
- expect(Number.isInteger(0)).toBeTrue();
- expect(Number.isInteger(42)).toBeTrue();
- expect(Number.isInteger(-10000)).toBeTrue();
- expect(Number.isInteger(5)).toBeTrue();
- expect(Number.isInteger(5.0)).toBeTrue();
- expect(Number.isInteger(5 + 1 / 10000000000000000)).toBeTrue();
- // FIXME: values outside of i32's range should still return true
- // expect(Number.isInteger(+2147483647 + 1)).toBeTrue();
- // expect(Number.isInteger(-2147483648 - 1)).toBeTrue();
- // expect(Number.isInteger(99999999999999999999999999999999999)).toBeTrue();
-
- expect(Number.isInteger(5 + 1 / 1000000000000000)).toBeFalse();
- expect(Number.isInteger(1.23)).toBeFalse();
- expect(Number.isInteger("")).toBeFalse();
- expect(Number.isInteger("0")).toBeFalse();
- expect(Number.isInteger("42")).toBeFalse();
- expect(Number.isInteger(true)).toBeFalse();
- expect(Number.isInteger(false)).toBeFalse();
- expect(Number.isInteger(null)).toBeFalse();
- expect(Number.isInteger([])).toBeFalse();
- expect(Number.isInteger(Infinity)).toBeFalse();
- expect(Number.isInteger(-Infinity)).toBeFalse();
- expect(Number.isInteger(NaN)).toBeFalse();
- expect(Number.isInteger()).toBeFalse();
- expect(Number.isInteger(undefined)).toBeFalse();
- expect(Number.isInteger("foo")).toBeFalse();
- expect(Number.isInteger({})).toBeFalse();
- expect(Number.isInteger([1, 2, 3])).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.isNaN.js b/Libraries/LibJS/Tests/builtins/Number/Number.isNaN.js
deleted file mode 100644
index 6a7df463df..0000000000
--- a/Libraries/LibJS/Tests/builtins/Number/Number.isNaN.js
+++ /dev/null
@@ -1,25 +0,0 @@
-test("basic functionality", () => {
- expect(Number.isNaN).toHaveLength(1);
- expect(Number.isNaN).not.toBe(isNaN);
-
- expect(Number.isNaN(0)).toBeFalse();
- expect(Number.isNaN(42)).toBeFalse();
- expect(Number.isNaN("")).toBeFalse();
- expect(Number.isNaN("0")).toBeFalse();
- expect(Number.isNaN("42")).toBeFalse();
- expect(Number.isNaN(true)).toBeFalse();
- expect(Number.isNaN(false)).toBeFalse();
- expect(Number.isNaN(null)).toBeFalse();
- expect(Number.isNaN([])).toBeFalse();
- expect(Number.isNaN(Infinity)).toBeFalse();
- expect(Number.isNaN(-Infinity)).toBeFalse();
- expect(Number.isNaN()).toBeFalse();
- expect(Number.isNaN(undefined)).toBeFalse();
- expect(Number.isNaN("foo")).toBeFalse();
- expect(Number.isNaN({})).toBeFalse();
- expect(Number.isNaN([1, 2, 3])).toBeFalse();
-
- expect(Number.isNaN(NaN)).toBeTrue();
- expect(Number.isNaN(Number.NaN)).toBeTrue();
- expect(Number.isNaN(0 / 0)).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.isSafeInteger.js b/Libraries/LibJS/Tests/builtins/Number/Number.isSafeInteger.js
deleted file mode 100644
index 3bba1682a6..0000000000
--- a/Libraries/LibJS/Tests/builtins/Number/Number.isSafeInteger.js
+++ /dev/null
@@ -1,24 +0,0 @@
-test("basic functionality", () => {
- expect(Number.isSafeInteger).toHaveLength(1);
-
- expect(Number.isSafeInteger(0)).toBeTrue();
- expect(Number.isSafeInteger(1)).toBeTrue();
- expect(Number.isSafeInteger(2.0)).toBeTrue();
- expect(Number.isSafeInteger(42)).toBeTrue();
- expect(Number.isSafeInteger(Number.MAX_SAFE_INTEGER)).toBeTrue();
- expect(Number.isSafeInteger(Number.MIN_SAFE_INTEGER)).toBeTrue();
-
- expect(Number.isSafeInteger()).toBeFalse();
- expect(Number.isSafeInteger("1")).toBeFalse();
- expect(Number.isSafeInteger(2.1)).toBeFalse();
- expect(Number.isSafeInteger(42.42)).toBeFalse();
- expect(Number.isSafeInteger("")).toBeFalse();
- expect(Number.isSafeInteger([])).toBeFalse();
- expect(Number.isSafeInteger(null)).toBeFalse();
- expect(Number.isSafeInteger(undefined)).toBeFalse();
- expect(Number.isSafeInteger(NaN)).toBeFalse();
- expect(Number.isSafeInteger(Infinity)).toBeFalse();
- expect(Number.isSafeInteger(-Infinity)).toBeFalse();
- expect(Number.isSafeInteger(Number.MAX_SAFE_INTEGER + 1)).toBeFalse();
- expect(Number.isSafeInteger(Number.MIN_SAFE_INTEGER - 1)).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.js b/Libraries/LibJS/Tests/builtins/Number/Number.js
deleted file mode 100644
index 7fd7067449..0000000000
--- a/Libraries/LibJS/Tests/builtins/Number/Number.js
+++ /dev/null
@@ -1,33 +0,0 @@
-test("basic functionality", () => {
- expect(Number).toHaveLength(1);
- expect(Number.name).toBe("Number");
- expect(Number.prototype).not.toHaveProperty("length");
-
- expect(typeof Number()).toBe("number");
- expect(typeof new Number()).toBe("object");
-
- expect(Number()).toBe(0);
- expect(new Number().valueOf()).toBe(0);
- expect(Number("42")).toBe(42);
- expect(new Number("42").valueOf()).toBe(42);
- expect(Number(null)).toBe(0);
- expect(new Number(null).valueOf()).toBe(0);
- expect(Number(true)).toBe(1);
- expect(new Number(true).valueOf()).toBe(1);
- expect(Number("Infinity")).toBe(Infinity);
- expect(new Number("Infinity").valueOf()).toBe(Infinity);
- expect(Number("+Infinity")).toBe(Infinity);
- expect(new Number("+Infinity").valueOf()).toBe(Infinity);
- expect(Number("-Infinity")).toBe(-Infinity);
- expect(new Number("-Infinity").valueOf()).toBe(-Infinity);
- expect(Number(undefined)).toBeNaN();
- expect(new Number(undefined).valueOf()).toBeNaN();
- expect(Number({})).toBeNaN();
- expect(new Number({}).valueOf()).toBeNaN();
- expect(Number({ a: 1 })).toBeNaN();
- expect(new Number({ a: 1 }).valueOf()).toBeNaN();
- expect(Number([1, 2, 3])).toBeNaN();
- expect(new Number([1, 2, 3]).valueOf()).toBeNaN();
- expect(Number("foo")).toBeNaN();
- expect(new Number("foo").valueOf()).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.parseFloat.js b/Libraries/LibJS/Tests/builtins/Number/Number.parseFloat.js
deleted file mode 100644
index 89de9ff0d9..0000000000
--- a/Libraries/LibJS/Tests/builtins/Number/Number.parseFloat.js
+++ /dev/null
@@ -1,5 +0,0 @@
-test("basic functionality", () => {
- // Ensuring it's the same function as the global
- // parseFloat() is enough as that already has tests :^)
- expect(Number.parseFloat).toBe(parseFloat);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.js b/Libraries/LibJS/Tests/builtins/Number/Number.prototype.js
deleted file mode 100644
index 91f2e93c0e..0000000000
--- a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.js
+++ /dev/null
@@ -1,4 +0,0 @@
-test("basic functionality", () => {
- expect(typeof Number.prototype).toBe("object");
- expect(Number.prototype.valueOf()).toBe(0);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toString.js
deleted file mode 100644
index c07ca792f6..0000000000
--- a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toString.js
+++ /dev/null
@@ -1,83 +0,0 @@
-describe("correct behavior", () => {
- test("length", () => {
- expect(Number.prototype.toString).toHaveLength(1);
- });
-
- test("basic functionality", () => {
- [
- [+0, "0"],
- [-0, "0"],
- [Infinity, "Infinity"],
- [-Infinity, "-Infinity"],
- [NaN, "NaN"],
- [12, "12"],
- [93465, "93465"],
- [358000, "358000"],
- ].forEach(testCase => {
- expect(testCase[0].toString()).toBe(testCase[1]);
- });
- });
-
- test("radix", () => {
- let number = 7857632;
-
- [
- [2, "11101111110010111100000"],
- [3, "112210012122102"],
- [4, "131332113200"],
- [5, "4002421012"],
- [6, "440225532"],
- [7, "123534356"],
- [8, "35762740"],
- [9, "15705572"],
- [10, "7857632"],
- [11, "4487612"],
- [12, "276b2a8"],
- [13, "18216b3"],
- [14, "10877d6"],
- [15, "a532c2"],
- [16, "77e5e0"],
- [17, "59160b"],
- [18, "42f5h2"],
- [19, "335b5b"],
- [20, "29241c"],
- [21, "1j89fk"],
- [22, "1bbkh2"],
- [23, "151ih4"],
- [24, "ng9h8"],
- [25, "k2m57"],
- [26, "h51ig"],
- [27, "el5hb"],
- [28, "clqdk"],
- [29, "b355o"],
- [30, "9l0l2"],
- [31, "8fng0"],
- [32, "7fpf0"],
- [33, "6klf2"],
- [34, "5tv8s"],
- [35, "589dr"],
- [36, "4oezk"],
- ].forEach(testCase => {
- expect(number.toString(testCase[0])).toBe(testCase[1]);
- });
- });
-
- test("decimal radix gets converted to int", () => {
- expect((30).toString(10.1)).toBe("30");
- expect((30).toString(10.9)).toBe("30");
- });
-});
-
-test("errors", () => {
- test("must be called with numeric |this|", () => {
- [true, [], {}, Symbol("foo"), "bar", 1n].forEach(value => {
- expect(() => Number.prototype.toString.call(value)).toThrow(TypeError);
- });
- });
-
- test("radix RangeError", () => {
- [0, 1, 37, 100].forEach(value => {
- expect(() => (0).toString(value)).toThrow(RangeError);
- });
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.defineProperty.js b/Libraries/LibJS/Tests/builtins/Object/Object.defineProperty.js
deleted file mode 100644
index bebe32997d..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.defineProperty.js
+++ /dev/null
@@ -1,242 +0,0 @@
-describe("normal functionality", () => {
- let s = Symbol("foo");
-
- test("non-configurable string property", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: 1, writable: false, enumerable: false });
-
- expect(o.foo).toBe(1);
- o.foo = 2;
- expect(o.foo).toBe(1);
-
- expect(o).not.toHaveConfigurableProperty("foo");
- expect(o).not.toHaveEnumerableProperty("foo");
- expect(o).not.toHaveWritableProperty("foo");
- expect(o).toHaveValueProperty("foo", 1);
- });
-
- test("non-configurable symbol property", () => {
- let o = {};
- Object.defineProperty(o, s, { value: 1, writable: false, enumerable: false });
-
- expect(o[s]).toBe(1);
- o[s] = 2;
- expect(o[s]).toBe(1);
-
- expect(o).not.toHaveConfigurableProperty(s);
- expect(o).not.toHaveEnumerableProperty(s);
- expect(o).not.toHaveWritableProperty(s);
- expect(o).toHaveValueProperty(s, 1);
- });
-
- test("array index getter", () => {
- let o = {};
- Object.defineProperty(o, 2, {
- get() {
- return 10;
- },
- });
- expect(o[2]).toBe(10);
- });
-
- test("symbol property getter", () => {
- let o = {};
- Object.defineProperty(o, s, {
- get() {
- return 10;
- },
- });
- expect(o[s]).toBe(10);
- });
-
- test("configurable string property", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: "hi", writable: true, enumerable: true });
-
- expect(o.foo).toBe("hi");
- o.foo = "ho";
- expect(o.foo).toBe("ho");
-
- expect(o).not.toHaveConfigurableProperty("foo");
- expect(o).toHaveEnumerableProperty("foo");
- expect(o).toHaveWritableProperty("foo");
- expect(o).toHaveValueProperty("foo", "ho");
- });
-
- test("configurable symbol property", () => {
- let o = {};
- Object.defineProperty(o, s, { value: "hi", writable: true, enumerable: true });
-
- expect(o[s]).toBe("hi");
- o[s] = "ho";
- expect(o[s]).toBe("ho");
-
- expect(o).not.toHaveConfigurableProperty(s);
- expect(o).toHaveEnumerableProperty(s);
- expect(o).toHaveWritableProperty(s);
- expect(o).toHaveValueProperty(s, "ho");
- });
-
- test("reconfigure configurable string property", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: 9, configurable: true, writable: false });
- Object.defineProperty(o, "foo", { configurable: true, writable: true });
-
- expect(o).toHaveConfigurableProperty("foo");
- expect(o).toHaveWritableProperty("foo");
- expect(o).not.toHaveEnumerableProperty("foo");
- expect(o).toHaveValueProperty("foo", 9);
- });
-
- test("reconfigure configurable symbol property", () => {
- let o = {};
- Object.defineProperty(o, s, { value: 9, configurable: true, writable: false });
- Object.defineProperty(o, s, { configurable: true, writable: true });
-
- expect(o).toHaveConfigurableProperty(s);
- expect(o).toHaveWritableProperty(s);
- expect(o).not.toHaveEnumerableProperty(s);
- expect(o).toHaveValueProperty(s, 9);
- });
-
- test("define string accessor", () => {
- let o = {};
-
- Object.defineProperty(o, "foo", {
- configurable: true,
- get() {
- return o.secret_foo + 1;
- },
- set(value) {
- this.secret_foo = value + 1;
- },
- });
-
- o.foo = 10;
- expect(o.foo).toBe(12);
- o.foo = 20;
- expect(o.foo).toBe(22);
-
- Object.defineProperty(o, "foo", { configurable: true, value: 4 });
-
- expect(o.foo).toBe(4);
- expect((o.foo = 5)).toBe(5);
- expect((o.foo = 4)).toBe(4);
- });
-
- test("define symbol accessor", () => {
- let o = {};
-
- Object.defineProperty(o, s, {
- configurable: true,
- get() {
- return o.secret_foo + 1;
- },
- set(value) {
- this.secret_foo = value + 1;
- },
- });
-
- o[s] = 10;
- expect(o[s]).toBe(12);
- o[s] = 20;
- expect(o[s]).toBe(22);
-
- Object.defineProperty(o, s, { configurable: true, value: 4 });
-
- expect(o[s]).toBe(4);
- expect((o[s] = 5)).toBe(5);
- expect((o[s] = 4)).toBe(4);
- });
-
- test("issue #3735, reconfiguring property in unique shape", () => {
- const o = {};
- // In LibJS an object with more than 100 properties gets a unique shape
- for (let i = 0; i < 101; ++i) {
- o[`property${i}`] = i;
- }
- Object.defineProperty(o, "x", { configurable: true });
- Object.defineProperty(o, "x", { configurable: false });
- });
-});
-
-describe("errors", () => {
- test("redefine non-configurable property", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: 1, writable: true, enumerable: true });
-
- expect(() => {
- Object.defineProperty(o, "foo", { value: 2, writable: false, enumerable: true });
- }).toThrowWithMessage(
- TypeError,
- "Cannot change attributes of non-configurable property 'foo'"
- );
- });
-
- test("redefine non-configurable symbol property", () => {
- let o = {};
- let s = Symbol("foo");
- Object.defineProperty(o, s, { value: 1, writable: true, enumerable: true });
-
- expect(() => {
- Object.defineProperty(o, s, { value: 2, writable: false, enumerable: true });
- }).toThrowWithMessage(
- TypeError,
- "Cannot change attributes of non-configurable property 'Symbol(foo)'"
- );
- });
-
- test("cannot define 'value' and 'get' in the same descriptor", () => {
- let o = {};
-
- expect(() => {
- Object.defineProperty(o, "a", {
- get() {},
- value: 9,
- });
- }).toThrowWithMessage(
- TypeError,
- "Accessor property descriptor cannot specify a value or writable key"
- );
- });
-
- test("cannot define 'value' and 'set' in the same descriptor", () => {
- let o = {};
-
- expect(() => {
- Object.defineProperty(o, "a", {
- set() {},
- writable: true,
- });
- }).toThrowWithMessage(
- TypeError,
- "Accessor property descriptor cannot specify a value or writable key"
- );
- });
-
- test("redefine non-configurable accessor", () => {
- let o = {};
-
- Object.defineProperty(o, "foo", {
- configurable: false,
- get() {
- return this.secret_foo + 2;
- },
- set(value) {
- o.secret_foo = value + 2;
- },
- });
-
- expect(() => {
- Object.defineProperty(o, "foo", {
- configurable: false,
- get() {
- return this.secret_foo + 2;
- },
- });
- }).toThrowWithMessage(
- TypeError,
- "Cannot change attributes of non-configurable property 'foo'"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.entries.js b/Libraries/LibJS/Tests/builtins/Object/Object.entries.js
deleted file mode 100644
index c8ed8ffc4c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.entries.js
+++ /dev/null
@@ -1,64 +0,0 @@
-describe("basic functionality", () => {
- test("length", () => {
- expect(Object.entries).toHaveLength(1);
- expect(Object.entries(true)).toHaveLength(0);
- expect(Object.entries(45)).toHaveLength(0);
- expect(Object.entries(-998)).toHaveLength(0);
- expect(Object.entries("abcd")).toHaveLength(4);
- expect(Object.entries([1, 2, 3])).toHaveLength(3);
- expect(Object.entries({ a: 1, b: 2, c: 3 })).toHaveLength(3);
- });
-
- test("entries with object", () => {
- let entries = Object.entries({ foo: 1, bar: 2, baz: 3 });
-
- expect(entries).toEqual([
- ["foo", 1],
- ["bar", 2],
- ["baz", 3],
- ]);
- });
-
- test("entries with objects with symbol keys", () => {
- let entries = Object.entries({ foo: 1, [Symbol("bar")]: 2, baz: 3 });
-
- expect(entries).toEqual([
- ["foo", 1],
- ["baz", 3],
- ]);
- });
-
- test("entries with array", () => {
- entries = Object.entries(["a", "b", "c"]);
- expect(entries).toEqual([
- ["0", "a"],
- ["1", "b"],
- ["2", "c"],
- ]);
- });
-
- test("ignores non-enumerable properties", () => {
- let obj = { foo: 1 };
- Object.defineProperty(obj, "getFoo", {
- value: function () {
- return this.foo;
- },
- });
- let entries = Object.entries(obj);
- expect(entries).toEqual([["foo", 1]]);
- });
-});
-
-describe("errors", () => {
- test("null argument", () => {
- expect(() => {
- Object.entries(null);
- }).toThrowWithMessage(TypeError, "ToObject on null or undefined");
- });
-
- test("undefined argument", () => {
- expect(() => {
- Object.entries(undefined);
- }).toThrowWithMessage(TypeError, "ToObject on null or undefined");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertyDescriptor.js b/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertyDescriptor.js
deleted file mode 100644
index 3b69241d9d..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertyDescriptor.js
+++ /dev/null
@@ -1,61 +0,0 @@
-test("plain property", () => {
- let o = { foo: "bar" };
-
- expect(o).toHaveConfigurableProperty("foo");
- expect(o).toHaveEnumerableProperty("foo");
- expect(o).toHaveWritableProperty("foo");
- expect(o).toHaveValueProperty("foo", "bar");
- expect(o).not.toHaveGetterProperty("foo");
- expect(o).not.toHaveSetterProperty("foo");
-});
-
-test("symbol property", () => {
- let s = Symbol("foo");
- let o = { [s]: "bar" };
-
- expect(o).toHaveConfigurableProperty(s);
- expect(o).toHaveEnumerableProperty(s);
- expect(o).toHaveWritableProperty(s);
- expect(o).toHaveValueProperty(s, "bar");
- expect(o).not.toHaveGetterProperty(s);
- expect(o).not.toHaveSetterProperty(s);
-});
-
-test("getter property", () => {
- let o = { get foo() {} };
-
- expect(o).toHaveConfigurableProperty("foo");
- expect(o).toHaveEnumerableProperty("foo");
- expect(o).not.toHaveWritableProperty("foo");
- expect(o).not.toHaveValueProperty("foo");
- expect(o).toHaveGetterProperty("foo");
- expect(o).not.toHaveSetterProperty("foo");
-});
-
-test("setter property", () => {
- let o = { set foo(_) {} };
-
- expect(o).toHaveConfigurableProperty("foo");
- expect(o).toHaveEnumerableProperty("foo");
- expect(o).not.toHaveWritableProperty("foo");
- expect(o).not.toHaveValueProperty("foo");
- expect(o).not.toHaveGetterProperty("foo");
- expect(o).toHaveSetterProperty("foo");
-});
-
-test("defined property", () => {
- let o = {};
-
- Object.defineProperty(o, "foo", {
- enumerable: false,
- writable: true,
- value: 10,
- });
-
- expect(o).not.toHaveConfigurableProperty("foo");
- expect(o).not.toHaveEnumerableProperty("foo");
- expect(o).toHaveWritableProperty("foo");
- expect(o).toHaveValueProperty("foo", 10);
- expect(o).not.toHaveGetterProperty("foo");
- expect(o).not.toHaveSetterProperty("foo");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertyNames.js b/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertyNames.js
deleted file mode 100644
index da7bccbeba..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertyNames.js
+++ /dev/null
@@ -1,14 +0,0 @@
-test("use with array", () => {
- let names = Object.getOwnPropertyNames([1, 2, 3]);
- expect(names).toEqual(["0", "1", "2", "length"]);
-});
-
-test("use with object", () => {
- let names = Object.getOwnPropertyNames({ foo: 1, bar: 2, baz: 3 });
- expect(names).toEqual(["foo", "bar", "baz"]);
-});
-
-test("use with object with symbol keys", () => {
- let names = Object.getOwnPropertyNames({ foo: 1, [Symbol("bar")]: 2, baz: 3 });
- expect(names).toEqual(["foo", "baz"]);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.getPrototypeOf.js b/Libraries/LibJS/Tests/builtins/Object/Object.getPrototypeOf.js
deleted file mode 100644
index 8679efc7dc..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.getPrototypeOf.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- let o1 = new Object();
- let o2 = {};
-
- expect(Object.getPrototypeOf(o1)).toBe(Object.getPrototypeOf(o2));
- expect(Object.getPrototypeOf(Object.getPrototypeOf(o1))).toBeNull();
-
- Object.setPrototypeOf(o1, o2);
- expect(Object.getPrototypeOf(o1)).toBe(o2);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.is.js b/Libraries/LibJS/Tests/builtins/Object/Object.is.js
deleted file mode 100644
index fcad3484da..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.is.js
+++ /dev/null
@@ -1,54 +0,0 @@
-test("length", () => {
- expect(Object.is).toHaveLength(2);
-});
-
-test("arguments that evaluate to true", () => {
- let a = [1, 2, 3];
- let o = { foo: "bar" };
-
- expect(Object.is("", "")).toBeTrue();
- expect(Object.is("foo", "foo")).toBeTrue();
- expect(Object.is(0, 0)).toBeTrue();
- expect(Object.is(+0, +0)).toBeTrue();
- expect(Object.is(-0, -0)).toBeTrue();
- expect(Object.is(1.23, 1.23)).toBeTrue();
- expect(Object.is(42, 42)).toBeTrue();
- expect(Object.is(NaN, NaN)).toBeTrue();
- expect(Object.is(Infinity, Infinity)).toBeTrue();
- expect(Object.is(+Infinity, +Infinity)).toBeTrue();
- expect(Object.is(-Infinity, -Infinity)).toBeTrue();
- expect(Object.is(true, true)).toBeTrue();
- expect(Object.is(false, false)).toBeTrue();
- expect(Object.is(null, null)).toBeTrue();
- expect(Object.is(undefined, undefined)).toBeTrue();
- expect(Object.is(undefined)).toBeTrue();
- expect(Object.is()).toBeTrue();
- expect(Object.is(a, a)).toBeTrue();
- expect(Object.is(o, o)).toBeTrue();
-});
-
-test("arguments that evaluate to false", () => {
- let a = [1, 2, 3];
- let o = { foo: "bar" };
-
- expect(Object.is("test")).toBeFalse();
- expect(Object.is("foo", "bar")).toBeFalse();
- expect(Object.is(1, "1")).toBeFalse();
- expect(Object.is(+0, -0)).toBeFalse();
- expect(Object.is(-0, +0)).toBeFalse();
- expect(Object.is(42, 24)).toBeFalse();
- expect(Object.is(Infinity, -Infinity)).toBeFalse();
- expect(Object.is(-Infinity, +Infinity)).toBeFalse();
- expect(Object.is(true, false)).toBeFalse();
- expect(Object.is(false, true)).toBeFalse();
- expect(Object.is(undefined, null)).toBeFalse();
- expect(Object.is(null, undefined)).toBeFalse();
- expect(Object.is([], [])).toBeFalse();
- expect(Object.is(a, [1, 2, 3])).toBeFalse();
- expect(Object.is([1, 2, 3], a)).toBeFalse();
- expect(Object.is({}, {})).toBeFalse();
- expect(Object.is(o, { foo: "bar" })).toBeFalse();
- expect(Object.is({ foo: "bar" }, o)).toBeFalse();
- expect(Object.is(a, o)).toBeFalse();
- expect(Object.is(o, a)).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.isExtensible.js b/Libraries/LibJS/Tests/builtins/Object/Object.isExtensible.js
deleted file mode 100644
index b426114f20..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.isExtensible.js
+++ /dev/null
@@ -1,18 +0,0 @@
-test("basic functionality", () => {
- expect(Object.isExtensible).toHaveLength(1);
-
- expect(Object.isExtensible()).toBeFalse();
- expect(Object.isExtensible(undefined)).toBeFalse();
- expect(Object.isExtensible(null)).toBeFalse();
- expect(Object.isExtensible(true)).toBeFalse();
- expect(Object.isExtensible(6)).toBeFalse();
- expect(Object.isExtensible("test")).toBeFalse();
-
- let s = Symbol();
- expect(Object.isExtensible(s)).toBeFalse();
-
- let o = { foo: "foo" };
- expect(Object.isExtensible(o)).toBeTrue();
- Object.preventExtensions(o);
- expect(Object.isExtensible(o)).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.js b/Libraries/LibJS/Tests/builtins/Object/Object.js
deleted file mode 100644
index 544704c1f0..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.js
+++ /dev/null
@@ -1,13 +0,0 @@
-test("basic functionality", () => {
- expect(Object).toHaveLength(1);
- expect(Object.name).toBe("Object");
- expect(Object.prototype).not.toHaveProperty("length");
-
- expect(typeof Object()).toBe("object");
- expect(typeof new Object()).toBe("object");
-
- expect(typeof Object(42)).toBe("object");
- expect(Object(42).valueOf()).toBe(42);
- expect(typeof Object("foo")).toBe("object");
- expect(Object("foo").valueOf()).toBe("foo");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.keys.js b/Libraries/LibJS/Tests/builtins/Object/Object.keys.js
deleted file mode 100644
index 64e822abd7..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.keys.js
+++ /dev/null
@@ -1,51 +0,0 @@
-describe("correct behavior", () => {
- test("length", () => {
- expect(Object.keys).toHaveLength(1);
- expect(Object.keys(true)).toHaveLength(0);
- expect(Object.keys(45)).toHaveLength(0);
- expect(Object.keys(-998)).toHaveLength(0);
- expect(Object.keys("abcd")).toHaveLength(4);
- expect(Object.keys([1, 2, 3])).toHaveLength(3);
- expect(Object.keys({ a: 1, b: 2, c: 3 })).toHaveLength(3);
- });
-
- test("object argument", () => {
- let keys = Object.keys({ foo: 1, bar: 2, baz: 3 });
- expect(keys).toEqual(["foo", "bar", "baz"]);
- });
-
- test("object argument with symbol keys", () => {
- let keys = Object.keys({ foo: 1, [Symbol("bar")]: 2, baz: 3 });
- expect(keys).toEqual(["foo", "baz"]);
- });
-
- test("array argument", () => {
- let keys = Object.keys(["a", "b", "c"]);
- expect(keys).toEqual(["0", "1", "2"]);
- });
-
- test("ignores non-enumerable properties", () => {
- let obj = { foo: 1 };
- Object.defineProperty(obj, "getFoo", {
- value: function () {
- return this.foo;
- },
- });
- keys = Object.keys(obj);
- expect(keys).toEqual(["foo"]);
- });
-});
-
-describe("errors", () => {
- test("null argument value", () => {
- expect(() => {
- Object.keys(null);
- }).toThrowWithMessage(TypeError, "ToObject on null or undefined");
- });
-
- test("undefined argument value", () => {
- expect(() => {
- Object.keys(undefined);
- }).toThrowWithMessage(TypeError, "ToObject on null or undefined");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.preventExtensions.js b/Libraries/LibJS/Tests/builtins/Object/Object.preventExtensions.js
deleted file mode 100644
index 292c3f5999..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.preventExtensions.js
+++ /dev/null
@@ -1,67 +0,0 @@
-describe("correct behavior", () => {
- test("non-object arguments", () => {
- expect(Object.preventExtensions()).toBeUndefined();
- expect(Object.preventExtensions(undefined)).toBeUndefined();
- expect(Object.preventExtensions(null)).toBeNull();
- expect(Object.preventExtensions(true)).toBeTrue();
- expect(Object.preventExtensions(6)).toBe(6);
- expect(Object.preventExtensions("test")).toBe("test");
-
- let s = Symbol();
- expect(Object.preventExtensions(s)).toBe(s);
- });
-
- test("basic functionality", () => {
- let o = { foo: "foo" };
- expect(o.foo).toBe("foo");
- o.bar = "bar";
- expect(o.bar).toBe("bar");
-
- expect(Object.preventExtensions(o)).toBe(o);
- expect(o.foo).toBe("foo");
- expect(o.bar).toBe("bar");
-
- o.baz = "baz";
- expect(o.baz).toBeUndefined();
- });
-
- test("modifying existing properties", () => {
- const o = { foo: "bar" };
- Object.preventExtensions(o);
- o.foo = "baz";
- expect(o.foo).toBe("baz");
- });
-
- test("deleting existing properties", () => {
- const o = { foo: "bar" };
- Object.preventExtensions(o);
- delete o.foo;
- expect(o).not.toHaveProperty("foo");
- });
-});
-
-describe("errors", () => {
- test("defining a property on a non-extensible object", () => {
- let o = {};
- Object.preventExtensions(o);
-
- expect(() => {
- Object.defineProperty(o, "baz", { value: "baz" });
- }).toThrowWithMessage(TypeError, "Cannot define property baz on non-extensible object");
-
- expect(o.baz).toBeUndefined();
- });
-
- test("putting property on a non-extensible object", () => {
- let o = {};
- Object.preventExtensions(o);
-
- expect(() => {
- "use strict";
- o.foo = "foo";
- }).toThrowWithMessage(TypeError, "Cannot define property foo on non-extensible object");
-
- expect((o.foo = "foo")).toBe("foo");
- expect(o.foo).toBeUndefined();
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.constructor.js b/Libraries/LibJS/Tests/builtins/Object/Object.prototype.constructor.js
deleted file mode 100644
index 50e4935c75..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.constructor.js
+++ /dev/null
@@ -1,18 +0,0 @@
-test("basic functionality", () => {
- [Array, BigInt, Boolean, Date, Error, Function, Number, Object, String].forEach(constructor => {
- expect(constructor.prototype.constructor).toBe(constructor);
- if (constructor !== BigInt)
- expect(Reflect.construct(constructor, []).constructor).toBe(constructor);
- });
-
- let o = {};
- expect(o.constructor).toBe(Object);
-
- a = [];
- expect(a.constructor).toBe(Array);
-
- expect(Object.prototype).toHaveConfigurableProperty("constructor");
- expect(Object.prototype).not.toHaveEnumerableProperty("constructor");
- expect(Object.prototype).toHaveWritableProperty("constructor");
- expect(Object.prototype).toHaveValueProperty("constructor", Object);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.hasOwnProperty.js b/Libraries/LibJS/Tests/builtins/Object/Object.prototype.hasOwnProperty.js
deleted file mode 100644
index 11063f42ec..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.hasOwnProperty.js
+++ /dev/null
@@ -1,13 +0,0 @@
-test("basic functionality", () => {
- var o = {};
-
- o.foo = 1;
- expect(o.hasOwnProperty("foo")).toBeTrue();
- expect(o.hasOwnProperty("bar")).toBeFalse();
- expect(o.hasOwnProperty()).toBeFalse();
- expect(o.hasOwnProperty(undefined)).toBeFalse();
-
- o.undefined = 2;
- expect(o.hasOwnProperty()).toBeTrue();
- expect(o.hasOwnProperty(undefined)).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.isPrototypeOf.js b/Libraries/LibJS/Tests/builtins/Object/Object.prototype.isPrototypeOf.js
deleted file mode 100644
index f3f82174d2..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.isPrototypeOf.js
+++ /dev/null
@@ -1,18 +0,0 @@
-test("basic functionality", () => {
- function A() {}
- function B() {}
-
- A.prototype = new B();
- const C = new A();
-
- expect(A.prototype.isPrototypeOf(C)).toBeTrue();
- expect(B.prototype.isPrototypeOf(C)).toBeTrue();
-
- expect(A.isPrototypeOf(C)).toBeFalse();
- expect(B.isPrototypeOf(C)).toBeFalse();
-
- const D = new Object();
- expect(Object.prototype.isPrototypeOf(D)).toBeTrue();
- expect(Function.prototype.isPrototypeOf(D.toString)).toBeTrue();
- expect(Array.prototype.isPrototypeOf([])).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.js b/Libraries/LibJS/Tests/builtins/Object/Object.prototype.js
deleted file mode 100644
index eab7093b3b..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.js
+++ /dev/null
@@ -1,5 +0,0 @@
-test("basic functionality", () => {
- var o = new Object();
- Object.prototype.foo = 123;
- expect(o.foo).toBe(123);
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.propertyIsEnumerable.js b/Libraries/LibJS/Tests/builtins/Object/Object.prototype.propertyIsEnumerable.js
deleted file mode 100644
index 01f55cd749..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.propertyIsEnumerable.js
+++ /dev/null
@@ -1,15 +0,0 @@
-test("basic functionality", () => {
- var o = {};
-
- o.foo = 1;
- expect(o.propertyIsEnumerable("foo")).toBeTrue();
- expect(o.propertyIsEnumerable("bar")).toBeFalse();
- expect(o.propertyIsEnumerable()).toBeFalse();
- expect(o.propertyIsEnumerable(undefined)).toBeFalse();
-
- o.undefined = 2;
- expect(o.propertyIsEnumerable()).toBeTrue();
- expect(o.propertyIsEnumerable(undefined)).toBeTrue();
-
- expect(globalThis.propertyIsEnumerable("globalThis")).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/Object/Object.prototype.toLocaleString.js
deleted file mode 100644
index b64cb099e4..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.toLocaleString.js
+++ /dev/null
@@ -1,35 +0,0 @@
-describe("correct behavior", () => {
- test("length", () => {
- expect(Object.prototype.toLocaleString).toHaveLength(0);
- });
-
- test("basic functionality", () => {
- let o;
-
- o = {};
- expect(o.toString()).toBe(o.toLocaleString());
-
- o = { toString: () => 42 };
- expect(o.toString()).toBe(42);
- });
-});
-
-describe("errors", () => {
- test("toString that throws error", () => {
- let o = {
- toString: () => {
- throw new Error();
- },
- };
- expect(() => {
- o.toLocaleString();
- }).toThrow(Error);
- });
-
- test("toString that is not a function", () => {
- let o = { toString: "foo" };
- expect(() => {
- o.toLocaleString();
- }).toThrowWithMessage(TypeError, "foo is not a function");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Object/Object.prototype.toString.js
deleted file mode 100644
index 5bdd157de4..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.toString.js
+++ /dev/null
@@ -1,20 +0,0 @@
-test("length", () => {
- expect(Object.prototype.toString).toHaveLength(0);
-});
-
-test("result for various object types", () => {
- const oToString = o => Object.prototype.toString.call(o);
-
- expect(oToString(undefined)).toBe("[object Undefined]");
- expect(oToString(null)).toBe("[object Null]");
- expect(oToString([])).toBe("[object Array]");
- expect(oToString(function () {})).toBe("[object Function]");
- expect(oToString(new Error())).toBe("[object Error]");
- expect(oToString(new Boolean())).toBe("[object Boolean]");
- expect(oToString(new Number())).toBe("[object Number]");
- expect(oToString(new Date())).toBe("[object Date]");
- expect(oToString(new RegExp())).toBe("[object RegExp]");
- expect(oToString({})).toBe("[object Object]");
-
- expect(globalThis.toString()).toBe("[object Object]");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.setPrototypeOf.js b/Libraries/LibJS/Tests/builtins/Object/Object.setPrototypeOf.js
deleted file mode 100644
index 69a7b24ab3..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.setPrototypeOf.js
+++ /dev/null
@@ -1,43 +0,0 @@
-describe("correct behavior", () => {
- test("length", () => {
- expect(Object.setPrototypeOf).toHaveLength(2);
- });
-
- test("basic functionality", () => {
- let o = {};
- let p = {};
- expect(Object.setPrototypeOf(o, p)).toBe(o);
- expect(Object.getPrototypeOf(o)).toBe(p);
- });
-});
-
-describe("errors", () => {
- test("requires two arguments", () => {
- expect(() => {
- Object.setPrototypeOf();
- }).toThrowWithMessage(TypeError, "Object.setPrototypeOf requires at least two arguments");
-
- expect(() => {
- Object.setPrototypeOf({});
- }).toThrowWithMessage(TypeError, "Object.setPrototypeOf requires at least two arguments");
- });
-
- test("prototype must be an object", () => {
- expect(() => {
- Object.setPrototypeOf({}, "foo");
- }).toThrowWithMessage(TypeError, "Prototype must be an object or null");
- });
-
- test("non-extensible target", () => {
- let o = {};
- let p = {};
- Object.setPrototypeOf(o, p);
- Object.preventExtensions(o);
-
- expect(() => {
- Object.setPrototypeOf(o, {});
- }).toThrowWithMessage(TypeError, "Object's [[SetPrototypeOf]] method returned false");
-
- expect(Object.setPrototypeOf(o, p)).toBe(o);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.values.js b/Libraries/LibJS/Tests/builtins/Object/Object.values.js
deleted file mode 100644
index 5917d94cc8..0000000000
--- a/Libraries/LibJS/Tests/builtins/Object/Object.values.js
+++ /dev/null
@@ -1,51 +0,0 @@
-describe("correct behavior", () => {
- test("lengths", () => {
- expect(Object.values).toHaveLength(1);
- expect(Object.values(true)).toHaveLength(0);
- expect(Object.values(45)).toHaveLength(0);
- expect(Object.values(-998)).toHaveLength(0);
- expect(Object.values("abcd")).toHaveLength(4);
- expect(Object.values([1, 2, 3])).toHaveLength(3);
- expect(Object.values({ a: 1, b: 2, c: 3 })).toHaveLength(3);
- });
-
- test("object argument", () => {
- let values = Object.values({ foo: 1, bar: 2, baz: 3 });
- expect(values).toEqual([1, 2, 3]);
- });
-
- test("object argument with symbol keys", () => {
- let values = Object.values({ foo: 1, [Symbol("bar")]: 2, baz: 3 });
- expect(values).toEqual([1, 3]);
- });
-
- test("array argument", () => {
- let values = Object.values(["a", "b", "c"]);
- expect(values).toEqual(["a", "b", "c"]);
- });
-
- test("ignores non-enumerable properties", () => {
- let obj = { foo: 1 };
- Object.defineProperty(obj, "getFoo", {
- value: function () {
- return this.foo;
- },
- });
- let values = Object.values(obj);
- expect(values).toEqual([1]);
- });
-});
-
-describe("errors", () => {
- test("null argument", () => {
- expect(() => {
- Object.values(null);
- }).toThrowWithMessage(TypeError, "ToObject on null or undefined");
- });
-
- test("undefined argument", () => {
- expect(() => {
- Object.values(undefined);
- }).toThrowWithMessage(TypeError, "ToObject on null or undefined");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-apply.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-apply.js
deleted file mode 100644
index 0e59d4f473..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-apply.js
+++ /dev/null
@@ -1,36 +0,0 @@
-describe("[[Call]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- let p = new Proxy(() => 5, { apply: null });
- expect(p()).toBe(5);
- p = new Proxy(() => 5, { apply: undefined });
- expect(p()).toBe(5);
- p = new Proxy(() => 5, {});
- expect(p()).toBe(5);
- });
-
- test("correct arguments supplied to trap", () => {
- const f = (a, b) => a + b;
- const handler = {
- apply(target, this_, arguments) {
- expect(target).toBe(f);
- expect(this_).toBe(handler);
- if (arguments[2]) return arguments[0] * arguments[1];
- return f(...arguments);
- },
- };
- p = new Proxy(f, handler);
-
- expect(p(2, 4)).toBe(6);
- expect(p(2, 4, true)).toBe(8);
- });
-});
-
-describe("[[Call]] invariants", () => {
- test("target must have a [[Call]] slot", () => {
- [{}, [], new Proxy({}, {})].forEach(item => {
- expect(() => {
- new Proxy(item, {})();
- }).toThrowWithMessage(TypeError, "[object ProxyObject] is not a function");
- });
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-construct.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-construct.js
deleted file mode 100644
index 73a63346a3..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-construct.js
+++ /dev/null
@@ -1,72 +0,0 @@
-describe("[[Construct]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- let p = new Proxy(
- function () {
- this.x = 5;
- },
- { construct: null }
- );
- expect(new p().x).toBe(5);
- p = new Proxy(
- function () {
- this.x = 5;
- },
- { construct: undefined }
- );
- expect(new p().x).toBe(5);
- p = new Proxy(function () {
- this.x = 5;
- }, {});
- expect(new p().x).toBe(5);
- });
-
- test("trapping 'new'", () => {
- function f(value) {
- this.x = value;
- }
-
- let p;
- const handler = {
- construct(target, arguments, newTarget) {
- expect(target).toBe(f);
- expect(newTarget).toBe(p);
- if (arguments[1]) return Reflect.construct(target, [arguments[0] * 2], newTarget);
- return Reflect.construct(target, arguments, newTarget);
- },
- };
- p = new Proxy(f, handler);
-
- expect(new p(15).x).toBe(15);
- expect(new p(15, true).x).toBe(30);
- });
-
- test("trapping Reflect.construct", () => {
- function f(value) {
- this.x = value;
- }
-
- let p;
- function theNewTarget() {}
- const handler = {
- construct(target, arguments, newTarget) {
- expect(target).toBe(f);
- expect(newTarget).toBe(theNewTarget);
- if (arguments[1]) return Reflect.construct(target, [arguments[0] * 2], newTarget);
- return Reflect.construct(target, arguments, newTarget);
- },
- };
- p = new Proxy(f, handler);
-
- Reflect.construct(p, [15], theNewTarget);
- });
-});
-
-describe("[[Construct]] invariants", () => {
- test("target must have a [[Construct]] slot", () => {
- [{}, [], new Proxy({}, {})].forEach(item => {
- expect(() => {
- new new Proxy(item, {})();
- }).toThrowWithMessage(TypeError, "[object ProxyObject] is not a constructor");
- });
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-defineProperty.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-defineProperty.js
deleted file mode 100644
index 2044ea8084..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-defineProperty.js
+++ /dev/null
@@ -1,133 +0,0 @@
-describe("[[DefineProperty]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- let p = new Proxy({}, { defineProperty: null });
- expect(Object.defineProperty(p, "foo", {})).toBe(p);
- p = new Proxy({}, { defineProperty: undefined });
- expect(Object.defineProperty(p, "foo", {})).toBe(p);
- p = new Proxy({}, {});
- expect(Object.defineProperty(p, "foo", {})).toBe(p);
- });
-
- test("correct arguments passed to trap", () => {
- let o = {};
- p = new Proxy(o, {
- defineProperty(target, name, descriptor) {
- expect(target).toBe(o);
- expect(name).toBe("foo");
- expect(descriptor.configurable).toBeTrue();
- expect(descriptor.enumerable).toBeUndefined();
- expect(descriptor.writable).toBeTrue();
- expect(descriptor.value).toBe(10);
- expect(descriptor.get).toBeUndefined();
- expect(descriptor.set).toBeUndefined();
- return true;
- },
- });
-
- Object.defineProperty(p, "foo", { configurable: true, writable: true, value: 10 });
- });
-
- test("optionally ignoring the define call", () => {
- let o = {};
- let p = new Proxy(o, {
- defineProperty(target, name, descriptor) {
- if (target[name] === undefined) Object.defineProperty(target, name, descriptor);
- return true;
- },
- });
-
- Object.defineProperty(p, "foo", {
- value: 10,
- enumerable: true,
- configurable: false,
- writable: true,
- });
- expect(p).toHaveEnumerableProperty("foo");
- expect(p).not.toHaveConfigurableProperty("foo");
- expect(p).toHaveWritableProperty("foo");
- expect(p).toHaveValueProperty("foo", 10);
- expect(p).not.toHaveGetterProperty("foo");
- expect(p).not.toHaveSetterProperty("foo");
-
- Object.defineProperty(p, "foo", {
- value: 20,
- enumerable: true,
- configurable: false,
- writable: true,
- });
- expect(p).toHaveEnumerableProperty("foo");
- expect(p).not.toHaveConfigurableProperty("foo");
- expect(p).toHaveWritableProperty("foo");
- expect(p).toHaveValueProperty("foo", 10);
- expect(p).not.toHaveGetterProperty("foo");
- expect(p).not.toHaveSetterProperty("foo");
- });
-});
-
-describe("[[DefineProperty]] invariants", () => {
- test("trap can't return false", () => {
- let p = new Proxy(
- {},
- {
- defineProperty() {
- return false;
- },
- }
- );
-
- expect(() => {
- Object.defineProperty(p, "foo", {});
- }).toThrowWithMessage(TypeError, "Object's [[DefineProperty]] method returned false");
- });
-
- test("trap cannot return true for a non-extensible target if the property does not exist", () => {
- let o = {};
- Object.preventExtensions(o);
- let p = new Proxy(o, {
- defineProperty() {
- return true;
- },
- });
-
- expect(() => {
- Object.defineProperty(p, "foo", {});
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's defineProperty trap violates invariant: a property cannot be reported as being defined if the property does not exist on the target and the target is non-extensible"
- );
- });
-
- test("trap cannot return true for a non-configurable property if it doesn't already exist on the target", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: 10, configurable: true });
- let p = new Proxy(o, {
- defineProperty() {
- return true;
- },
- });
-
- expect(() => {
- Object.defineProperty(p, "bar", { value: 6, configurable: false });
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's defineProperty trap violates invariant: a property cannot be defined as non-configurable if it does not already exist on the target object"
- );
- });
-
- test("trap cannot return true for a non-configurable property if it already exists as a configurable property", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: 10, configurable: true });
- let p = new Proxy(o, {
- defineProperty() {
- return true;
- },
- });
-
- expect(() => {
- Object.defineProperty(p, "foo", { value: 6, configurable: false });
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's defineProperty trap violates invariant: a property cannot be defined as non-configurable if it already exists on the target object as a configurable property"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-deleteProperty.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-deleteProperty.js
deleted file mode 100644
index 26ef993789..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-deleteProperty.js
+++ /dev/null
@@ -1,58 +0,0 @@
-describe("[[Delete]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- expect(delete new Proxy({}, { deleteProperty: undefined }).foo).toBeTrue();
- expect(delete new Proxy({}, { deleteProperty: null }).foo).toBeTrue();
- expect(delete new Proxy({}, {}).foo).toBeTrue();
- });
-
- test("correct arguments supplied to trap", () => {
- let o = {};
- let p = new Proxy(o, {
- deleteProperty(target, property) {
- expect(target).toBe(o);
- expect(property).toBe("foo");
- return true;
- },
- });
-
- delete p.foo;
- });
-
- test("conditional deletion", () => {
- o = { foo: 1, bar: 2 };
- p = new Proxy(o, {
- deleteProperty(target, property) {
- if (property === "foo") {
- delete target[property];
- return true;
- }
- return false;
- },
- });
-
- expect(delete p.foo).toBeTrue();
- expect(delete p.bar).toBeFalse();
-
- expect(o.foo).toBeUndefined();
- expect(o.bar).toBe(2);
- });
-});
-
-describe("[[Delete]] invariants", () => {
- test("cannot report a non-configurable own property as deleted", () => {
- let o = {};
- Object.defineProperty(o, "foo", { configurable: false });
- let p = new Proxy(o, {
- deleteProperty() {
- return true;
- },
- });
-
- expect(() => {
- delete p.foo;
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's deleteProperty trap violates invariant: cannot report a non-configurable own property of the target as deleted"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-get.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-get.js
deleted file mode 100644
index 7919b196fe..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-get.js
+++ /dev/null
@@ -1,96 +0,0 @@
-describe("[[Get]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- expect(new Proxy({}, { get: undefined }).foo).toBeUndefined();
- expect(new Proxy({}, { get: null }).foo).toBeUndefined();
- expect(new Proxy({}, {}).foo).toBeUndefined();
- });
-
- test("correct arguments supplied to trap", () => {
- let o = {};
- let p = new Proxy(o, {
- get(target, property, receiver) {
- expect(target).toBe(o);
- expect(property).toBe("foo");
- expect(receiver).toBe(p);
- },
- });
-
- p.foo;
- });
-
- test("conditional return", () => {
- let o = { foo: 1 };
- let p = new Proxy(o, {
- get(target, property, receiver) {
- if (property === "bar") {
- return 2;
- } else if (property === "baz") {
- return receiver.qux;
- } else if (property === "qux") {
- return 3;
- }
- return target[property];
- },
- });
-
- expect(p.foo).toBe(1);
- expect(p.bar).toBe(2);
- expect(p.baz).toBe(3);
- expect(p.qux).toBe(3);
- expect(p.test).toBeUndefined();
- expect(p[Symbol.hasInstance]).toBeUndefined();
- });
-
- test("custom receiver value", () => {
- let p = new Proxy(
- {},
- {
- get(target, property, receiver) {
- return receiver;
- },
- }
- );
-
- expect(Reflect.get(p, "foo", 42)).toBe(42);
- });
-});
-
-describe("[[Get]] invariants", () => {
- test("returned value must match the target property value if the property is non-configurable and non-writable", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: 5, configurable: false, writable: true });
- Object.defineProperty(o, "bar", { value: 10, configurable: false, writable: false });
-
- let p = new Proxy(o, {
- get() {
- return 8;
- },
- });
-
- expect(p.foo).toBe(8);
- expect(() => {
- p.bar;
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's get trap violates invariant: the returned value must match the value on the target if the property exists on the target as a non-writable, non-configurable own data property"
- );
- });
-
- test("returned value must be undefined if the property is a non-configurable accessor with no getter", () => {
- let o = {};
- Object.defineProperty(o, "foo", { configurable: false, set(_) {} });
-
- let p = new Proxy(o, {
- get() {
- return 8;
- },
- });
-
- expect(() => {
- p.foo;
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's get trap violates invariant: the returned value must be undefined if the property exists on the target as a non-configurable accessor property with an undefined get attribute"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getOwnPropertyDescriptor.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getOwnPropertyDescriptor.js
deleted file mode 100644
index 9b9addf14a..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getOwnPropertyDescriptor.js
+++ /dev/null
@@ -1,220 +0,0 @@
-describe("[Call][GetOwnProperty]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- expect(
- Object.getOwnPropertyDescriptor(new Proxy({}, { getOwnPropertyDescriptor: null }), "a")
- ).toBeUndefined();
- expect(
- Object.getOwnPropertyDescriptor(
- new Proxy({}, { getOwnPropertyDescriptor: undefined }),
- "a"
- )
- ).toBeUndefined();
- expect(Object.getOwnPropertyDescriptor(new Proxy({}, {}), "a")).toBeUndefined();
- });
-
- test("correct arguments supplied to trap", () => {
- let o = {};
- let p = new Proxy(o, {
- getOwnPropertyDescriptor(target, property) {
- expect(target).toBe(o);
- expect(property).toBe("foo");
- },
- });
-
- Object.getOwnPropertyDescriptor(p, "foo");
- });
-
- test("conditional returned descriptor", () => {
- let o = { foo: "bar" };
- Object.defineProperty(o, "baz", {
- value: "qux",
- enumerable: false,
- configurable: true,
- writable: false,
- });
-
- let p = new Proxy(o, {
- getOwnPropertyDescriptor(target, property) {
- if (property === "baz") return Object.getOwnPropertyDescriptor(target, "baz");
- return {
- value: target[property],
- enumerable: false,
- configurable: true,
- writable: true,
- };
- },
- });
-
- expect(p).toHaveConfigurableProperty("baz");
- expect(p).not.toHaveEnumerableProperty("baz");
- expect(p).not.toHaveWritableProperty("baz");
- expect(p).toHaveValueProperty("baz", "qux");
- expect(p).not.toHaveGetterProperty("baz");
- expect(p).not.toHaveSetterProperty("baz");
-
- d = Object.getOwnPropertyDescriptor(p, "foo");
-
- expect(p).toHaveConfigurableProperty("foo");
- expect(p).not.toHaveEnumerableProperty("foo");
- expect(p).toHaveWritableProperty("foo");
- expect(p).toHaveValueProperty("foo", "bar");
- expect(p).not.toHaveGetterProperty("foo");
- expect(p).not.toHaveSetterProperty("foo");
- });
-});
-
-describe("[[GetOwnProperty]] invariants", () => {
- test("must return an object or undefined", () => {
- expect(() => {
- Object.getOwnPropertyDescriptor(
- new Proxy(
- {},
- {
- getOwnPropertyDescriptor() {
- return 1;
- },
- }
- )
- );
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getOwnPropertyDescriptor trap violates invariant: must return an object or undefined"
- );
- });
-
- test("cannot return undefined for a non-configurable property", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: 10, configurable: false });
-
- let p = new Proxy(o, {
- getOwnPropertyDescriptor() {
- return undefined;
- },
- });
-
- expect(Object.getOwnPropertyDescriptor(p, "bar")).toBeUndefined();
-
- expect(() => {
- Object.getOwnPropertyDescriptor(p, "foo");
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getOwnPropertyDescriptor trap violates invariant: cannot return undefined for a property on the target which is a non-configurable property"
- );
- });
-
- test("cannot return undefined for an existing property if the target is non-extensible", () => {
- let o = {};
- Object.defineProperty(o, "baz", {
- value: 20,
- configurable: true,
- writable: true,
- enumerable: true,
- });
- Object.preventExtensions(o);
-
- let p = new Proxy(o, {
- getOwnPropertyDescriptor() {
- return undefined;
- },
- });
-
- expect(() => {
- Object.getOwnPropertyDescriptor(p, "baz");
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getOwnPropertyDescriptor trap violates invariant: cannot report a property as being undefined if it exists as an own property of the target and the target is non-extensible"
- );
- });
-
- test("invalid property descriptors", () => {
- let o = {};
- Object.defineProperty(o, "v1", { value: 10, configurable: false });
- Object.defineProperty(o, "v2", { value: 10, configurable: false, enumerable: true });
- Object.defineProperty(o, "v3", {
- configurable: false,
- get() {
- return 1;
- },
- });
- Object.defineProperty(o, "v4", {
- value: 10,
- configurable: false,
- writable: false,
- enumerable: true,
- });
-
- expect(() => {
- Object.getOwnPropertyDescriptor(
- new Proxy(o, {
- getOwnPropertyDescriptor() {
- return { configurable: true };
- },
- }),
- "v1"
- );
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getOwnPropertyDescriptor trap violates invariant: invalid property descriptor for existing property on the target"
- );
-
- expect(() => {
- Object.getOwnPropertyDescriptor(
- new Proxy(o, {
- getOwnPropertyDescriptor() {
- return { enumerable: false };
- },
- }),
- "v2"
- );
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getOwnPropertyDescriptor trap violates invariant: invalid property descriptor for existing property on the target"
- );
-
- expect(() => {
- Object.getOwnPropertyDescriptor(
- new Proxy(o, {
- getOwnPropertyDescriptor() {
- return { value: 10 };
- },
- }),
- "v3"
- );
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getOwnPropertyDescriptor trap violates invariant: invalid property descriptor for existing property on the target"
- );
-
- expect(() => {
- Object.getOwnPropertyDescriptor(
- new Proxy(o, {
- getOwnPropertyDescriptor() {
- return { value: 10, writable: true };
- },
- }),
- "v4"
- );
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getOwnPropertyDescriptor trap violates invariant: invalid property descriptor for existing property on the target"
- );
- });
-
- test("cannot report a property as non-configurable if it does not exist or is non-configurable", () => {
- let o = {};
- Object.defineProperty(o, "v", { configurable: true });
- expect(() => {
- Object.getOwnPropertyDescriptor(
- new Proxy(o, {
- getOwnPropertyDescriptor() {
- return { configurable: false };
- },
- }),
- "v"
- );
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getOwnPropertyDescriptor trap violates invariant: cannot report target's property as non-configurable if the property does not exist, or if it is configurable"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getPrototypeOf.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getPrototypeOf.js
deleted file mode 100644
index 823e1ff392..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getPrototypeOf.js
+++ /dev/null
@@ -1,95 +0,0 @@
-describe("[[GetPrototypeOf]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- let proto = {};
- let o = {};
- Object.setPrototypeOf(o, proto);
-
- let p = new Proxy(o, { prototype: null });
- expect(Object.getPrototypeOf(p)).toBe(proto);
- p = new Proxy(o, { apply: undefined });
- expect(Object.getPrototypeOf(p)).toBe(proto);
- p = new Proxy(o, {});
- expect(Object.getPrototypeOf(p)).toBe(proto);
- });
-
- test("correct arguments supplied to trap", () => {
- let o = {};
- let p = new Proxy(o, {
- getPrototypeOf(target) {
- expect(target).toBe(o);
- return null;
- },
- });
-
- Object.getPrototypeOf(p);
- });
-
- test("conditional return", () => {
- let o = {};
- let p = new Proxy(o, {
- getPrototypeOf(target) {
- if (target.foo) return { bar: 1 };
- return { bar: 2 };
- },
- });
-
- expect(Object.getPrototypeOf(p).bar).toBe(2);
- o.foo = 20;
- expect(Object.getPrototypeOf(p).bar).toBe(1);
- });
-
- test("non-extensible target", () => {
- let o = {};
- let proto = { foo: "bar" };
- Object.setPrototypeOf(o, proto);
- Object.preventExtensions(o);
-
- p = new Proxy(o, {
- getPrototypeOf() {
- return proto;
- },
- });
-
- expect(Object.getPrototypeOf(p).foo).toBe("bar");
- });
-});
-
-describe("[[GetPrototypeOf]] invariants", () => {
- test("must return an object or null", () => {
- expect(() => {
- Object.getPrototypeOf(
- new Proxy(
- {},
- {
- getPrototypeOf() {
- return 1;
- },
- }
- )
- );
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getPrototypeOf trap violates invariant: must return an object or null"
- );
- });
-
- test("different return object for non-extensible target", () => {
- let o = {};
- let proto = {};
- Object.setPrototypeOf(o, proto);
- Object.preventExtensions(o);
-
- let p = new Proxy(o, {
- getPrototypeOf(target) {
- return { baz: "qux" };
- },
- });
-
- expect(() => {
- Object.getPrototypeOf(p);
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's getPrototypeOf trap violates invariant: cannot return a different prototype object for a non-extensible target"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-has.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-has.js
deleted file mode 100644
index b9e2df94ee..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-has.js
+++ /dev/null
@@ -1,74 +0,0 @@
-describe("[[Has]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- expect("foo" in new Proxy({}, { has: null })).toBeFalse();
- expect("foo" in new Proxy({}, { has: undefined })).toBeFalse();
- expect("foo" in new Proxy({}, {})).toBeFalse();
- });
-
- test("correct arguments supplied to trap", () => {
- let o = {};
- let p = new Proxy(o, {
- has(target, prop) {
- expect(target).toBe(o);
- expect(prop).toBe("foo");
- return true;
- },
- });
-
- "foo" in p;
- });
-
- test("conditional return", () => {
- let o = {};
- let p = new Proxy(o, {
- has(target, prop) {
- if (target.checkedFoo) return true;
- if (prop === "foo") target.checkedFoo = true;
- return false;
- },
- });
-
- expect("foo" in p).toBeFalse();
- expect("foo" in p).toBeTrue();
- });
-});
-
-describe("[[Has]] invariants", () => {
- test("cannot return false if the property exists and is non-configurable", () => {
- let o = {};
- Object.defineProperty(o, "foo", { configurable: false });
-
- p = new Proxy(o, {
- has() {
- return false;
- },
- });
-
- expect(() => {
- "foo" in p;
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's has trap violates invariant: a property cannot be reported as non-existent if it exists on the target as a non-configurable property"
- );
- });
-
- test("cannot return false if the property exists and the target is non-extensible", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: 10, configurable: true });
-
- let p = new Proxy(o, {
- has() {
- return false;
- },
- });
-
- Object.preventExtensions(o);
-
- expect(() => {
- "foo" in p;
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's has trap violates invariant: a property cannot be reported as non-existent if it exists on the target and the target is non-extensible"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-isExtensible.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-isExtensible.js
deleted file mode 100644
index 430b0fde56..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-isExtensible.js
+++ /dev/null
@@ -1,39 +0,0 @@
-describe("[[IsExtensible]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- expect(Object.isExtensible(new Proxy({}, { isExtensible: null }))).toBeTrue();
- expect(Object.isExtensible(new Proxy({}, { isExtensible: undefined }))).toBeTrue();
- expect(Object.isExtensible(new Proxy({}, {}))).toBeTrue();
- });
-
- test("correct arguments supplied to trap", () => {
- let o = {};
- let p = new Proxy(o, {
- isExtensible(target) {
- expect(target).toBe(o);
- return true;
- },
- });
-
- expect(Object.isExtensible(p)).toBeTrue();
- });
-});
-
-describe("[[Call]] invariants", () => {
- test("return value must match the target's extensibility", () => {
- let o = {};
- Object.preventExtensions(o);
-
- let p = new Proxy(o, {
- isExtensible() {
- return true;
- },
- });
-
- expect(() => {
- Object.isExtensible(p);
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's isExtensible trap violates invariant: return value must match the target's extensibility"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-preventExtensions.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-preventExtensions.js
deleted file mode 100644
index 13a960faea..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-preventExtensions.js
+++ /dev/null
@@ -1,59 +0,0 @@
-describe("[[PreventExtension]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- let p = new Proxy({}, { preventExtensions: null });
- expect(Object.preventExtensions(p)).toBe(p);
- p = new Proxy({}, { preventExtensions: undefined });
- expect(Object.preventExtensions(p)).toBe(p);
- p = new Proxy({}, {});
- expect(Object.preventExtensions(p)).toBe(p);
- });
-
- test("correct arguments supplied to trap", () => {
- let o = {};
- p = new Proxy(o, {
- preventExtensions(target) {
- expect(target).toBe(o);
- return true;
- },
- });
-
- Object.preventExtensions(o);
- Object.preventExtensions(p);
- });
-});
-
-describe("[[PreventExtensions]] invariants", () => {
- test("cannot return false", () => {
- let p = new Proxy(
- {},
- {
- preventExtensions() {
- return false;
- },
- }
- );
-
- expect(() => {
- Object.preventExtensions(p);
- }).toThrowWithMessage(TypeError, "Object's [[PreventExtensions]] method returned false");
- });
-
- test("cannot return true if the target is extensible", () => {
- let o = {};
- let p = new Proxy(o, {
- preventExtensions() {
- return true;
- },
- });
-
- expect(() => {
- Object.preventExtensions(p);
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's preventExtensions trap violates invariant: cannot return true if the target object is extensible"
- );
-
- Object.preventExtensions(o);
- expect(Object.preventExtensions(p)).toBe(p);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js
deleted file mode 100644
index dd45c51b4b..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js
+++ /dev/null
@@ -1,99 +0,0 @@
-describe("[[Set]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- expect((new Proxy({}, { set: undefined }).foo = 1)).toBe(1);
- expect((new Proxy({}, { set: null }).foo = 1)).toBe(1);
- expect((new Proxy({}, {}).foo = 1)).toBe(1);
- });
-
- test("correct arguments supplied to trap", () => {
- let o = {};
- let p = new Proxy(o, {
- set(target, prop, value, receiver) {
- expect(target).toBe(o);
- expect(prop).toBe("foo");
- expect(value).toBe(10);
- expect(receiver).toBe(p);
- return true;
- },
- });
-
- p.foo = 10;
- });
-
- test("conditional return value", () => {
- let p = new Proxy(
- {},
- {
- set(target, prop, value) {
- if (target[prop] === value) {
- target[prop] *= 2;
- } else {
- target[prop] = value;
- }
- },
- }
- );
-
- p.foo = 10;
- expect(p.foo).toBe(10);
- p.foo = 10;
- expect(p.foo).toBe(20);
- p.foo = 10;
- expect(p.foo).toBe(10);
- p[Symbol.hasInstance] = "foo";
- expect(p[Symbol.hasInstance]).toBe("foo");
- });
-
- test("custom receiver value", () => {
- const o = {};
- const r = {};
- let p = new Proxy(o, {
- set(target, property, value, receiver) {
- receiver[property] = value;
- return true;
- },
- });
-
- expect(Reflect.set(p, "foo", 42, r)).toBe(true);
- expect(o.foo).toBeUndefined();
- expect(r.foo).toBe(42);
- });
-});
-
-describe("[[Set]] invariants", () => {
- test("cannot return true for a non-configurable, non-writable property", () => {
- let o = {};
- Object.defineProperty(o, "foo", { value: 10 });
-
- let p = new Proxy(o, {
- set() {
- return true;
- },
- });
-
- expect(() => {
- p.foo = 12;
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's set trap violates invariant: cannot return true for a property on the target which is a non-configurable, non-writable own data property"
- );
- });
-
- test("cannot return true for a non-configurable accessor property with no setter", () => {
- let o = {};
- Object.defineProperty(o, "foo", { get() {} });
-
- let p = new Proxy(o, {
- set() {
- return true;
- },
- });
-
- expect(() => {
- p.foo = 12;
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's set trap violates invariant: cannot return true for a property on the target which is a non-configurable own accessor property with an undefined set attribute"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-setPrototypeOf.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-setPrototypeOf.js
deleted file mode 100644
index 30909c90f5..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-setPrototypeOf.js
+++ /dev/null
@@ -1,96 +0,0 @@
-describe("[[SetPrototypeOf]] trap normal behavior", () => {
- test("forwarding when not defined in handler", () => {
- const o = {};
- const proto = { foo: "bar" };
- Object.setPrototypeOf(o, proto);
-
- let p = new Proxy(o, { setPrototypeOf: null });
- expect(Object.setPrototypeOf(p, proto)).toBe(p);
- let p = new Proxy(o, { setPrototypeOf: undefined });
- expect(Object.setPrototypeOf(p, proto)).toBe(p);
- let p = new Proxy(o, {});
- expect(Object.setPrototypeOf(p, proto)).toBe(p);
- });
-
- test("correct arguments supplied to trap", () => {
- let o = {};
- let theNewProto = { foo: "bar" };
-
- let p = new Proxy(o, {
- setPrototypeOf(target, newProto) {
- expect(target).toBe(o);
- expect(newProto).toBe(theNewProto);
- return true;
- },
- });
-
- Object.setPrototypeOf(p, theNewProto);
- });
-
- test("conditional setting", () => {
- let o = {};
-
- let p = new Proxy(o, {
- setPrototypeOf(target, newProto) {
- if (target.shouldSet) Object.setPrototypeOf(target, newProto);
- return true;
- },
- });
-
- Object.setPrototypeOf(p, { foo: 1 });
- expect(Object.getPrototypeOf(p).foo).toBeUndefined();
- p.shouldSet = true;
- expect(o.shouldSet).toBeTrue();
- Object.setPrototypeOf(p, { foo: 1 });
- expect(Object.getPrototypeOf(p).foo).toBe(1);
- });
-
- test("non-extensible targets", () => {
- let o = {};
- let proto = {};
- Object.setPrototypeOf(o, proto);
- Object.preventExtensions(o);
-
- p = new Proxy(o, {
- setPrototypeOf() {
- return true;
- },
- });
-
- expect(Object.setPrototypeOf(p, proto)).toBe(p);
- expect(Object.getPrototypeOf(p)).toBe(proto);
- });
-});
-
-describe("[[SetPrototypeOf]] invariants", () => {
- test("cannot return false", () => {
- let o = {};
- p = new Proxy(o, {
- setPrototypeOf() {
- return false;
- },
- });
-
- expect(() => {
- Object.setPrototypeOf(p, {});
- }).toThrowWithMessage(TypeError, "Object's [[SetPrototypeOf]] method returned false");
- });
-
- test("the argument must match the target's prototype if the target is non-extensible", () => {
- let o = {};
- Object.preventExtensions(o);
-
- let p = new Proxy(o, {
- setPrototypeOf() {
- return true;
- },
- });
-
- expect(() => {
- Object.setPrototypeOf(p, {});
- }).toThrowWithMessage(
- TypeError,
- "Proxy handler's setPrototypeOf trap violates invariant: the argument must match the prototype of the target if the target is non-extensible"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js
deleted file mode 100644
index 9e336c2694..0000000000
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js
+++ /dev/null
@@ -1,37 +0,0 @@
-test("constructs properly", () => {
- expect(() => {
- new Proxy({}, {});
- }).not.toThrow();
-});
-
-test("constructor argument count", () => {
- expect(() => {
- new Proxy();
- }).toThrowWithMessage(TypeError, "Proxy constructor requires at least two arguments");
-
- expect(() => {
- new Proxy({});
- }).toThrowWithMessage(TypeError, "Proxy constructor requires at least two arguments");
-});
-
-test("constructor requires objects", () => {
- expect(() => {
- new Proxy(1, {});
- }).toThrowWithMessage(
- TypeError,
- "Expected target argument of Proxy constructor to be object, got 1"
- );
-
- expect(() => {
- new Proxy({}, 1);
- }).toThrowWithMessage(
- TypeError,
- "Expected handler argument of Proxy constructor to be object, got 1"
- );
-});
-
-test("constructor must be invoked with 'new'", () => {
- expect(() => {
- Proxy({}, {});
- }).toThrowWithMessage(TypeError, "Proxy constructor must be called with 'new'");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.apply.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.apply.js
deleted file mode 100644
index 7e6a67d16d..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.apply.js
+++ /dev/null
@@ -1,44 +0,0 @@
-test("length is 3", () => {
- expect(Reflect.apply).toHaveLength(3);
-});
-
-describe("errors", () => {
- test("target must be a function", () => {
- [null, undefined, "foo", 123, NaN, Infinity, {}].forEach(value => {
- expect(() => {
- Reflect.apply(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.apply() must be a function"
- );
- });
- });
-
- test("arguments list must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.apply(() => {}, undefined, value);
- }).toThrowWithMessage(TypeError, "Arguments list must be an object");
- });
- });
-});
-
-describe("normal behavior", () => {
- test("calling built-in functions", () => {
- expect(Reflect.apply(String.prototype.charAt, "foo", [0])).toBe("f");
- expect(Reflect.apply(Array.prototype.indexOf, ["hello", 123, "foo", "bar"], ["foo"])).toBe(
- 2
- );
- });
-
- test("|this| argument is forwarded to called function", () => {
- function Foo(foo) {
- this.foo = foo;
- }
-
- var o = {};
- expect(o.foo).toBeUndefined();
- Reflect.apply(Foo, o, ["bar"]);
- expect(o.foo).toBe("bar");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.construct.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.construct.js
deleted file mode 100644
index a14a016ee0..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.construct.js
+++ /dev/null
@@ -1,75 +0,0 @@
-test("length is 2", () => {
- expect(Reflect.construct).toHaveLength(2);
-});
-
-describe("errors", () => {
- test("target must be a function", () => {
- [null, undefined, "foo", 123, NaN, Infinity, {}].forEach(value => {
- expect(() => {
- Reflect.construct(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.construct() must be a function"
- );
- });
- });
-
- test("arguments list must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.construct(() => {}, value);
- }).toThrowWithMessage(TypeError, "Arguments list must be an object");
- });
- });
-
- test("new target must be a function", () => {
- [null, undefined, "foo", 123, NaN, Infinity, {}].forEach(value => {
- expect(() => {
- Reflect.construct(() => {}, [], value);
- }).toThrowWithMessage(
- TypeError,
- "Optional third argument of Reflect.construct() must be a constructor"
- );
- });
- });
-});
-
-describe("normal behavior", () => {
- test("built-in Array function", () => {
- var a = Reflect.construct(Array, [5]);
- expect(a instanceof Array).toBeTrue();
- expect(a).toHaveLength(5);
- });
-
- test("built-in String function", () => {
- var s = Reflect.construct(String, [123]);
- expect(s instanceof String).toBeTrue();
- expect(s).toHaveLength(3);
- expect(s.toString()).toBe("123");
- });
-
- test("user-defined function", () => {
- function Foo() {
- this.name = "foo";
- }
-
- var o = Reflect.construct(Foo, []);
- expect(o.name).toBe("foo");
- expect(o instanceof Foo).toBeTrue();
- });
-
- test("user-defined function with different new target", () => {
- function Foo() {
- this.name = "foo";
- }
-
- function Bar() {
- this.name = "bar";
- }
-
- var o = Reflect.construct(Foo, [], Bar);
- expect(o.name).toBe("foo");
- expect(o instanceof Foo).toBeFalse();
- expect(o instanceof Bar).toBeTrue();
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.defineProperty.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.defineProperty.js
deleted file mode 100644
index 786d4c0178..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.defineProperty.js
+++ /dev/null
@@ -1,82 +0,0 @@
-test("length is 3", () => {
- expect(Reflect.defineProperty).toHaveLength(3);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.defineProperty(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.defineProperty() must be an object"
- );
- });
- });
-
- test("descriptor must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.defineProperty({}, "foo", value);
- }).toThrowWithMessage(TypeError, "Descriptor argument is not an object");
- });
- });
-});
-
-describe("normal behavior", () => {
- test("initial value and non-writable", () => {
- var o = {};
-
- expect(o.foo).toBeUndefined();
- expect(Reflect.defineProperty(o, "foo", { value: 1, writable: false })).toBeTrue();
- expect(o.foo).toBe(1);
- o.foo = 2;
- expect(o.foo).toBe(1);
- });
-
- test("initial value and writable", () => {
- var o = {};
-
- expect(o.foo).toBeUndefined();
- expect(Reflect.defineProperty(o, "foo", { value: 1, writable: true })).toBeTrue();
- expect(o.foo).toBe(1);
- o.foo = 2;
- expect(o.foo).toBe(2);
- });
-
- test("can redefine value of configurable, writable property", () => {
- var o = {};
-
- expect(o.foo).toBeUndefined();
- expect(
- Reflect.defineProperty(o, "foo", { value: 1, configurable: true, writable: true })
- ).toBeTrue();
- expect(o.foo).toBe(1);
- expect(Reflect.defineProperty(o, "foo", { value: 2 })).toBeTrue();
- expect(o.foo).toBe(2);
- });
-
- test("can redefine value of configurable, non-writable property", () => {
- var o = {};
-
- expect(o.foo).toBeUndefined();
- expect(
- Reflect.defineProperty(o, "foo", { value: 1, configurable: true, writable: false })
- ).toBeTrue();
- expect(o.foo).toBe(1);
- expect(Reflect.defineProperty(o, "foo", { value: 2 })).toBeTrue();
- expect(o.foo).toBe(2);
- });
-
- test("cannot redefine value of non-configurable, non-writable property", () => {
- var o = {};
-
- expect(o.foo).toBeUndefined();
- expect(
- Reflect.defineProperty(o, "foo", { value: 1, configurable: false, writable: false })
- ).toBeTrue();
- expect(o.foo).toBe(1);
- expect(Reflect.defineProperty(o, "foo", { value: 2 })).toBeFalse();
- expect(o.foo).toBe(1);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.deleteProperty.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.deleteProperty.js
deleted file mode 100644
index a0dcbbada7..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.deleteProperty.js
+++ /dev/null
@@ -1,66 +0,0 @@
-test("length is 2", () => {
- expect(Reflect.deleteProperty).toHaveLength(2);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.deleteProperty(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.deleteProperty() must be an object"
- );
- });
- });
-});
-
-describe("normal behavior", () => {
- test("deleting non-existent property", () => {
- expect(Reflect.deleteProperty({})).toBeTrue();
- expect(Reflect.deleteProperty({}, "foo")).toBeTrue();
- });
-
- test("deleting existent property", () => {
- var o = { foo: 1 };
- expect(o.foo).toBe(1);
- expect(Reflect.deleteProperty(o, "foo")).toBeTrue();
- expect(o.foo).toBeUndefined();
- expect(Reflect.deleteProperty(o, "foo")).toBeTrue();
- expect(o.foo).toBeUndefined();
- });
-
- test("deleting existent, configurable, non-writable property", () => {
- var o = {};
- Object.defineProperty(o, "foo", { value: 1, configurable: true, writable: false });
- expect(Reflect.deleteProperty(o, "foo")).toBeTrue();
- expect(o.foo).toBeUndefined();
- });
-
- test("deleting existent, non-configurable, writable property", () => {
- var o = {};
- Object.defineProperty(o, "foo", { value: 1, configurable: false, writable: true });
- expect(Reflect.deleteProperty(o, "foo")).toBeFalse();
- expect(o.foo).toBe(1);
- });
-
- test("deleting existent, non-configurable, non-writable property", () => {
- var o = {};
- Object.defineProperty(o, "foo", { value: 1, configurable: false, writable: false });
- expect(Reflect.deleteProperty(o, "foo")).toBeFalse();
- expect(o.foo).toBe(1);
- });
-
- test("deleting array index", () => {
- var a = [1, 2, 3];
- expect(a).toHaveLength(3);
- expect(a[0]).toBe(1);
- expect(a[1]).toBe(2);
- expect(a[2]).toBe(3);
- expect(Reflect.deleteProperty(a, 1)).toBeTrue();
- expect(a).toHaveLength(3);
- expect(a[0]).toBe(1);
- expect(a[1]).toBeUndefined();
- expect(a[2]).toBe(3);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.get.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.get.js
deleted file mode 100644
index fc9b5f172e..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.get.js
+++ /dev/null
@@ -1,67 +0,0 @@
-test("length is 2", () => {
- expect(Reflect.get).toHaveLength(2);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.get(value);
- }).toThrowWithMessage(TypeError, "First argument of Reflect.get() must be an object");
- });
- });
-});
-
-describe("normal behavior", () => {
- test("regular object", () => {
- expect(Reflect.get({})).toBeUndefined();
- expect(Reflect.get({ undefined: 1 })).toBe(1);
- expect(Reflect.get({ foo: 1 })).toBeUndefined();
- expect(Reflect.get({ foo: 1 }, "foo")).toBe(1);
- });
-
- test("array", () => {
- expect(Reflect.get([])).toBeUndefined();
- expect(Reflect.get([1, 2, 3])).toBeUndefined();
- expect(Reflect.get([1, 2, 3], "0")).toBe(1);
- expect(Reflect.get([1, 2, 3], 0)).toBe(1);
- expect(Reflect.get([1, 2, 3], 1)).toBe(2);
- expect(Reflect.get([1, 2, 3], 2)).toBe(3);
- expect(Reflect.get([1, 2, 3], 4)).toBeUndefined();
- });
-
- test("string object", () => {
- expect(Reflect.get(new String())).toBeUndefined();
- expect(Reflect.get(new String(), 0)).toBeUndefined();
- expect(Reflect.get(new String("foo"), "0")).toBe("f");
- expect(Reflect.get(new String("foo"), 0)).toBe("f");
- expect(Reflect.get(new String("foo"), 1)).toBe("o");
- expect(Reflect.get(new String("foo"), 2)).toBe("o");
- expect(Reflect.get(new String("foo"), 3)).toBeUndefined();
- });
-
- test("getter function", () => {
- const foo = {
- get prop() {
- this.getPropCalled = true;
- },
- };
- const bar = {};
- Object.setPrototypeOf(bar, foo);
-
- expect(foo.getPropCalled).toBeUndefined();
- expect(bar.getPropCalled).toBeUndefined();
-
- Reflect.get(bar, "prop");
- expect(foo.getPropCalled).toBeUndefined();
- expect(bar.getPropCalled).toBeTrue();
-
- Reflect.get(bar, "prop", foo);
- expect(foo.getPropCalled).toBeTrue();
- expect(bar.getPropCalled).toBeTrue();
- });
-
- test("native getter function", () => {
- expect(Reflect.get(String.prototype, "length", "foo")).toBe(3);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.getOwnPropertyDescriptor.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.getOwnPropertyDescriptor.js
deleted file mode 100644
index e343a3f6fc..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.getOwnPropertyDescriptor.js
+++ /dev/null
@@ -1,41 +0,0 @@
-test("length is 2", () => {
- expect(Reflect.getOwnPropertyDescriptor).toHaveLength(2);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.getOwnPropertyDescriptor(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.getOwnPropertyDescriptor() must be an object"
- );
- });
- });
-});
-
-describe("normal behavior", () => {
- test("get descriptor of undefined object property", () => {
- expect(Reflect.getOwnPropertyDescriptor({})).toBeUndefined();
- expect(Reflect.getOwnPropertyDescriptor({}, "foo")).toBeUndefined();
- });
-
- test("get descriptor of defined object property", () => {
- var o = { foo: "bar" };
- var d = Reflect.getOwnPropertyDescriptor(o, "foo");
- expect(d.value).toBe("bar");
- expect(d.writable).toBeTrue();
- expect(d.enumerable).toBeTrue();
- expect(d.configurable).toBeTrue();
- });
-
- test("get descriptor of array length property", () => {
- var a = [];
- d = Reflect.getOwnPropertyDescriptor(a, "length");
- expect(d.value).toBe(0);
- expect(d.writable).toBeTrue();
- expect(d.enumerable).toBeFalse();
- expect(d.configurable).toBeFalse();
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.getPrototypeOf.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.getPrototypeOf.js
deleted file mode 100644
index 87c9a63e87..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.getPrototypeOf.js
+++ /dev/null
@@ -1,37 +0,0 @@
-test("length is 1", () => {
- expect(Reflect.getPrototypeOf).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.getPrototypeOf(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.getPrototypeOf() must be an object"
- );
- });
- });
-});
-
-describe("normal behavior", () => {
- test("get prototype of regular object", () => {
- expect(Reflect.getPrototypeOf({})).toBe(Object.prototype);
- });
-
- test("get prototype of array", () => {
- expect(Reflect.getPrototypeOf([])).toBe(Array.prototype);
- });
-
- test("get prototype of string object", () => {
- expect(Reflect.getPrototypeOf(new String())).toBe(String.prototype);
- });
-
- test("get user-defined prototype of regular object", () => {
- var o = {};
- var p = { foo: "bar" };
- Reflect.setPrototypeOf(o, p);
- expect(Reflect.getPrototypeOf(o)).toBe(p);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.has.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.has.js
deleted file mode 100644
index f343daeafa..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.has.js
+++ /dev/null
@@ -1,45 +0,0 @@
-test("length is 2", () => {
- expect(Reflect.has).toHaveLength(2);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.has(value);
- }).toThrowWithMessage(TypeError, "First argument of Reflect.has() must be an object");
- });
- });
-});
-
-describe("normal behavior", () => {
- test("regular object has property", () => {
- expect(Reflect.has({})).toBeFalse();
- expect(Reflect.has({ undefined })).toBeTrue();
- expect(Reflect.has({ 0: "1" }, "0")).toBeTrue();
- expect(Reflect.has({ foo: "bar" }, "foo")).toBeTrue();
- expect(Reflect.has({ bar: "baz" }, "foo")).toBeFalse();
- expect(Reflect.has({}, "toString")).toBeTrue();
- });
-
- test("array has property", () => {
- expect(Reflect.has([])).toBeFalse();
- expect(Reflect.has([], 0)).toBeFalse();
- expect(Reflect.has([1, 2, 3], "0")).toBeTrue();
- expect(Reflect.has([1, 2, 3], 0)).toBeTrue();
- expect(Reflect.has([1, 2, 3], 1)).toBeTrue();
- expect(Reflect.has([1, 2, 3], 2)).toBeTrue();
- expect(Reflect.has([1, 2, 3], 3)).toBeFalse();
- expect(Reflect.has([], "pop")).toBeTrue();
- });
-
- test("string object has property", () => {
- expect(Reflect.has(new String())).toBeFalse();
- expect(Reflect.has(new String("foo"), "0")).toBeTrue();
- expect(Reflect.has(new String("foo"), 0)).toBeTrue();
- expect(Reflect.has(new String("foo"), 1)).toBeTrue();
- expect(Reflect.has(new String("foo"), 2)).toBeTrue();
- expect(Reflect.has(new String("foo"), 3)).toBeFalse();
- expect(Reflect.has(new String("foo"), "charAt")).toBeTrue();
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.isExtensible.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.isExtensible.js
deleted file mode 100644
index 2f873da66c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.isExtensible.js
+++ /dev/null
@@ -1,33 +0,0 @@
-test("length is 1", () => {
- expect(Reflect.isExtensible).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.isExtensible(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.isExtensible() must be an object"
- );
- });
- });
-});
-
-describe("normal behavior", () => {
- test("regular object is extensible", () => {
- expect(Reflect.isExtensible({})).toBeTrue();
- });
-
- test("global object is extensible", () => {
- expect(Reflect.isExtensible(globalThis)).toBeTrue();
- });
-
- test("regular object is not extensible after preventExtensions()", () => {
- var o = {};
- expect(Reflect.isExtensible(o)).toBeTrue();
- Reflect.preventExtensions(o);
- expect(Reflect.isExtensible(o)).toBeFalse();
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.ownKeys.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.ownKeys.js
deleted file mode 100644
index b262775f1a..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.ownKeys.js
+++ /dev/null
@@ -1,51 +0,0 @@
-test("length is 1", () => {
- expect(Reflect.ownKeys).toHaveLength(1);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.ownKeys(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.ownKeys() must be an object"
- );
- });
- });
-});
-
-describe("normal behavior", () => {
- test("regular empty object has no own keys", () => {
- var objectOwnKeys = Reflect.ownKeys({});
- expect(objectOwnKeys instanceof Array).toBeTrue();
- expect(objectOwnKeys).toHaveLength(0);
- });
-
- test("regular object with some properties has own keys", () => {
- var objectOwnKeys = Reflect.ownKeys({ foo: "bar", bar: "baz", 0: 42 });
- expect(objectOwnKeys instanceof Array).toBeTrue();
- expect(objectOwnKeys).toHaveLength(3);
- expect(objectOwnKeys[0]).toBe("0");
- expect(objectOwnKeys[1]).toBe("foo");
- expect(objectOwnKeys[2]).toBe("bar");
- });
-
- test("empty array has only 'length' own key", () => {
- var arrayOwnKeys = Reflect.ownKeys([]);
- expect(arrayOwnKeys instanceof Array).toBeTrue();
- expect(arrayOwnKeys).toHaveLength(1);
- expect(arrayOwnKeys[0]).toBe("length");
- });
-
- test("array with some values has 'lenght' and indices own keys", () => {
- var arrayOwnKeys = Reflect.ownKeys(["foo", [], 123, undefined]);
- expect(arrayOwnKeys instanceof Array).toBeTrue();
- expect(arrayOwnKeys).toHaveLength(5);
- expect(arrayOwnKeys[0]).toBe("0");
- expect(arrayOwnKeys[1]).toBe("1");
- expect(arrayOwnKeys[2]).toBe("2");
- expect(arrayOwnKeys[3]).toBe("3");
- expect(arrayOwnKeys[4]).toBe("length");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.preventExtensions.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.preventExtensions.js
deleted file mode 100644
index 6b0bfdc1bc..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.preventExtensions.js
+++ /dev/null
@@ -1,42 +0,0 @@
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.preventExtensions(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.preventExtensions() must be an object"
- );
- });
- });
-});
-
-describe("normal behavior", () => {
- test("length is 1", () => {
- expect(Reflect.preventExtensions).toHaveLength(1);
- });
-
- test("properties cannot be added", () => {
- var o = {};
- o.foo = "foo";
- expect(Reflect.preventExtensions(o)).toBeTrue();
- o.bar = "bar";
- expect(o.foo).toBe("foo");
- expect(o.bar).toBeUndefined();
- });
-
- test("modifying existing properties", () => {
- const o = {};
- o.foo = "foo";
- expect(Reflect.preventExtensions(o)).toBeTrue();
- o.foo = "bar";
- expect(o.foo).toBe("bar");
- });
-
- test("deleting existing properties", () => {
- const o = { foo: "bar" };
- Reflect.preventExtensions(o);
- delete o.foo;
- expect(o).not.toHaveProperty("foo");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.set.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.set.js
deleted file mode 100644
index 854fb23888..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.set.js
+++ /dev/null
@@ -1,102 +0,0 @@
-test("length is 3", () => {
- expect(Reflect.set).toHaveLength(3);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.set(value);
- }).toThrowWithMessage(TypeError, "First argument of Reflect.set() must be an object");
- });
- });
-});
-
-describe("normal behavior", () => {
- test("setting properties of regular object", () => {
- var o = {};
-
- expect(Reflect.set(o)).toBeTrue();
- expect(o.undefined).toBeUndefined();
-
- expect(Reflect.set(o, "foo")).toBeTrue();
- expect(o.foo).toBeUndefined();
-
- expect(Reflect.set(o, "foo", "bar")).toBeTrue();
- expect(o.foo).toBe("bar");
-
- expect(Reflect.set(o, "foo", 42)).toBeTrue();
- expect(o.foo).toBe(42);
- });
-
- test("setting configurable, non-writable property of regular object", () => {
- var o = {};
- Object.defineProperty(o, "foo", { value: 1, configurable: true, writable: false });
- expect(Reflect.set(o, "foo", 2)).toBeFalse();
- expect(o.foo).toBe(1);
- });
-
- test("setting non-configurable, writable property of regular object", () => {
- var o = {};
- Object.defineProperty(o, "foo", { value: 1, configurable: false, writable: true });
- expect(Reflect.set(o, "foo", 2)).toBeTrue();
- expect(o.foo).toBe(2);
- });
-
- test("", () => {
- var a = [];
- expect(a.length === 0);
- expect(Reflect.set(a, "0")).toBeTrue();
- expect(a.length === 1);
- expect(a[0]).toBeUndefined();
- expect(Reflect.set(a, 1, "foo")).toBeTrue();
- expect(a.length === 2);
- expect(a[0]).toBeUndefined();
- expect(a[1] === "foo");
- expect(Reflect.set(a, 4, "bar")).toBeTrue();
- expect(a.length === 5);
- expect(a[0]).toBeUndefined();
- expect(a[1] === "foo");
- expect(a[2]).toBeUndefined();
- expect(a[3]).toBeUndefined();
- expect(a[4] === "bar");
- });
-
- test("setting setter property of regular object", () => {
- const foo = {
- set prop(value) {
- this.setPropCalled = true;
- },
- };
- expect(foo.setPropCalled).toBeUndefined();
- Reflect.set(foo, "prop", 42);
- expect(foo.setPropCalled).toBeTrue();
- });
-
- test("setting setter property of regular object with different receiver", () => {
- const foo = {
- set prop(value) {
- this.setPropCalled = true;
- },
- };
- const bar = {};
- Object.setPrototypeOf(bar, foo);
-
- expect(foo.setPropCalled).toBeUndefined();
- expect(bar.setPropCalled).toBeUndefined();
-
- Reflect.set(bar, "prop", 42);
- expect(foo.setPropCalled).toBeUndefined();
- expect(bar.setPropCalled).toBeTrue();
-
- Reflect.set(bar, "prop", 42, foo);
- expect(foo.setPropCalled).toBeTrue();
- expect(bar.setPropCalled).toBeTrue();
- });
-
- test("native setter function", () => {
- const e = new Error();
- Reflect.set(Error.prototype, "name", "Foo", e);
- expect(e.name).toBe("Foo");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.setPrototypeOf.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.setPrototypeOf.js
deleted file mode 100644
index 70bbdf9d9c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.setPrototypeOf.js
+++ /dev/null
@@ -1,57 +0,0 @@
-test("length is 2", () => {
- expect(Reflect.setPrototypeOf).toHaveLength(2);
-});
-
-describe("errors", () => {
- test("target must be an object", () => {
- [null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.setPrototypeOf(value);
- }).toThrowWithMessage(
- TypeError,
- "First argument of Reflect.setPrototypeOf() must be an object"
- );
- });
- });
-
- test("prototype must be an object or null", () => {
- [undefined, "foo", 123, NaN, Infinity].forEach(value => {
- expect(() => {
- Reflect.setPrototypeOf({}, value);
- }).toThrowWithMessage(TypeError, "Prototype must be an object or null");
- });
- });
-});
-
-describe("normal behavior", () => {
- test("setting prototype of regular object", () => {
- expect(Reflect.setPrototypeOf({}, null)).toBeTrue();
- expect(Reflect.setPrototypeOf({}, {})).toBeTrue();
- expect(Reflect.setPrototypeOf({}, Object.prototype)).toBeTrue();
- expect(Reflect.setPrototypeOf({}, Array.prototype)).toBeTrue();
- expect(Reflect.setPrototypeOf({}, String.prototype)).toBeTrue();
- expect(Reflect.setPrototypeOf({}, Reflect.getPrototypeOf({}))).toBeTrue();
- });
-
- test("setting user-defined prototype of regular object", () => {
- var o = {};
- var p = { foo: "bar" };
- expect(o.foo).toBeUndefined();
- expect(Reflect.setPrototypeOf(o, p)).toBeTrue();
- expect(o.foo).toBe("bar");
- });
-
- test("setting prototype of non-extensible object", () => {
- var o = {};
- Reflect.preventExtensions(o);
- expect(Reflect.setPrototypeOf(o, {})).toBeFalse();
- });
-
- test("setting same prototype of non-extensible object", () => {
- var o = {};
- var p = { foo: "bar" };
- expect(Reflect.setPrototypeOf(o, p)).toBeTrue();
- Reflect.preventExtensions(o);
- expect(Reflect.setPrototypeOf(o, p)).toBeTrue();
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.js b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.js
deleted file mode 100644
index 9ae8ab97c0..0000000000
--- a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.js
+++ /dev/null
@@ -1,8 +0,0 @@
-test("basic functionality", () => {
- expect(RegExp().toString()).toBe("/(?:)/");
- expect(RegExp(undefined).toString()).toBe("/(?:)/");
- expect(RegExp("foo").toString()).toBe("/foo/");
- expect(RegExp("foo", undefined).toString()).toBe("/foo/");
- expect(RegExp("foo", "g").toString()).toBe("/foo/g");
- expect(RegExp(undefined, "g").toString()).toBe("/(?:)/g");
-});
diff --git a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.exec.js b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.exec.js
deleted file mode 100644
index 7fcbf3582a..0000000000
--- a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.exec.js
+++ /dev/null
@@ -1,58 +0,0 @@
-test("basic functionality", () => {
- let re = /foo/;
- expect(re.exec.length).toBe(1);
-
- let res = re.exec("foo");
- expect(res.length).toBe(1);
- expect(res[0]).toBe("foo");
- expect(res.groups).toBe(undefined);
- expect(res.index).toBe(0);
-});
-
-test("basic unnamed captures", () => {
- let re = /f(o.*)/;
- let res = re.exec("fooooo");
-
- expect(res.length).toBe(2);
- expect(res[0]).toBe("fooooo");
- expect(res[1]).toBe("ooooo");
- expect(res.groups).toBe(undefined);
- expect(res.index).toBe(0);
-});
-
-test("basic named captures", () => {
- let re = /f(?<os>o.*)/;
- let res = re.exec("fooooo");
-
- expect(res.length).toBe(1);
- expect(res.index).toBe(0);
- expect(res[0]).toBe("fooooo");
- expect(res.groups).not.toBe(undefined);
- expect(res.groups.os).toBe("ooooo");
-});
-
-test("basic index", () => {
- let re = /foo/;
- let res = re.exec("abcfoo");
-
- expect(res.length).toBe(1);
- expect(res.index).toBe(3);
- expect(res[0]).toBe("foo");
-});
-
-test("basic index with global and initial offset", () => {
- let re = /foo/g;
- re.lastIndex = 2;
- let res = re.exec("abcfoo");
-
- expect(res.length).toBe(1);
- expect(res.index).toBe(3);
- expect(res[0]).toBe("foo");
-});
-
-test("not matching", () => {
- let re = /foo/;
- let res = re.exec("bar");
-
- expect(res).toBe(null);
-});
diff --git a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.flags.js b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.flags.js
deleted file mode 100644
index 9ccc0b614e..0000000000
--- a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.flags.js
+++ /dev/null
@@ -1,11 +0,0 @@
-test("basic functionality", () => {
- expect(/foo/.flags).toBe("");
- expect(/foo/g.flags).toBe("g");
- expect(/foo/i.flags).toBe("i");
- expect(/foo/m.flags).toBe("m");
- expect(/foo/s.flags).toBe("s");
- expect(/foo/u.flags).toBe("u");
- expect(/foo/y.flags).toBe("y");
- // prettier-ignore
- expect(/foo/sgimyu.flags).toBe("gimsuy");
-});
diff --git a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.source.js b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.source.js
deleted file mode 100644
index 4f0e14297f..0000000000
--- a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.source.js
+++ /dev/null
@@ -1,8 +0,0 @@
-test("basic functionality", () => {
- expect(RegExp.prototype.source).toBe("(?:)");
- expect(RegExp().source).toBe("(?:)");
- expect(/test/.source).toBe("test");
- expect(/\n/.source).toBe("\\n");
- // FIXME: RegExp parse doesn't parse \/ :(
- // expect(/foo\/bar/.source).toBe("foo\\/bar");
-});
diff --git a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.test.js b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.test.js
deleted file mode 100644
index df3e8b9771..0000000000
--- a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.test.js
+++ /dev/null
@@ -1,58 +0,0 @@
-test("basic functionality", () => {
- expect(RegExp.prototype.test).toHaveLength(1);
-});
-
-test("simple test", () => {
- let re = /test/;
- expect(re.test("test")).toBe(true);
- expect(re.test("test")).toBe(true);
-});
-
-test("simple global test", () => {
- let re = /test/g;
- expect(re.test("testtest")).toBe(true);
- expect(re.test("testtest")).toBe(true);
- expect(re.test("testtest")).toBe(false);
- expect(re.test("testtest")).toBe(true);
- expect(re.test("testtest")).toBe(true);
-});
-
-test("global test with offset lastIndex", () => {
- let re = /test/g;
- re.lastIndex = 2;
- expect(re.test("testtest")).toBe(true);
- expect(re.test("testtest")).toBe(false);
- expect(re.test("testtest")).toBe(true);
- expect(re.test("testtest")).toBe(true);
- expect(re.test("testtest")).toBe(false);
-});
-
-test("sticky test with offset lastIndex", () => {
- let re = /test/y;
- re.lastIndex = 2;
- expect(re.test("aatest")).toBe(true);
- expect(re.test("aatest")).toBe(false);
- expect(re.test("aatest")).toBe(false);
-});
-
-test("flag and options", () => {
- expect(/foo/gi.flags).toBe("gi");
- expect(/foo/mu.flags).toBe("mu");
- expect(/foo/gimsuy.flags).toBe("gimsuy");
-
- let re = /foo/gim;
- expect(re.dotAll).toBe(false);
- expect(re.global).toBe(true);
- expect(re.ignoreCase).toBe(true);
- expect(re.multiline).toBe(true);
- expect(re.sticky).toBe(false);
- expect(re.unicode).toBe(false);
-
- expect(() => {
- /foo/gg;
- }).toThrowWithMessage(SyntaxError, "Repeated RegExp flag 'g'");
-
- expect(() => {
- /foo/x;
- }).toThrowWithMessage(SyntaxError, "Invalid RegExp flag 'x'");
-});
diff --git a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.toString.js b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.toString.js
deleted file mode 100644
index fcf132862d..0000000000
--- a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.toString.js
+++ /dev/null
@@ -1,6 +0,0 @@
-test("basic functionality", () => {
- expect(RegExp.prototype.toString).toHaveLength(0);
-
- expect(/test/g.toString()).toBe("/test/g");
- expect(RegExp.prototype.toString.call({ source: "test", flags: "g" })).toBe("/test/g");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.fromCharCode.js b/Libraries/LibJS/Tests/builtins/String/String.fromCharCode.js
deleted file mode 100644
index c6b52fd2e1..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.fromCharCode.js
+++ /dev/null
@@ -1,17 +0,0 @@
-test("basic functionality", () => {
- expect(String.fromCharCode).toHaveLength(1);
-
- expect(String.fromCharCode()).toBe("");
- expect(String.fromCharCode(0)).toBe("\u0000");
- expect(String.fromCharCode(false)).toBe("\u0000");
- expect(String.fromCharCode(null)).toBe("\u0000");
- expect(String.fromCharCode(undefined)).toBe("\u0000");
- expect(String.fromCharCode(1)).toBe("\u0001");
- expect(String.fromCharCode(true)).toBe("\u0001");
- expect(String.fromCharCode(-1)).toBe("\uffff");
- expect(String.fromCharCode(0xffff)).toBe("\uffff");
- expect(String.fromCharCode(0x123ffff)).toBe("\uffff");
- expect(String.fromCharCode(65)).toBe("A");
- expect(String.fromCharCode(65, 66, 67)).toBe("ABC");
- expect(String.fromCharCode(228, 246, 252)).toBe("äöü");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.js b/Libraries/LibJS/Tests/builtins/String/String.js
deleted file mode 100644
index 687e0929d4..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("constructor properties", () => {
- expect(String).toHaveLength(1);
- expect(String.name).toBe("String");
-});
-
-test("typeof", () => {
- expect(typeof String()).toBe("string");
- expect(typeof new String()).toBe("object");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype-generic-functions.js b/Libraries/LibJS/Tests/builtins/String/String.prototype-generic-functions.js
deleted file mode 100644
index a05ca53d8c..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype-generic-functions.js
+++ /dev/null
@@ -1,39 +0,0 @@
-test("basic functionality", () => {
- const genericStringPrototypeFunctions = [
- "charAt",
- "charCodeAt",
- "repeat",
- "startsWith",
- "endsWith",
- "indexOf",
- "toLowerCase",
- "toUpperCase",
- "padStart",
- "padEnd",
- "trim",
- "trimStart",
- "trimEnd",
- "concat",
- "substring",
- "includes",
- "slice",
- ];
-
- genericStringPrototypeFunctions.forEach(name => {
- String.prototype[name].call({ toString: () => "hello friends" });
- String.prototype[name].call({ toString: () => 123 });
- String.prototype[name].call({ toString: () => undefined });
-
- expect(() => {
- String.prototype[name].call({ toString: () => new String() });
- }).toThrowWithMessage(TypeError, "Cannot convert object to string");
-
- expect(() => {
- String.prototype[name].call({ toString: () => [] });
- }).toThrowWithMessage(TypeError, "Cannot convert object to string");
-
- expect(() => {
- String.prototype[name].call({ toString: () => ({}) });
- }).toThrowWithMessage(TypeError, "Cannot convert object to string");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.charAt.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.charAt.js
deleted file mode 100644
index 7747331885..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.charAt.js
+++ /dev/null
@@ -1,20 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.charAt).toHaveLength(1);
-
- var s = "foobar";
- expect(typeof s).toBe("string");
- expect(s).toHaveLength(6);
-
- expect(s.charAt(0)).toBe("f");
- expect(s.charAt(1)).toBe("o");
- expect(s.charAt(2)).toBe("o");
- expect(s.charAt(3)).toBe("b");
- expect(s.charAt(4)).toBe("a");
- expect(s.charAt(5)).toBe("r");
- expect(s.charAt(6)).toBe("");
-
- expect(s.charAt()).toBe("f");
- expect(s.charAt(NaN)).toBe("f");
- expect(s.charAt("foo")).toBe("f");
- expect(s.charAt(undefined)).toBe("f");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.charCodeAt.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.charCodeAt.js
deleted file mode 100644
index e7ebd9d0d3..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.charCodeAt.js
+++ /dev/null
@@ -1,21 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.charAt).toHaveLength(1);
-
- var s = "Foobar";
- expect(typeof s).toBe("string");
- expect(s).toHaveLength(6);
-
- expect(s.charCodeAt(0)).toBe(70);
- expect(s.charCodeAt(1)).toBe(111);
- expect(s.charCodeAt(2)).toBe(111);
- expect(s.charCodeAt(3)).toBe(98);
- expect(s.charCodeAt(4)).toBe(97);
- expect(s.charCodeAt(5)).toBe(114);
- expect(s.charCodeAt(6)).toBe(NaN);
- expect(s.charCodeAt(-1)).toBe(NaN);
-
- expect(s.charCodeAt()).toBe(70);
- expect(s.charCodeAt(NaN)).toBe(70);
- expect(s.charCodeAt("foo")).toBe(70);
- expect(s.charCodeAt(undefined)).toBe(70);
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.concat.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.concat.js
deleted file mode 100644
index 7a38877e9e..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.concat.js
+++ /dev/null
@@ -1,17 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.concat).toHaveLength(1);
-
- expect("".concat(1)).toBe("1");
- expect("".concat(3, 2, 1)).toBe("321");
- expect("hello".concat(" ", "friends")).toBe("hello friends");
- expect("".concat(null)).toBe("null");
- expect("".concat(false)).toBe("false");
- expect("".concat(true)).toBe("true");
- expect("".concat([])).toBe("");
- expect("".concat([1, 2, 3, "hello"])).toBe("1,2,3,hello");
- expect("".concat(true, [])).toBe("true");
- expect("".concat(true, false)).toBe("truefalse");
- expect("".concat({})).toBe("[object Object]");
- expect("".concat(1, {})).toBe("1[object Object]");
- expect("".concat(1, {}, false)).toBe("1[object Object]false");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.endsWith.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.endsWith.js
deleted file mode 100644
index 286cc6b1b2..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.endsWith.js
+++ /dev/null
@@ -1,42 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.endsWith).toHaveLength(1);
-
- var s = "foobar";
- expect(s.endsWith("r")).toBeTrue();
- expect(s.endsWith("ar")).toBeTrue();
- expect(s.endsWith("bar")).toBeTrue();
- expect(s.endsWith("obar")).toBeTrue();
- expect(s.endsWith("oobar")).toBeTrue();
- expect(s.endsWith("foobar")).toBeTrue();
- expect(s.endsWith("1foobar")).toBeFalse();
- expect(s.endsWith("r", 6)).toBeTrue();
- expect(s.endsWith("ar", 6)).toBeTrue();
- expect(s.endsWith("bar", 6)).toBeTrue();
- expect(s.endsWith("obar", 6)).toBeTrue();
- expect(s.endsWith("oobar", 6)).toBeTrue();
- expect(s.endsWith("foobar", 6)).toBeTrue();
- expect(s.endsWith("1foobar", 6)).toBeFalse();
- expect(s.endsWith("bar", [])).toBeFalse();
- expect(s.endsWith("bar", null)).toBeFalse();
- expect(s.endsWith("bar", false)).toBeFalse();
- expect(s.endsWith("bar", true)).toBeFalse();
- expect(s.endsWith("f", true)).toBeTrue();
- expect(s.endsWith("bar", -1)).toBeFalse();
- expect(s.endsWith("bar", 42)).toBeTrue();
- expect(s.endsWith("foo", 3)).toBeTrue();
- expect(s.endsWith("foo", "3")).toBeTrue();
- expect(s.endsWith("foo1", 3)).toBeFalse();
- expect(s.endsWith("foo", 3.7)).toBeTrue();
- expect(s.endsWith()).toBeFalse();
- expect(s.endsWith("")).toBeTrue();
- expect(s.endsWith("", 0)).toBeTrue();
- expect(s.endsWith("", 1)).toBeTrue();
- expect(s.endsWith("", -1)).toBeTrue();
- expect(s.endsWith("", 42)).toBeTrue();
- expect("12undefined".endsWith()).toBeTrue();
- expect(() => s.endsWith(/foobar/)).toThrowWithMessage(
- TypeError,
- "searchString is not a string, but a regular expression"
- );
- expect(s.endsWith("bar", undefined)).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.includes.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.includes.js
deleted file mode 100644
index 14a2230530..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.includes.js
+++ /dev/null
@@ -1,12 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.includes).toHaveLength(1);
-
- expect("hello friends".includes("hello")).toBeTrue();
- expect("hello friends".includes("hello", 100)).toBeFalse();
- expect("hello friends".includes("hello", -10)).toBeTrue();
- expect("hello friends".includes("friends", 6)).toBeTrue();
- expect("hello friends".includes("hello", 6)).toBeFalse();
- expect("hello friends false".includes(false)).toBeTrue();
- expect("hello 10 friends".includes(10)).toBeTrue();
- expect("hello friends undefined".includes()).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.indexOf.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.indexOf.js
deleted file mode 100644
index 8e2ca2f892..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.indexOf.js
+++ /dev/null
@@ -1,8 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.indexOf).toHaveLength(1);
-
- var s = "hello friends";
-
- expect(s.indexOf("friends")).toBe(6);
- expect(s.indexOf("enemies")).toBe(-1);
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.js
deleted file mode 100644
index a66207e96c..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype).toHaveLength(0);
-
- expect(typeof Object.getPrototypeOf("")).toBe("object");
- expect(Object.getPrototypeOf("").valueOf()).toBe("");
-
- expect(typeof String.prototype).toBe("object");
- expect(String.prototype.valueOf()).toBe("");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.lastIndexOf.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.lastIndexOf.js
deleted file mode 100644
index ce69fc3214..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.lastIndexOf.js
+++ /dev/null
@@ -1,22 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.lastIndexOf).toHaveLength(1);
-
- expect("hello friends".lastIndexOf()).toBe(-1);
- expect("hello friends".lastIndexOf("e")).toBe(9);
- expect("hello friends".lastIndexOf("e", -7)).toBe(-1);
- expect("hello friends".lastIndexOf("e", 100)).toBe(9);
- expect("hello friends".lastIndexOf("")).toBe(13);
- expect("hello friends".lastIndexOf("Z")).toBe(-1);
- expect("hello friends".lastIndexOf("serenity")).toBe(-1);
- expect("hello friends".lastIndexOf("", 4)).toBe(4);
- expect("hello serenity friends".lastIndexOf("serenity")).toBe(6);
- expect("hello serenity friends serenity".lastIndexOf("serenity")).toBe(23);
- expect("hello serenity friends serenity".lastIndexOf("serenity", 14)).toBe(6);
- expect("".lastIndexOf("")).toBe(0);
- expect("".lastIndexOf("", 1)).toBe(0);
- expect("".lastIndexOf("", -1)).toBe(0);
- expect("hello friends serenity".lastIndexOf("h", 10)).toBe(0);
- expect("hello friends serenity".lastIndexOf("l", 4)).toBe(3);
- expect("hello friends serenity".lastIndexOf("s", 13)).toBe(12);
- expect("hello".lastIndexOf("serenity")).toBe(-1);
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.padEnd.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.padEnd.js
deleted file mode 100644
index a103084c3a..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.padEnd.js
+++ /dev/null
@@ -1,18 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.padEnd).toHaveLength(1);
-
- var s = "foo";
- expect(s.padEnd(-1)).toBe("foo");
- expect(s.padEnd(0)).toBe("foo");
- expect(s.padEnd(3)).toBe("foo");
- expect(s.padEnd(5)).toBe("foo ");
- expect(s.padEnd(10)).toBe("foo ");
- expect(s.padEnd("5")).toBe("foo ");
- expect(s.padEnd([[["5"]]])).toBe("foo ");
- expect(s.padEnd(2, "+")).toBe("foo");
- expect(s.padEnd(5, "+")).toBe("foo++");
- expect(s.padEnd(5, 1)).toBe("foo11");
- expect(s.padEnd(10, null)).toBe("foonullnul");
- expect(s.padEnd(10, "bar")).toBe("foobarbarb");
- expect(s.padEnd(10, "123456789")).toBe("foo1234567");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.padStart.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.padStart.js
deleted file mode 100644
index a2f0f0b710..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.padStart.js
+++ /dev/null
@@ -1,18 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.padStart).toHaveLength(1);
-
- var s = "foo";
- expect(s.padStart(-1)).toBe("foo");
- expect(s.padStart(0)).toBe("foo");
- expect(s.padStart(3)).toBe("foo");
- expect(s.padStart(5)).toBe(" foo");
- expect(s.padStart(10)).toBe(" foo");
- expect(s.padStart("5")).toBe(" foo");
- expect(s.padStart([[["5"]]])).toBe(" foo");
- expect(s.padStart(2, "+")).toBe("foo");
- expect(s.padStart(5, "+")).toBe("++foo");
- expect(s.padStart(5, 1)).toBe("11foo");
- expect(s.padStart(10, null)).toBe("nullnulfoo");
- expect(s.padStart(10, "bar")).toBe("barbarbfoo");
- expect(s.padStart(10, "123456789")).toBe("1234567foo");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.repeat.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.repeat.js
deleted file mode 100644
index 8427698509..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.repeat.js
+++ /dev/null
@@ -1,25 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.repeat).toHaveLength(1);
-
- expect("foo".repeat(0)).toBe("");
- expect("foo".repeat(1)).toBe("foo");
- expect("foo".repeat(2)).toBe("foofoo");
- expect("foo".repeat(3)).toBe("foofoofoo");
- expect("foo".repeat(3.1)).toBe("foofoofoo");
- expect("foo".repeat(3.5)).toBe("foofoofoo");
- expect("foo".repeat(3.9)).toBe("foofoofoo");
- expect("foo".repeat(null)).toBe("");
- expect("foo".repeat(undefined)).toBe("");
- expect("foo".repeat([])).toBe("");
- expect("foo".repeat("")).toBe("");
-});
-
-test("throws correct range errors", () => {
- expect(() => {
- "foo".repeat(-1);
- }).toThrowWithMessage(RangeError, "repeat count must be a positive number");
-
- expect(() => {
- "foo".repeat(Infinity);
- }).toThrowWithMessage(RangeError, "repeat count must be a finite number");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.slice.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.slice.js
deleted file mode 100644
index 2141e0f6f3..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.slice.js
+++ /dev/null
@@ -1,17 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.slice).toHaveLength(2);
-
- expect("hello friends".slice()).toBe("hello friends");
- expect("hello friends".slice(1)).toBe("ello friends");
- expect("hello friends".slice(0, 5)).toBe("hello");
- expect("hello friends".slice(13, 6)).toBe("");
- expect("hello friends".slice("", 5)).toBe("hello");
- expect("hello friends".slice(3, 3)).toBe("");
- expect("hello friends".slice(-1, 13)).toBe("s");
- expect("hello friends".slice(0, 50)).toBe("hello friends");
- expect("hello friends".slice(0, "5")).toBe("hello");
- expect("hello friends".slice("6", "13")).toBe("friends");
- expect("hello friends".slice(-7)).toBe("friends");
- expect("hello friends".slice(1000)).toBe("");
- expect("hello friends".slice(-1000)).toBe("hello friends");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.split.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.split.js
deleted file mode 100644
index 63d6c69a97..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.split.js
+++ /dev/null
@@ -1,35 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.split).toHaveLength(2);
-
- expect("hello friends".split()).toEqual(["hello friends"]);
- expect("hello friends".split("")).toEqual([
- "h",
- "e",
- "l",
- "l",
- "o",
- " ",
- "f",
- "r",
- "i",
- "e",
- "n",
- "d",
- "s",
- ]);
- expect("hello friends".split(" ")).toEqual(["hello", "friends"]);
-
- expect("a,b,c,d".split(",")).toEqual(["a", "b", "c", "d"]);
- expect(",a,b,c,d".split(",")).toEqual(["", "a", "b", "c", "d"]);
- expect("a,b,c,d,".split(",")).toEqual(["a", "b", "c", "d", ""]);
- expect("a,b,,c,d".split(",")).toEqual(["a", "b", "", "c", "d"]);
- expect(",a,b,,c,d,".split(",")).toEqual(["", "a", "b", "", "c", "d", ""]);
- expect(",a,b,,,c,d,".split(",,")).toEqual([",a,b", ",c,d,"]);
-});
-
-test("limits", () => {
- expect("a b c d".split(" ", 0)).toEqual([]);
- expect("a b c d".split(" ", 1)).toEqual(["a"]);
- expect("a b c d".split(" ", 3)).toEqual(["a", "b", "c"]);
- expect("a b c d".split(" ", 100)).toEqual(["a", "b", "c", "d"]);
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.startsWith.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.startsWith.js
deleted file mode 100644
index 5114da78f9..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.startsWith.js
+++ /dev/null
@@ -1,36 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.startsWith).toHaveLength(1);
-
- var s = "foobar";
- expect(s.startsWith("f")).toBeTrue();
- expect(s.startsWith("fo")).toBeTrue();
- expect(s.startsWith("foo")).toBeTrue();
- expect(s.startsWith("foob")).toBeTrue();
- expect(s.startsWith("fooba")).toBeTrue();
- expect(s.startsWith("foobar")).toBeTrue();
- expect(s.startsWith("foobar1")).toBeFalse();
- expect(s.startsWith("f", 0)).toBeTrue();
- expect(s.startsWith("fo", 0)).toBeTrue();
- expect(s.startsWith("foo", 0)).toBeTrue();
- expect(s.startsWith("foob", 0)).toBeTrue();
- expect(s.startsWith("fooba", 0)).toBeTrue();
- expect(s.startsWith("foobar", 0)).toBeTrue();
- expect(s.startsWith("foobar1", 0)).toBeFalse();
- expect(s.startsWith("foo", [])).toBeTrue();
- expect(s.startsWith("foo", null)).toBeTrue();
- expect(s.startsWith("foo", undefined)).toBeTrue();
- expect(s.startsWith("foo", false)).toBeTrue();
- expect(s.startsWith("foo", true)).toBeFalse();
- expect(s.startsWith("foo", "foo")).toBeTrue();
- expect(s.startsWith("foo", -1)).toBeTrue();
- expect(s.startsWith("foo", 42)).toBeFalse();
- expect(s.startsWith("bar", 3)).toBeTrue();
- expect(s.startsWith("bar", "3")).toBeTrue();
- expect(s.startsWith("bar1", 3)).toBeFalse();
- expect(s.startsWith()).toBeFalse();
- expect(s.startsWith("")).toBeTrue();
- expect(s.startsWith("", 0)).toBeTrue();
- expect(s.startsWith("", 1)).toBeTrue();
- expect(s.startsWith("", -1)).toBeTrue();
- expect(s.startsWith("", 42)).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.substr.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.substr.js
deleted file mode 100644
index ade6c3c60a..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.substr.js
+++ /dev/null
@@ -1,16 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.substr).toHaveLength(2);
-
- expect("hello friends".substr()).toBe("hello friends");
- expect("hello friends".substr(1)).toBe("ello friends");
- expect("hello friends".substr(0, 5)).toBe("hello");
- expect("hello friends".substr(5, 6)).toBe(" frien");
- expect("hello friends".substr("", 5)).toBe("hello");
- expect("hello friends".substr(3, 3)).toBe("lo ");
- expect("hello friends".substr(-1, 13)).toBe("s");
- expect("hello friends".substr(0, 50)).toBe("hello friends");
- expect("hello friends".substr(0, "5")).toBe("hello");
- expect("hello friends".substr("2", "2")).toBe("ll");
- expect("hello friends".substr(-7)).toBe("friends");
- expect("hello friends".substr(-3, -5)).toBe("");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.substring.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.substring.js
deleted file mode 100644
index 49a9888d7f..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.substring.js
+++ /dev/null
@@ -1,14 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.substring).toHaveLength(2);
-
- expect("hello friends".substring()).toBe("hello friends");
- expect("hello friends".substring(1)).toBe("ello friends");
- expect("hello friends".substring(0, 5)).toBe("hello");
- expect("hello friends".substring(13, 6)).toBe("friends");
- expect("hello friends".substring("", 5)).toBe("hello");
- expect("hello friends".substring(3, 3)).toBe("");
- expect("hello friends".substring(-1, 13)).toBe("hello friends");
- expect("hello friends".substring(0, 50)).toBe("hello friends");
- expect("hello friends".substring(0, "5")).toBe("hello");
- expect("hello friends".substring("6", "13")).toBe("friends");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.toLowerCase.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.toLowerCase.js
deleted file mode 100644
index 4c7cbad50a..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.toLowerCase.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.toLowerCase).toHaveLength(0);
-
- expect("foo".toLowerCase()).toBe("foo");
- expect("Foo".toLowerCase()).toBe("foo");
- expect("FOO".toLowerCase()).toBe("foo");
-
- expect(("b" + "a" + +"a" + "a").toLowerCase()).toBe("banana");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.toString.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.toString.js
deleted file mode 100644
index 418f2da5f8..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.toString.js
+++ /dev/null
@@ -1,6 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.toString).toHaveLength(0);
-
- expect("".toString()).toBe("");
- expect("hello friends".toString()).toBe("hello friends");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.toUpperCase.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.toUpperCase.js
deleted file mode 100644
index 03f463c6e1..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.toUpperCase.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.toUpperCase).toHaveLength(0);
-
- expect("foo".toUpperCase()).toBe("FOO");
- expect("Foo".toUpperCase()).toBe("FOO");
- expect("FOO".toUpperCase()).toBe("FOO");
-
- expect(("b" + "a" + +"n" + "a").toUpperCase()).toBe("BANANA");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.trim.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.trim.js
deleted file mode 100644
index d60522cad4..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.trim.js
+++ /dev/null
@@ -1,58 +0,0 @@
-test("trim", () => {
- expect(String.prototype.trim).toHaveLength(0);
-
- expect(" hello friends ".trim()).toBe("hello friends");
- expect("hello friends ".trim()).toBe("hello friends");
- expect(" hello friends".trim()).toBe("hello friends");
-
- expect("\thello friends\t".trim()).toBe("hello friends");
- expect("\thello friends".trim()).toBe("hello friends");
- expect("hello friends\t".trim()).toBe("hello friends");
-
- expect("\rhello friends\r".trim()).toBe("hello friends");
- expect("\rhello friends".trim()).toBe("hello friends");
- expect("hello friends\r".trim()).toBe("hello friends");
-
- expect("\rhello friends\n".trim()).toBe("hello friends");
- expect("\r\thello friends".trim()).toBe("hello friends");
- expect("hello friends\r\n".trim()).toBe("hello friends");
- expect(" \thello friends\r\n".trim()).toBe("hello friends");
- expect("\n\t\thello friends\r\n".trim()).toBe("hello friends");
- expect("\n\t\thello friends\t\t".trim()).toBe("hello friends");
-});
-
-test("trimStart", () => {
- expect(String.prototype.trimStart).toHaveLength(0);
-
- expect(" hello friends".trimStart()).toBe("hello friends");
- expect("hello friends ".trimStart()).toBe("hello friends ");
- expect(" hello friends ".trimStart()).toBe("hello friends ");
-
- expect("\thello friends".trimStart()).toBe("hello friends");
- expect("hello friends\t".trimStart()).toBe("hello friends\t");
- expect("\thello friends\t".trimStart()).toBe("hello friends\t");
-
- expect("\rhello friends".trimStart()).toBe("hello friends");
- expect("hello friends\r".trimStart()).toBe("hello friends\r");
- expect("\rhello friends\r".trimStart()).toBe("hello friends\r");
-});
-
-test("trimEnd", () => {
- expect(String.prototype.trimEnd).toHaveLength(0);
-
- expect("hello friends ".trimEnd()).toBe("hello friends");
- expect(" hello friends".trimEnd()).toBe(" hello friends");
- expect(" hello friends ".trimEnd()).toBe(" hello friends");
-
- expect("hello friends\t".trimEnd()).toBe("hello friends");
- expect("\thello friends".trimEnd()).toBe("\thello friends");
- expect("\thello friends\t".trimEnd()).toBe("\thello friends");
-
- expect("hello friends\r".trimEnd()).toBe("hello friends");
- expect("\rhello friends".trimEnd()).toBe("\rhello friends");
- expect("\rhello friends\r".trimEnd()).toBe("\rhello friends");
-
- expect("hello friends\n".trimEnd()).toBe("hello friends");
- expect("\r\nhello friends".trimEnd()).toBe("\r\nhello friends");
- expect("\rhello friends\r\n".trimEnd()).toBe("\rhello friends");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.valueOf.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.valueOf.js
deleted file mode 100644
index 87fb50fa21..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.valueOf.js
+++ /dev/null
@@ -1,12 +0,0 @@
-test("basic functionality", () => {
- expect(String.prototype.valueOf).toHaveLength(0);
-
- expect(String()).toBe("");
- expect(new String().valueOf()).toBe("");
- expect(String("foo")).toBe("foo");
- expect(new String("foo").valueOf()).toBe("foo");
- expect(String(123)).toBe("123");
- expect(new String(123).valueOf()).toBe("123");
- expect(String(123)).toBe("123");
- expect(new String(123).valueOf()).toBe("123");
-});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.raw.js b/Libraries/LibJS/Tests/builtins/String/String.raw.js
deleted file mode 100644
index a866276034..0000000000
--- a/Libraries/LibJS/Tests/builtins/String/String.raw.js
+++ /dev/null
@@ -1,31 +0,0 @@
-test("basic functionality", () => {
- expect(String.raw).toHaveLength(1);
-
- let str = String.raw`foo\nbar`;
- expect(str).toHaveLength(8);
- expect(str).toBe("foo\\nbar");
-
- str = String.raw`foo ${1 + 9}\nbar${"hf!"}`;
- expect(str).toBe("foo 10\\nbarhf!");
-
- str = String.raw`${10}${20}${30}`;
- expect(str).toBe("102030");
-
- str = String.raw({ raw: ["foo ", "\\nbar"] }, 10, "hf!");
- expect(str).toBe("foo 10\\nbar");
-
- str = String.raw({ raw: ["foo ", "\\nbar"] });
- expect(str).toBe("foo \\nbar");
-
- str = String.raw({ raw: [] }, 10, "hf!");
- expect(str).toBe("");
-
- str = String.raw({ raw: 1 });
- expect(str).toBe("");
-});
-
-test("passing object with no 'raw' property", () => {
- expect(() => {
- String.raw({});
- }).toThrowWithMessage(TypeError, "Cannot convert property 'raw' to object from undefined");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.for.js b/Libraries/LibJS/Tests/builtins/Symbol/Symbol.for.js
deleted file mode 100644
index c905be3c72..0000000000
--- a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.for.js
+++ /dev/null
@@ -1,23 +0,0 @@
-test("basic functionality", () => {
- const localSym = Symbol("foo");
- const globalSym = Symbol.for("foo");
-
- expect(localSym).not.toBe(globalSym);
- expect(localSym).not.toBe(Symbol("foo"));
- expect(globalSym).not.toBe(Symbol("foo"));
- expect(globalSym).toBe(Symbol.for("foo"));
- expect(localSym.toString()).toBe("Symbol(foo)");
- expect(globalSym.toString()).toBe("Symbol(foo)");
-
- expect(Symbol.for(1).description).toBe("1");
- expect(Symbol.for(true).description).toBe("true");
- expect(Symbol.for({}).description).toBe("[object Object]");
- expect(Symbol.for().description).toBe("undefined");
- expect(Symbol.for(null).description).toBe("null");
-});
-
-test("symbol argument throws an error", () => {
- expect(() => {
- Symbol.for(Symbol());
- }).toThrowWithMessage(TypeError, "Cannot convert symbol to string");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.js b/Libraries/LibJS/Tests/builtins/Symbol/Symbol.js
deleted file mode 100644
index 2533f593c7..0000000000
--- a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.js
+++ /dev/null
@@ -1,19 +0,0 @@
-test("basic functionality", () => {
- const s1 = Symbol("foo");
- const s2 = Symbol("foo");
-
- expect(s1).not.toBe(s2);
- expect(s1.description).toBe("foo");
- expect(s2.description).toBe("foo");
-
- s1.description = "bar";
- expect(s1.description).toBe("foo");
-
- expect(typeof s1).toBe("symbol");
-});
-
-test("constructing symbol from symbol is an error", () => {
- expect(() => {
- Symbol(Symbol("foo"));
- }).toThrowWithMessage(TypeError, "Cannot convert symbol to string");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.keyFor.js b/Libraries/LibJS/Tests/builtins/Symbol/Symbol.keyFor.js
deleted file mode 100644
index 8b04f652bc..0000000000
--- a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.keyFor.js
+++ /dev/null
@@ -1,24 +0,0 @@
-test("basic functionality", () => {
- const localSym = Symbol("foo");
- const globalSym = Symbol.for("foo");
-
- expect(Symbol.keyFor(localSym)).toBeUndefined();
- expect(Symbol.keyFor(globalSym)).toBe("foo");
-});
-
-test("bad argument values", () => {
- [
- [1, "1"],
- [null, "null"],
- [undefined, "undefined"],
- [[], "[object Array]"],
- [{}, "[object Object]"],
- [true, "true"],
- ["foobar", "foobar"],
- [function () {}, "[object ScriptFunction]"], // FIXME: Better function stringification
- ].forEach(testCase => {
- expect(() => {
- Symbol.keyFor(testCase[0]);
- }).toThrowWithMessage(TypeError, `${testCase[1]} is not a symbol`);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.@@toStringTag.js b/Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.@@toStringTag.js
deleted file mode 100644
index c73e637fc4..0000000000
--- a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.@@toStringTag.js
+++ /dev/null
@@ -1,3 +0,0 @@
-test("basic functionality", () => {
- expect(Symbol.prototype[Symbol.toStringTag]).toBe("Symbol");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.toString.js
deleted file mode 100644
index 4a95fe2397..0000000000
--- a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.toString.js
+++ /dev/null
@@ -1,25 +0,0 @@
-describe("correct behavior", () => {
- test("basic functionality", () => {
- const s1 = Symbol("baz");
- const s2 = Symbol.for("qux");
-
- // Explicit conversions to string are fine, but implicit toString via concatenation throws.
- expect(s1.toString()).toBe("Symbol(baz)");
- expect(String(s1)).toBe("Symbol(baz)");
- expect(s2.toString()).toBe("Symbol(qux)");
- });
-});
-
-describe("errors", () => {
- test("convert to string", () => {
- expect(() => {
- Symbol() + "";
- }).toThrowWithMessage(TypeError, "Cannot convert symbol to string");
- });
-
- test("convert to number", () => {
- expect(() => {
- Symbol() + 1;
- }).toThrowWithMessage(TypeError, "Cannot convert symbol to number");
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.valueOf.js b/Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.valueOf.js
deleted file mode 100644
index 0bfbfef912..0000000000
--- a/Libraries/LibJS/Tests/builtins/Symbol/Symbol.prototype.valueOf.js
+++ /dev/null
@@ -1,15 +0,0 @@
-test("basic functionality", () => {
- const local = Symbol("foo");
- // const global = Symbol.for("foo");
- expect(local.valueOf()).toBe(local);
- // expect(global.valueOf()).toBe(global);
-
- expect(Symbol.prototype.valueOf.call(local)).toBe(local);
- // expect(Symbol.prototype.valueOf.call(global)).toBe(global);
-});
-
-test("|this| must be a symbol", () => {
- expect(() => {
- Symbol.prototype.valueOf.call("foo");
- }).toThrowWithMessage(TypeError, "Not a Symbol object");
-});
diff --git a/Libraries/LibJS/Tests/builtins/Symbol/well-known-symbol-existence.js b/Libraries/LibJS/Tests/builtins/Symbol/well-known-symbol-existence.js
deleted file mode 100644
index 204e69882c..0000000000
--- a/Libraries/LibJS/Tests/builtins/Symbol/well-known-symbol-existence.js
+++ /dev/null
@@ -1,15 +0,0 @@
-test("basic functionality", () => {
- expect(Symbol).toHaveProperty("iterator");
- expect(Symbol).toHaveProperty("asyncIterator");
- expect(Symbol).toHaveProperty("match");
- expect(Symbol).toHaveProperty("matchAll");
- expect(Symbol).toHaveProperty("replace");
- expect(Symbol).toHaveProperty("search");
- expect(Symbol).toHaveProperty("split");
- expect(Symbol).toHaveProperty("hasInstance");
- expect(Symbol).toHaveProperty("isConcatSpreadable");
- expect(Symbol).toHaveProperty("unscopables");
- expect(Symbol).toHaveProperty("species");
- expect(Symbol).toHaveProperty("toPrimitive");
- expect(Symbol).toHaveProperty("toStringTag");
-});
diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.BYTES_PER_ELEMENT.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.BYTES_PER_ELEMENT.js
deleted file mode 100644
index c53213ac07..0000000000
--- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.BYTES_PER_ELEMENT.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- expect(Uint8Array.BYTES_PER_ELEMENT).toBe(1);
- expect(Uint16Array.BYTES_PER_ELEMENT).toBe(2);
- expect(Uint32Array.BYTES_PER_ELEMENT).toBe(4);
- expect(Int8Array.BYTES_PER_ELEMENT).toBe(1);
- expect(Int16Array.BYTES_PER_ELEMENT).toBe(2);
- expect(Int32Array.BYTES_PER_ELEMENT).toBe(4);
- expect(Float32Array.BYTES_PER_ELEMENT).toBe(4);
- expect(Float64Array.BYTES_PER_ELEMENT).toBe(8);
-});
diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js
deleted file mode 100644
index d443d13cd6..0000000000
--- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js
+++ /dev/null
@@ -1,133 +0,0 @@
-// Update when more typed arrays get added
-const TYPED_ARRAYS = [
- Uint8Array,
- Uint16Array,
- Uint32Array,
- Int8Array,
- Int16Array,
- Int32Array,
- Float32Array,
- Float64Array,
-];
-
-const getTypedArrayConstructor = () => Object.getPrototypeOf(TYPED_ARRAYS[0]);
-
-test("basic functionality", () => {
- const TypedArray = getTypedArrayConstructor();
- expect(TypedArray).toHaveLength(0);
- expect(TypedArray.name).toBe("TypedArray");
- expect(TypedArray.prototype.constructor).toBe(TypedArray);
- TYPED_ARRAYS.forEach(T => {
- expect(T.prototype.constructor).toBe(T);
- });
- const FunctionPrototype = Object.getPrototypeOf(() => {});
- expect(Object.getPrototypeOf(TypedArray)).toBe(FunctionPrototype);
-});
-
-test("typed array constructors must be invoked with 'new'", () => {
- TYPED_ARRAYS.forEach(T => {
- expect(() => {
- T();
- }).toThrowWithMessage(TypeError, `${T.name} constructor must be called with 'new'`);
- });
-});
-
-test("typed array constructors have TypedArray as prototype", () => {
- const TypedArray = getTypedArrayConstructor();
- TYPED_ARRAYS.forEach(T => {
- expect(Object.getPrototypeOf(T)).toBe(TypedArray);
- });
-});
-
-test("typed array prototypes have TypedArray.prototype as prototype", () => {
- const TypedArray = getTypedArrayConstructor();
- TYPED_ARRAYS.forEach(T => {
- const TPrototype = Object.getPrototypeOf(new T());
- expect(Object.getPrototypeOf(TPrototype)).toBe(TypedArray.prototype);
- });
-});
-
-test("typed arrays inherit from TypedArray", () => {
- const TypedArray = getTypedArrayConstructor();
- TYPED_ARRAYS.forEach(T => {
- expect(new T()).toBeInstanceOf(TypedArray);
- });
-});
-
-test("typed array can share the same ArrayBuffer", () => {
- const arrayBuffer = new ArrayBuffer(2);
- const uint8Array = new Uint8Array(arrayBuffer);
- const uint16Array = new Uint16Array(arrayBuffer);
- expect(uint8Array[0]).toBe(0);
- expect(uint8Array[1]).toBe(0);
- expect(uint16Array[0]).toBe(0);
- expect(uint16Array[1]).toBeUndefined();
- uint16Array[0] = 54321;
- expect(uint8Array[0]).toBe(0x31);
- expect(uint8Array[1]).toBe(0xd4);
- expect(uint16Array[0]).toBe(54321);
- expect(uint16Array[1]).toBeUndefined();
-});
-
-test("typed array from ArrayBuffer with custom length and offset", () => {
- const arrayBuffer = new ArrayBuffer(10);
- const uint8ArrayAll = new Uint8Array(arrayBuffer);
- const uint16ArrayPartial = new Uint16Array(arrayBuffer, 2, 4);
- // Affects two bytes of the buffer, beginning at offset
- uint16ArrayPartial[0] = 52651;
- // Out of relative bounds, doesn't affect buffer
- uint16ArrayPartial[4] = 123;
- expect(uint8ArrayAll[0]).toBe(0);
- expect(uint8ArrayAll[1]).toBe(0);
- expect(uint8ArrayAll[2]).toBe(0xab);
- expect(uint8ArrayAll[3]).toBe(0xcd);
- expect(uint8ArrayAll[5]).toBe(0);
- expect(uint8ArrayAll[6]).toBe(0);
- expect(uint8ArrayAll[7]).toBe(0);
- expect(uint8ArrayAll[8]).toBe(0);
- expect(uint8ArrayAll[9]).toBe(0);
-});
-
-test("typed array from ArrayBuffer errors", () => {
- expect(() => {
- new Uint16Array(new ArrayBuffer(1));
- }).toThrowWithMessage(
- RangeError,
- "Invalid buffer length for Uint16Array: must be a multiple of 2, got 1"
- );
-
- expect(() => {
- new Uint16Array(new ArrayBuffer(), 1);
- }).toThrowWithMessage(
- RangeError,
- "Invalid byte offset for Uint16Array: must be a multiple of 2, got 1"
- );
-
- expect(() => {
- new Uint16Array(new ArrayBuffer(), 2);
- }).toThrowWithMessage(
- RangeError,
- "Typed array byte offset 2 is out of range for buffer with length 0"
- );
-
- expect(() => {
- new Uint16Array(new ArrayBuffer(7), 2, 3);
- }).toThrowWithMessage(
- RangeError,
- "Typed array range 2:8 is out of range for buffer with length 7"
- );
-});
-
-test("TypedArray is not exposed on the global object", () => {
- expect(globalThis.TypedArray).toBeUndefined();
-});
-
-test("TypedArray is abstract", () => {
- const TypedArray = getTypedArrayConstructor();
- expect(() => {
- TypedArray();
- }).toThrowWithMessage(TypeError, "Abstract class TypedArray cannot be constructed directly");
- expect(() => {
- new TypedArray();
- }).toThrowWithMessage(TypeError, "Abstract class TypedArray cannot be constructed directly");
-});
diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.length.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.length.js
deleted file mode 100644
index ce02c72391..0000000000
--- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.length.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// Update when more typed arrays get added
-const TYPED_ARRAYS = [
- Uint8Array,
- Uint16Array,
- Uint32Array,
- Int8Array,
- Int16Array,
- Int32Array,
- Float32Array,
- Float64Array,
-];
-
-test("basic functionality", () => {
- TYPED_ARRAYS.forEach(T => {
- const typedArray = new T(42);
- expect(Object.hasOwnProperty(typedArray, "length")).toBeFalse();
- expect(typedArray.length).toBe(42);
- });
-});
diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-basic.js b/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-basic.js
deleted file mode 100644
index aeefb5bb54..0000000000
--- a/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-basic.js
+++ /dev/null
@@ -1,86 +0,0 @@
-test("basic Uint8Array", () => {
- var a = new Uint8Array(1);
- expect(typeof a).toBe("object");
- expect(a instanceof Uint8Array).toBe(true);
- expect(a.length).toBe(1);
- a[0] = 1;
- expect(a[0]).toBe(1);
- a[0] -= 2;
- expect(a[0]).toBe(0xff);
- ++a[0];
- expect(a[0]).toBe(0);
-});
-
-test("basic Uint16Array", () => {
- var a = new Uint16Array(1);
- expect(typeof a).toBe("object");
- expect(a instanceof Uint16Array).toBe(true);
- expect(a.length).toBe(1);
- a[0] = 1;
- expect(a[0]).toBe(1);
- a[0] -= 2;
- expect(a[0]).toBe(0xffff);
- ++a[0];
- expect(a[0]).toBe(0);
-});
-
-test("basic Uint32Array", () => {
- var a = new Uint32Array(1);
- expect(typeof a).toBe("object");
- expect(a instanceof Uint32Array).toBe(true);
- expect(a.length).toBe(1);
- a[0] = 1;
- expect(a[0]).toBe(1);
- a[0] -= 2;
- expect(a[0]).toBe(0xffffffff);
- ++a[0];
- expect(a[0]).toBe(0);
-});
-
-test("basic Int8Array", () => {
- var a = new Int8Array(1);
- expect(typeof a).toBe("object");
- expect(a instanceof Int8Array).toBe(true);
- expect(a.length).toBe(1);
- a[0] = 1;
- expect(a[0]).toBe(1);
- a[0] -= 2;
- expect(a[0]).toBe(-1);
- ++a[0];
- expect(a[0]).toBe(0);
- a[0] = 127;
- a[0]++;
- expect(a[0]).toBe(-128);
-});
-
-test("basic Int16Array", () => {
- var a = new Int16Array(1);
- expect(typeof a).toBe("object");
- expect(a instanceof Int16Array).toBe(true);
- expect(a.length).toBe(1);
- a[0] = 1;
- expect(a[0]).toBe(1);
- a[0] -= 2;
- expect(a[0]).toBe(-1);
- ++a[0];
- expect(a[0]).toBe(0);
- a[0] = 32767;
- a[0]++;
- expect(a[0]).toBe(-32768);
-});
-
-test("basic Int32Array", () => {
- var a = new Int32Array(1);
- expect(typeof a).toBe("object");
- expect(a instanceof Int32Array).toBe(true);
- expect(a.length).toBe(1);
- a[0] = 1;
- expect(a[0]).toBe(1);
- a[0] -= 2;
- expect(a[0]).toBe(-1);
- ++a[0];
- expect(a[0]).toBe(0);
- a[0] = 0x7fffffff;
- a[0]++;
- expect(a[0]).toBe(-0x80000000);
-});
diff --git a/Libraries/LibJS/Tests/builtins/functions/isFinite.js b/Libraries/LibJS/Tests/builtins/functions/isFinite.js
deleted file mode 100644
index 71f4f70655..0000000000
--- a/Libraries/LibJS/Tests/builtins/functions/isFinite.js
+++ /dev/null
@@ -1,23 +0,0 @@
-test("basic functionality", () => {
- expect(isFinite).toHaveLength(1);
-
- expect(isFinite(0)).toBeTrue();
- expect(isFinite(1.23)).toBeTrue();
- expect(isFinite(42)).toBeTrue();
- expect(isFinite("")).toBeTrue();
- expect(isFinite("0")).toBeTrue();
- expect(isFinite("42")).toBeTrue();
- expect(isFinite(true)).toBeTrue();
- expect(isFinite(false)).toBeTrue();
- expect(isFinite(null)).toBeTrue();
- expect(isFinite([])).toBeTrue();
-
- expect(isFinite()).toBeFalse();
- expect(isFinite(NaN)).toBeFalse();
- expect(isFinite(undefined)).toBeFalse();
- expect(isFinite(Infinity)).toBeFalse();
- expect(isFinite(-Infinity)).toBeFalse();
- expect(isFinite("foo")).toBeFalse();
- expect(isFinite({})).toBeFalse();
- expect(isFinite([1, 2, 3])).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/builtins/functions/isNaN.js b/Libraries/LibJS/Tests/builtins/functions/isNaN.js
deleted file mode 100644
index bb0d418bb5..0000000000
--- a/Libraries/LibJS/Tests/builtins/functions/isNaN.js
+++ /dev/null
@@ -1,26 +0,0 @@
-test("length is 1", () => {
- expect(isNaN).toHaveLength(1);
-});
-
-test("arguments that evaluate to false", () => {
- expect(isNaN(0)).toBeFalse();
- expect(isNaN(42)).toBeFalse();
- expect(isNaN("")).toBeFalse();
- expect(isNaN("0")).toBeFalse();
- expect(isNaN("42")).toBeFalse();
- expect(isNaN(true)).toBeFalse();
- expect(isNaN(false)).toBeFalse();
- expect(isNaN(null)).toBeFalse();
- expect(isNaN([])).toBeFalse();
- expect(isNaN(Infinity)).toBeFalse();
- expect(isNaN(-Infinity)).toBeFalse();
-});
-
-test("arguments that evaluate to true", () => {
- expect(isNaN()).toBeTrue();
- expect(isNaN(NaN)).toBeTrue();
- expect(isNaN(undefined)).toBeTrue();
- expect(isNaN("foo")).toBeTrue();
- expect(isNaN({})).toBeTrue();
- expect(isNaN([1, 2, 3])).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/builtins/functions/parseFloat.js b/Libraries/LibJS/Tests/builtins/functions/parseFloat.js
deleted file mode 100644
index 20ed2633dd..0000000000
--- a/Libraries/LibJS/Tests/builtins/functions/parseFloat.js
+++ /dev/null
@@ -1,59 +0,0 @@
-test("parsing numbers", () => {
- [
- [0, 0],
- [1, 1],
- [0.23, 0.23],
- [1.23, 1.23],
- [0.0123e2, 1.23],
- [1.23e4, 12300],
- [Infinity, Infinity],
- ].forEach(test => {
- expect(parseFloat(test[0])).toBe(test[1]);
- expect(parseFloat(+test[0])).toBe(test[1]);
- expect(parseFloat(-test[0])).toBe(-test[1]);
- });
-});
-
-test("parsing strings", () => {
- [
- ["0", 0],
- ["1", 1],
- [".23", 0.23],
- ["1.23", 1.23],
- ["0.0123E+2", 1.23],
- ["1.23e4", 12300],
- ["Infinity", Infinity],
- ].forEach(test => {
- expect(parseFloat(test[0])).toBe(test[1]);
- expect(parseFloat(`+${test[0]}`)).toBe(test[1]);
- expect(parseFloat(`-${test[0]}`)).toBe(-test[1]);
- expect(parseFloat(`${test[0]}foo`)).toBe(test[1]);
- expect(parseFloat(`+${test[0]}foo`)).toBe(test[1]);
- expect(parseFloat(`-${test[0]}foo`)).toBe(-test[1]);
- expect(parseFloat(` \n \t ${test[0]} \v foo `)).toBe(test[1]);
- expect(parseFloat(` \r -${test[0]} \f \n\n foo `)).toBe(-test[1]);
- expect(parseFloat({ toString: () => test[0] })).toBe(test[1]);
- });
-});
-
-test("parsing NaN", () => {
- [
- "",
- [],
- [],
- true,
- false,
- null,
- undefined,
- NaN,
- "foo123",
- "foo+123",
- "fooInfinity",
- "foo+Infinity",
- ].forEach(value => {
- expect(parseFloat(value)).toBeNaN();
- });
-
- expect(parseFloat()).toBeNaN();
- expect(parseFloat("", 123, Infinity)).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/classes/class-advanced-extends.js b/Libraries/LibJS/Tests/classes/class-advanced-extends.js
deleted file mode 100644
index 5cbeb90404..0000000000
--- a/Libraries/LibJS/Tests/classes/class-advanced-extends.js
+++ /dev/null
@@ -1,35 +0,0 @@
-test("extending function", () => {
- class A extends function () {
- this.foo = 10;
- } {}
-
- expect(new A().foo).toBe(10);
-});
-
-test("extending null", () => {
- class A extends null {}
-
- expect(Object.getPrototypeOf(A.prototype)).toBeNull();
-
- expect(() => {
- new A();
- }).toThrowWithMessage(ReferenceError, "|this| has not been initialized");
-});
-
-test("extending String", () => {
- class MyString extends String {}
-
- const ms = new MyString("abc");
- expect(ms).toBeInstanceOf(MyString);
- expect(ms).toBeInstanceOf(String);
- expect(ms.charAt(1)).toBe("b");
-
- class MyString2 extends MyString {
- charAt(i) {
- return `#${super.charAt(i)}`;
- }
- }
-
- const ms2 = new MyString2("abc");
- expect(ms2.charAt(1)).toBe("#b");
-});
diff --git a/Libraries/LibJS/Tests/classes/class-basic.js b/Libraries/LibJS/Tests/classes/class-basic.js
deleted file mode 100644
index 0fae88c033..0000000000
--- a/Libraries/LibJS/Tests/classes/class-basic.js
+++ /dev/null
@@ -1,5 +0,0 @@
-test("class properties", () => {
- class A {}
- expect(A.name).toBe("A");
- expect(A).toHaveLength(0);
-});
diff --git a/Libraries/LibJS/Tests/classes/class-constructor.js b/Libraries/LibJS/Tests/classes/class-constructor.js
deleted file mode 100644
index 54a601e10c..0000000000
--- a/Libraries/LibJS/Tests/classes/class-constructor.js
+++ /dev/null
@@ -1,67 +0,0 @@
-test("property initialization", () => {
- class A {
- constructor() {
- this.x = 3;
- }
- }
-
- expect(new A().x).toBe(3);
-});
-
-test("method initialization", () => {
- class A {
- constructor() {
- this.x = () => 10;
- }
- }
-
- expect(new A().x()).toBe(10);
-});
-
-test("initialize to class method", () => {
- class A {
- constructor() {
- this.x = this.method;
- }
-
- method() {
- return 10;
- }
- }
-
- expect(new A().x()).toBe(10);
-});
-
-test("constructor length affects class length", () => {
- class A {
- constructor() {}
- }
-
- expect(A).toHaveLength(0);
-
- class B {
- constructor(a, b, c = 2) {}
- }
-
- expect(B).toHaveLength(2);
-});
-
-test("must be invoked with 'new'", () => {
- class A {
- constructor() {}
- }
-
- expect(() => {
- A();
- }).toThrowWithMessage(TypeError, "Class constructor A must be called with 'new'");
-
- expect(() => {
- A.prototype.constructor();
- }).toThrowWithMessage(TypeError, "Class constructor A must be called with 'new'");
-});
-
-test("implicit constructor", () => {
- class A {}
-
- expect(new A()).toBeInstanceOf(A);
-});
diff --git a/Libraries/LibJS/Tests/classes/class-errors.js b/Libraries/LibJS/Tests/classes/class-errors.js
deleted file mode 100644
index fb479a0af2..0000000000
--- a/Libraries/LibJS/Tests/classes/class-errors.js
+++ /dev/null
@@ -1,100 +0,0 @@
-describe("non-syntax errors", () => {
- test("super reference inside nested-but-same |this| scope with no base class", () => {
- expect(`
- class A {
- foo() {
- () => { super.bar; }
- }
- }`).toEval();
- });
-
- test("super reference property lookup with no base class", () => {
- expect(`
- class A {
- constructor() {
- super.foo;
- }
- }`).toEval();
- });
-});
-
-describe("reference errors", () => {
- test("derived class doesn't call super in constructor before using this", () => {
- class Parent {}
- class Child extends Parent {
- constructor() {
- this;
- }
- }
-
- expect(() => {
- new Child();
- }).toThrowWithMessage(ReferenceError, "|this| has not been initialized");
- });
-
- test("derived class calls super twice in constructor", () => {
- class Parent {}
- class Child extends Parent {
- constructor() {
- super();
- super();
- }
- }
-
- expect(() => {
- new Child();
- }).toThrowWithMessage(ReferenceError, "|this| is already initialized");
- });
-});
-
-describe("syntax errors", () => {
- test("getter with argument", () => {
- expect(`
- class A {
- get foo(v) {
- return 0;
- }
- }`).not.toEval();
- });
-
- test("setter with no arguments", () => {
- expect(`
- class A {
- set foo() {
- }
- }`).not.toEval();
- });
-
- test("setter with more than one argument", () => {
- expect(`
- class A {
- set foo(bar, baz) {
- }
- }`).not.toEval();
- expect(`
- class A {
- set foo(...bar) {
- }
- }`).not.toEval();
- });
-
- test("super reference inside different |this| scope", () => {
- expect(`
- class Parent {}
-
- class Child extends Parent {
- foo() {
- function f() { super.foo; }
- }
- }`).not.toEval();
- });
-
- test("super reference call with no base class", () => {
- expect(`
- class A {
- constructor() {
- super();
- }
- }`).not.toEval();
- });
-});
diff --git a/Libraries/LibJS/Tests/classes/class-expressions.js b/Libraries/LibJS/Tests/classes/class-expressions.js
deleted file mode 100644
index f67f54ff7f..0000000000
--- a/Libraries/LibJS/Tests/classes/class-expressions.js
+++ /dev/null
@@ -1,68 +0,0 @@
-test("basic functionality", () => {
- const A = class {
- constructor(x) {
- this.x = x;
- }
-
- getX() {
- return this.x * 2;
- }
- };
-
- expect(new A(10).getX()).toBe(20);
-});
-
-test("inline instantiation", () => {
- // prettier-ignore
- const a = new class {
- constructor() {
- this.x = 10;
- }
-
- getX() {
- return this.x * 2;
- }
- };
-
- expect(a.getX()).toBe(20);
-});
-
-test("inline instantiation with argument", () => {
- // prettier-ignore
- const a = new class {
- constructor(x) {
- this.x = x;
- }
-
- getX() {
- return this.x * 2;
- }
- }(10);
-
- expect(a.getX()).toBe(20);
-});
-
-test("extending class expressions", () => {
- class A extends class {
- constructor(x) {
- this.x = x;
- }
- } {
- constructor(y) {
- super(y);
- this.y = y * 2;
- }
- }
-
- const a = new A(10);
- expect(a.x).toBe(10);
- expect(a.y).toBe(20);
-});
-
-test("class expression name", () => {
- let A = class {};
- expect(A.name).toBe("A");
-
- let B = class C {};
- expect(B.name).toBe("C");
-});
diff --git a/Libraries/LibJS/Tests/classes/class-getters.js b/Libraries/LibJS/Tests/classes/class-getters.js
deleted file mode 100644
index 5b51910b3e..0000000000
--- a/Libraries/LibJS/Tests/classes/class-getters.js
+++ /dev/null
@@ -1,75 +0,0 @@
-test("basic functionality", () => {
- class A {
- get x() {
- return 10;
- }
- }
-
- expect(A).not.toHaveProperty("x");
- expect(new A().x).toBe(10);
-});
-test("name", () => {
- class A {
- get x() {}
- }
-
- const d = Object.getOwnPropertyDescriptor(A.prototype, "x");
- expect(d.get.name).toBe("get x");
-});
-
-test("extended name syntax", () => {
- const s = Symbol("foo");
-
- class A {
- get "method with space"() {
- return 1;
- }
-
- get 12() {
- return 2;
- }
-
- get [`he${"llo"}`]() {
- return 3;
- }
-
- get [s]() {
- return 4;
- }
- }
-
- const a = new A();
- expect(a["method with space"]).toBe(1);
- expect(a[12]).toBe(2);
- expect(a.hello).toBe(3);
- expect(a[s]).toBe(4);
-});
-
-test("inherited getter", () => {
- class Parent {
- get x() {
- return 3;
- }
- }
-
- class Child extends Parent {}
-
- expect(Child).not.toHaveProperty("x");
- expect(new Child().x).toBe(3);
-});
-
-test("inherited getter overriding", () => {
- class Parent {
- get x() {
- return 3;
- }
- }
-
- class Child extends Parent {
- get x() {
- return 10;
- }
- }
-
- expect(new Child().x).toBe(10);
-});
diff --git a/Libraries/LibJS/Tests/classes/class-inheritance.js b/Libraries/LibJS/Tests/classes/class-inheritance.js
deleted file mode 100644
index 0e6778dbf5..0000000000
--- a/Libraries/LibJS/Tests/classes/class-inheritance.js
+++ /dev/null
@@ -1,133 +0,0 @@
-test("method inheritance", () => {
- class Parent {
- method() {
- return 3;
- }
- }
-
- class Child extends Parent {}
-
- const p = new Parent();
- const c = new Child();
- expect(p.method()).toBe(3);
- expect(c.method()).toBe(3);
-});
-
-test("method overriding", () => {
- class Parent {
- method() {
- return 3;
- }
- }
-
- class Child extends Parent {
- method() {
- return 10;
- }
- }
-
- const p = new Parent();
- const c = new Child();
- expect(p.method()).toBe(3);
- expect(c.method()).toBe(10);
-});
-
-test("parent method reference with super", () => {
- class Parent {
- method() {
- return 3;
- }
- }
-
- class Child extends Parent {
- method() {
- return super.method() * 2;
- }
- }
-
- const p = new Parent();
- const c = new Child();
- expect(p.method()).toBe(3);
- expect(c.method()).toBe(6);
-});
-
-test("child class access to parent class initialized properties", () => {
- class Parent {
- constructor() {
- this.x = 3;
- }
- }
-
- class Child extends Parent {}
-
- const p = new Parent();
- const c = new Child();
- expect(p.x).toBe(3);
- expect(c.x).toBe(3);
-});
-
-test("child class modification of parent class properties", () => {
- class Parent {
- constructor() {
- this.x = 3;
- }
- }
-
- class Child extends Parent {
- change() {
- this.x = 10;
- }
- }
-
- const p = new Parent();
- const c = new Child();
- expect(p.x).toBe(3);
- expect(c.x).toBe(3);
-
- c.change();
- expect(c.x).toBe(10);
-});
-
-test("inheritance and hasOwnProperty", () => {
- class Parent {
- constructor() {
- this.x = 3;
- }
- }
-
- class Child extends Parent {
- method() {
- this.y = 10;
- }
- }
-
- const p = new Parent();
- const c = new Child();
- expect(p.hasOwnProperty("x")).toBeTrue();
- expect(p.hasOwnProperty("y")).toBeFalse();
- expect(c.hasOwnProperty("x")).toBeTrue();
- expect(c.hasOwnProperty("y")).toBeFalse();
-
- c.method();
- expect(c.hasOwnProperty("x")).toBeTrue();
- expect(c.hasOwnProperty("y")).toBeTrue();
-});
-
-test("super constructor call from child class with argument", () => {
- class Parent {
- constructor(x) {
- this.x = x;
- }
- }
-
- class Child extends Parent {
- constructor() {
- super(10);
- }
- }
-
- const p = new Parent(3);
- const c = new Child(3);
- expect(p.x).toBe(3);
- expect(c.x).toBe(10);
-});
diff --git a/Libraries/LibJS/Tests/classes/class-methods.js b/Libraries/LibJS/Tests/classes/class-methods.js
deleted file mode 100644
index 0add75635c..0000000000
--- a/Libraries/LibJS/Tests/classes/class-methods.js
+++ /dev/null
@@ -1,51 +0,0 @@
-test("basic functionality", () => {
- class A {
- number() {
- return 2;
- }
-
- string() {
- return "foo";
- }
- }
-
- const a = new A();
- expect(a.number()).toBe(2);
- expect(a.string()).toBe("foo");
-});
-
-test("length", () => {
- class A {
- method1() {}
-
- method2(a, b, c, d) {}
-
- method3(a, b, ...c) {}
- }
-
- const a = new A();
- expect(a.method1).toHaveLength(0);
- expect(a.method2).toHaveLength(4);
- expect(a.method3).toHaveLength(2);
-});
-
-test("extended name syntax", () => {
- class A {
- "method with space"() {
- return 1;
- }
-
- 12() {
- return 2;
- }
-
- [`he${"llo"}`]() {
- return 3;
- }
- }
-
- const a = new A();
- expect(a["method with space"]()).toBe(1);
- expect(a[12]()).toBe(2);
- expect(a.hello()).toBe(3);
-});
diff --git a/Libraries/LibJS/Tests/classes/class-setters.js b/Libraries/LibJS/Tests/classes/class-setters.js
deleted file mode 100644
index 99c307994b..0000000000
--- a/Libraries/LibJS/Tests/classes/class-setters.js
+++ /dev/null
@@ -1,108 +0,0 @@
-test("basic functionality", () => {
- class A {
- get x() {
- return this._x;
- }
-
- set x(value) {
- this._x = value * 2;
- }
- }
-
- expect(A.x).toBeUndefined();
- expect(A).not.toHaveProperty("_x");
- const a = new A();
- expect(a.x).toBeUndefined();
- expect(a).not.toHaveProperty("_x");
- a.x = 3;
- expect(a.x).toBe(6);
- expect(a).toHaveProperty("_x", 6);
-});
-
-test("name", () => {
- class A {
- set x(v) {}
- }
-
- const d = Object.getOwnPropertyDescriptor(A.prototype, "x");
- expect(d.set.name).toBe("set x");
-});
-
-test("extended name syntax", () => {
- const s = Symbol("foo");
-
- class A {
- set "method with space"(value) {
- this.a = value;
- }
-
- set 12(value) {
- this.b = value;
- }
-
- set [`he${"llo"}`](value) {
- this.c = value;
- }
-
- set [s](value) {
- this.d = value;
- }
- }
-
- const a = new A();
- a["method with space"] = 1;
- a[12] = 2;
- a.hello = 3;
- a[s] = 4;
- expect(a.a).toBe(1);
- expect(a.b).toBe(2);
- expect(a.c).toBe(3);
- expect(a.d).toBe(4);
-});
-
-test("inherited setter", () => {
- class Parent {
- get x() {
- return this._x;
- }
-
- set x(value) {
- this._x = value * 2;
- }
- }
-
- class Child extends Parent {}
-
- const c = new Child();
-
- expect(c.x).toBeUndefined();
- c.x = 10;
- expect(c.x).toBe(20);
-});
-
-test("inherited static setter overriding", () => {
- class Parent {
- get x() {
- return this._x;
- }
-
- set x(value) {
- this._x = value * 2;
- }
- }
-
- class Child extends Parent {
- get x() {
- return this._x;
- }
-
- set x(value) {
- this._x = value * 3;
- }
- }
-
- const c = new Child();
- expect(c.x).toBeUndefined();
- c.x = 10;
- expect(c.x).toBe(30);
-});
diff --git a/Libraries/LibJS/Tests/classes/class-static-getters.js b/Libraries/LibJS/Tests/classes/class-static-getters.js
deleted file mode 100644
index c158a00595..0000000000
--- a/Libraries/LibJS/Tests/classes/class-static-getters.js
+++ /dev/null
@@ -1,87 +0,0 @@
-describe("correct behavior", () => {
- test("basic functionality", () => {
- class A {
- static get x() {
- return 10;
- }
- }
-
- expect(A.x).toBe(10);
- expect(new A()).not.toHaveProperty("x");
- });
-
- test("name", () => {
- class A {
- static get x() {}
- }
-
- const d = Object.getOwnPropertyDescriptor(A, "x");
- expect(d.get.name).toBe("get x");
- });
-
- test("extended name syntax", () => {
- const s = Symbol("foo");
-
- class A {
- static get "method with space"() {
- return 1;
- }
-
- static get 12() {
- return 2;
- }
-
- static get [`he${"llo"}`]() {
- return 3;
- }
-
- static get [s]() {
- return 4;
- }
- }
-
- expect(A["method with space"]).toBe(1);
- expect(A[12]).toBe(2);
- expect(A.hello).toBe(3);
- expect(A[s]).toBe(4);
- });
-
- test("inherited static getter", () => {
- class Parent {
- static get x() {
- return 3;
- }
- }
-
- class Child extends Parent {}
-
- expect(Parent.x).toBe(3);
- expect(Child.x).toBe(3);
- });
-
- test("inherited static getter overriding", () => {
- class Parent {
- static get x() {
- return 3;
- }
- }
-
- class Child extends Parent {
- static get x() {
- return 10;
- }
- }
-
- expect(Parent.x).toBe(3);
- expect(Child.x).toBe(10);
- });
-});
-
-describe("errors", () => {
- test('"get static" is a syntax error', () => {
- expect(`
- class A {
- get static foo() {}
- }`).not.toEval();
- });
-});
diff --git a/Libraries/LibJS/Tests/classes/class-static-setters.js b/Libraries/LibJS/Tests/classes/class-static-setters.js
deleted file mode 100644
index 38cbbe2394..0000000000
--- a/Libraries/LibJS/Tests/classes/class-static-setters.js
+++ /dev/null
@@ -1,112 +0,0 @@
-describe("correct behavior", () => {
- test("basic functionality", () => {
- class A {
- static get x() {
- return this._x;
- }
-
- static set x(value) {
- this._x = value * 2;
- }
- }
-
- expect(A.x).toBeUndefined();
- expect(A).not.toHaveProperty("_x");
- A.x = 3;
- expect(A.x).toBe(6);
- expect(A).toHaveProperty("_x", 6);
- });
-
- test("name", () => {
- class A {
- static set x(v) {}
- }
-
- const d = Object.getOwnPropertyDescriptor(A, "x");
- expect(d.set.name).toBe("set x");
- });
-
- test("extended name syntax", () => {
- const s = Symbol("foo");
-
- class A {
- static set "method with space"(value) {
- this.a = value;
- }
-
- static set 12(value) {
- this.b = value;
- }
-
- static set [`he${"llo"}`](value) {
- this.c = value;
- }
-
- static set [s](value) {
- this.d = value;
- }
- }
-
- A["method with space"] = 1;
- A[12] = 2;
- A.hello = 3;
- A[s] = 4;
- expect(A.a).toBe(1);
- expect(A.b).toBe(2);
- expect(A.c).toBe(3);
- expect(A.d).toBe(4);
- });
-
- test("inherited static setter", () => {
- class Parent {
- static get x() {
- return this._x;
- }
-
- static set x(value) {
- this._x = value * 2;
- }
- }
-
- class Child extends Parent {}
-
- expect(Child.x).toBeUndefined();
- Child.x = 10;
- expect(Child.x).toBe(20);
- });
-
- test("inherited static setter overriding", () => {
- class Parent {
- static get x() {
- return this._x;
- }
-
- static set x(value) {
- this._x = value * 2;
- }
- }
-
- class Child extends Parent {
- static get x() {
- return this._x;
- }
-
- static set x(value) {
- this._x = value * 3;
- }
- }
-
- expect(Child.x).toBeUndefined();
- Child.x = 10;
- expect(Child.x).toBe(30);
- });
-});
-
-describe("errors", () => {
- test('"set static" is a syntax error', () => {
- expect(`
- class A {
- set static foo(value) {}
- }`).not.toEval();
- });
-});
diff --git a/Libraries/LibJS/Tests/classes/class-static.js b/Libraries/LibJS/Tests/classes/class-static.js
deleted file mode 100644
index 5bfd28c3da..0000000000
--- a/Libraries/LibJS/Tests/classes/class-static.js
+++ /dev/null
@@ -1,72 +0,0 @@
-test("basic functionality", () => {
- class A {
- static method() {
- return 10;
- }
- }
-
- expect(A.method()).toBe(10);
- expect(new A().method).toBeUndefined();
-});
-
-test("extended name syntax", () => {
- class A {
- static method() {
- return 1;
- }
-
- static 12() {
- return 2;
- }
-
- static [`he${"llo"}`]() {
- return 3;
- }
- }
-
- expect(A.method()).toBe(1);
- expect(A[12]()).toBe(2);
- expect(A.hello()).toBe(3);
-});
-
-test("bound |this|", () => {
- class A {
- static method() {
- expect(this).toBe(A);
- }
- }
-
- A.method();
-});
-
-test("inherited static methods", () => {
- class Parent {
- static method() {
- return 3;
- }
- }
-
- class Child extends Parent {}
-
- expect(Parent.method()).toBe(3);
- expect(Child.method()).toBe(3);
- expect(new Parent()).not.toHaveProperty("method");
- expect(new Child()).not.toHaveProperty("method");
-});
-
-test("static method overriding", () => {
- class Parent {
- static method() {
- return 3;
- }
- }
-
- class Child extends Parent {
- static method() {
- return 10;
- }
- }
-
- expect(Parent.method()).toBe(3);
- expect(Child.method()).toBe(10);
-});
diff --git a/Libraries/LibJS/Tests/classes/class-strict-mode.js b/Libraries/LibJS/Tests/classes/class-strict-mode.js
deleted file mode 100644
index 016d2d2eba..0000000000
--- a/Libraries/LibJS/Tests/classes/class-strict-mode.js
+++ /dev/null
@@ -1,19 +0,0 @@
-test("constructors are always strict mode", () => {
- class A {
- constructor() {
- expect(isStrictMode()).toBeTrue();
- }
- }
-
- new A();
-});
-
-test("methods are always strict mode", () => {
- class A {
- method() {
- expect(isStrictMode()).toBeTrue();
- }
- }
-
- new A().method();
-});
diff --git a/Libraries/LibJS/Tests/comments-basic.js b/Libraries/LibJS/Tests/comments-basic.js
deleted file mode 100644
index 3dbe6aec1e..0000000000
--- a/Libraries/LibJS/Tests/comments-basic.js
+++ /dev/null
@@ -1,35 +0,0 @@
-test("regular comments", () => {
- const source = `
-var i = 0;
-// i++;
-/* i++; */
-/*
-i++;
-*/
-/**/ i++;
-return i;`;
-
- expect(source).toEvalTo(1);
-});
-
-test("html comments", () => {
- const source = `
-var i = 0;
-var j = 0;
-<!-- i++; --> i++;
-<!-- i++;
-i++;
---> i++;
-/**/ --> i++;
-j --> i++;
-return i;`;
- expect(source).toEvalTo(2);
-});
-
-test("unterminated multi-line comment", () => {
- expect("/*").not.toEval();
- expect("/**").not.toEval();
- expect("/*/").not.toEval();
- expect("/* foo").not.toEval();
- expect("foo /*").not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/computed-property-throws.js b/Libraries/LibJS/Tests/computed-property-throws.js
deleted file mode 100644
index 2f8e35eb63..0000000000
--- a/Libraries/LibJS/Tests/computed-property-throws.js
+++ /dev/null
@@ -1,19 +0,0 @@
-test("Issue #3459, exception in computed property expression", () => {
- expect(() => {
- "foo"[bar];
- }).toThrow(ReferenceError);
- expect(() => {
- "foo"[bar]();
- }).toThrow(ReferenceError);
-});
-
-test("Issue #3941, exception in computed property's toString()", () => {
- expect(() => {
- const o = {
- toString() {
- throw Error();
- },
- };
- "foo"[o];
- }).toThrow(Error);
-});
diff --git a/Libraries/LibJS/Tests/const-declaration-missing-initializer.js b/Libraries/LibJS/Tests/const-declaration-missing-initializer.js
deleted file mode 100644
index 5bbf2ef9e2..0000000000
--- a/Libraries/LibJS/Tests/const-declaration-missing-initializer.js
+++ /dev/null
@@ -1,5 +0,0 @@
-test("missing initializer in 'const' variable declaration is syntax error", () => {
- expect("const foo").not.toEval();
- expect("const foo = 1, bar").not.toEval();
- expect("const foo = 1, bar, baz = 2").not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/const-reassignment.js b/Libraries/LibJS/Tests/const-reassignment.js
deleted file mode 100644
index 1c66fc24ce..0000000000
--- a/Libraries/LibJS/Tests/const-reassignment.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// I'm not sure how this test passed before the refactor, but it definitely doesn't work at all
-test.skip("reassignment to const", () => {
- const constantValue = 1;
- expect(() => {
- constantValue = 2;
- }).toThrowWithMessage(TypeError, "Invalid assignment to const variable");
- expect(constantValue).toBe(1);
-});
-
-test("const creation in inner scope", () => {
- const constantValue = 1;
- do {
- const constantValue = 2;
- expect(constantValue).toBe(2);
- } while (false);
- expect(constantValue).toBe(1);
-});
diff --git a/Libraries/LibJS/Tests/custom-@@hasInstance.js b/Libraries/LibJS/Tests/custom-@@hasInstance.js
deleted file mode 100644
index 2540beaf68..0000000000
--- a/Libraries/LibJS/Tests/custom-@@hasInstance.js
+++ /dev/null
@@ -1,9 +0,0 @@
-test("basic functionality", () => {
- function Foo() {}
- Foo[Symbol.hasInstance] = value => {
- return value === 2;
- };
-
- expect(new Foo() instanceof Foo).toBeFalse();
- expect(2 instanceof Foo).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/custom-@@toStringTag.js b/Libraries/LibJS/Tests/custom-@@toStringTag.js
deleted file mode 100644
index e297961e55..0000000000
--- a/Libraries/LibJS/Tests/custom-@@toStringTag.js
+++ /dev/null
@@ -1,26 +0,0 @@
-test("inside objects", () => {
- const o = {
- [Symbol.toStringTag]: "hello friends",
- };
-
- expect(o.toString()).toBe("[object hello friends]");
-});
-
-test("inside classes", () => {
- class A {
- constructor() {
- this[Symbol.toStringTag] = "hello friends";
- }
- }
-
- const a = new A();
- expect(a.toString()).toBe("[object hello friends]");
-});
-
-test("non-string values are ignored", () => {
- const o = {
- [Symbol.toStringTag]: [1, 2, 3],
- };
-
- expect(o.toString()).toBe("[object Object]");
-});
diff --git a/Libraries/LibJS/Tests/debugger-statement.js b/Libraries/LibJS/Tests/debugger-statement.js
deleted file mode 100644
index e5b0b14761..0000000000
--- a/Libraries/LibJS/Tests/debugger-statement.js
+++ /dev/null
@@ -1,3 +0,0 @@
-test("debugger keyword", () => {
- expect("debugger").toEval();
-});
diff --git a/Libraries/LibJS/Tests/empty-statements.js b/Libraries/LibJS/Tests/empty-statements.js
deleted file mode 100644
index 1c8fe467b8..0000000000
--- a/Libraries/LibJS/Tests/empty-statements.js
+++ /dev/null
@@ -1,19 +0,0 @@
-test("empty semicolon statements", () => {
- expect(";;;").toEval();
-});
-
-test("if with no body", () => {
- expect("if (true);").toEval();
-});
-
-test("chained ifs with no bodies", () => {
- expect("if (false); else if (false); else;").toEval();
-});
-
-test("while with no body", () => {
- expect("while (false);").toEval();
-});
-
-test("do while with no body", () => {
- expect("do; while (false);").toEval();
-});
diff --git a/Libraries/LibJS/Tests/exception-ReferenceError.js b/Libraries/LibJS/Tests/exception-ReferenceError.js
deleted file mode 100644
index 5cd436d0bf..0000000000
--- a/Libraries/LibJS/Tests/exception-ReferenceError.js
+++ /dev/null
@@ -1,3 +0,0 @@
-test("unknown variable produces ReferenceError", () => {
- expect(new Function("i < 3")).toThrow(ReferenceError);
-});
diff --git a/Libraries/LibJS/Tests/exception-in-catch-block.js b/Libraries/LibJS/Tests/exception-in-catch-block.js
deleted file mode 100644
index 2a0fa6e1fc..0000000000
--- a/Libraries/LibJS/Tests/exception-in-catch-block.js
+++ /dev/null
@@ -1,25 +0,0 @@
-test("Issue #3437, exception thrown in catch {} block", () => {
- var tryHasBeenExecuted = false;
- var catchHasBeenExecuted = false;
- var finallyHasBeenExecuted = false;
- expect(() => {
- try {
- tryHasBeenExecuted = true;
- foo();
- // execution must not reach this step
- expect().fail();
- } catch (e) {
- catchHasBeenExecuted = true;
- bar();
- // ...also not this step
- expect().fail();
- } finally {
- finallyHasBeenExecuted = true;
- }
- // ...or this step
- expect().fail();
- }).toThrow(ReferenceError, "'bar' is not defined");
- expect(tryHasBeenExecuted).toBeTrue();
- expect(catchHasBeenExecuted).toBeTrue();
- expect(finallyHasBeenExecuted).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/exponentiation-basic.js b/Libraries/LibJS/Tests/exponentiation-basic.js
deleted file mode 100644
index d260f43a1b..0000000000
--- a/Libraries/LibJS/Tests/exponentiation-basic.js
+++ /dev/null
@@ -1,37 +0,0 @@
-test("regular exponentiation", () => {
- expect(2 ** 0).toBe(1);
- expect(2 ** 1).toBe(2);
- expect(2 ** 2).toBe(4);
- expect(2 ** 3).toBe(8);
- expect(3 ** 2).toBe(9);
- expect(0 ** 0).toBe(1);
- expect(2 ** (3 ** 2)).toBe(512);
- expect(2 ** (3 ** 2)).toBe(512);
- expect((2 ** 3) ** 2).toBe(64);
-});
-
-test("exponentiation with negatives", () => {
- expect(2 ** -3).toBe(0.125);
- expect((-2) ** 3).toBe(-8);
-
- // FIXME: This should fail :)
- // expect("-2 ** 3").not.toEval();
-});
-
-test("exponentiation with non-numeric primitives", () => {
- expect("2" ** "3").toBe(8);
- expect("" ** []).toBe(1);
- expect([] ** null).toBe(1);
- expect(null ** null).toBe(1);
- expect(undefined ** null).toBe(1);
-});
-
-test("exponentiation that produces NaN", () => {
- expect(NaN ** 2).toBeNaN();
- expect(2 ** NaN).toBeNaN();
- expect(undefined ** 2).toBeNaN();
- expect(2 ** undefined).toBeNaN();
- expect(null ** undefined).toBeNaN();
- expect(2 ** "foo").toBeNaN();
- expect("foo" ** 2).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/functions/arrow-functions.js b/Libraries/LibJS/Tests/functions/arrow-functions.js
deleted file mode 100644
index 6af8790514..0000000000
--- a/Libraries/LibJS/Tests/functions/arrow-functions.js
+++ /dev/null
@@ -1,164 +0,0 @@
-test("no arguments", () => {
- let getNumber = () => {
- return 42;
- };
- expect(getNumber()).toBe(42);
-
- getNumber = () => 42;
- expect(getNumber()).toBe(42);
-
- getNumber = () => {
- return 99;
- };
- expect(getNumber()).toBe(99);
- getNumber = () => 99;
- expect(getNumber()).toBe(99);
-});
-
-test("arguments", () => {
- let add = (a, b) => a + b;
- expect(add(2, 3)).toBe(5);
-
- const addBlock = (a, b) => {
- let res = a + b;
- return res;
- };
- expect(addBlock(5, 4)).toBe(9);
-});
-
-test("inside an array", () => {
- let chompy = [x => x, 2];
- expect(chompy).toHaveLength(2);
- expect(chompy[0](1)).toBe(1);
-});
-
-test("return object literal", () => {
- const makeObject = (a, b) => ({ a, b });
- const obj = makeObject(33, 44);
- expect(typeof obj).toBe("object");
- expect(obj.a).toBe(33);
- expect(obj.b).toBe(44);
-});
-
-test("return undefined", () => {
- let returnUndefined = () => {};
- expect(returnUndefined()).toBeUndefined();
-});
-
-test("return array literal", () => {
- const makeArray = (a, b) => [a, b];
- const array = makeArray("3", { foo: 4 });
- expect(array[0]).toBe("3");
- expect(array[1].foo).toBe(4);
-});
-
-test("return numeric expression", () => {
- let square = x => x * x;
- expect(square(3)).toBe(9);
-
- let squareBlock = x => {
- return x * x;
- };
- expect(squareBlock(4)).toBe(16);
-});
-
-test("return called arrow function expression", () => {
- const message = (who => "Hello " + who)("friends!");
- expect(message).toBe("Hello friends!");
-
- const sum = ((x, y, z) => x + y + z)(1, 2, 3);
- expect(sum).toBe(6);
-
- const product = ((x, y, z) => {
- let res = x * y * z;
- return res;
- })(5, 4, 2);
- expect(product).toBe(40);
-
- const half = (x => {
- return x / 2;
- })(10);
- expect(half).toBe(5);
-});
-
-test("currying", () => {
- let add = a => b => a + b;
- expect(typeof add(1)).toBe("function");
- expect(typeof add(1, 2)).toBe("function");
- expect(add(1)(2)).toBe(3);
-});
-
-test("with comma operator", () => {
- let foo, bar;
- (foo = bar), baz => {};
- expect(foo).toBe(undefined);
- expect(bar).toBe(undefined);
-});
-
-test("arrow functions in objects", () => {
- function FooBar() {
- this.x = {
- y: () => this,
- z: function () {
- return (() => this)();
- },
- };
- }
-
- const foobar = new FooBar();
- expect(foobar.x.y()).toBe(foobar);
- expect(foobar.x.z()).toBe(foobar.x);
-});
-
-test("strict mode propagation", () => {
- (() => {
- "use strict";
- expect(isStrictMode()).toBeTrue();
-
- (() => {
- expect(isStrictMode()).toBeTrue();
- })();
- })();
-
- (() => {
- "use strict";
- expect(isStrictMode()).toBeTrue();
- })();
-
- (() => {
- expect(isStrictMode()).toBeFalse();
-
- (() => {
- "use strict";
- expect(isStrictMode()).toBeTrue();
- })();
-
- expect(isStrictMode()).toBeFalse();
- })();
-});
-
-test("no prototype", () => {
- let foo = () => {};
- expect(foo).not.toHaveProperty("prototype");
-});
-
-test("cannot be constructed", () => {
- let foo = () => {};
- expect(() => {
- new foo();
- }).toThrowWithMessage(TypeError, "foo is not a constructor");
-});
-
-test("syntax errors", () => {
- expect("a, => {}").not.toEval();
- expect("(a, => {}").not.toEval();
- expect("(,) => {}").not.toEval();
- expect("(,,) => {}").not.toEval();
- expect("(a,,) => {}").not.toEval();
- expect("(a,,b) => {}").not.toEval();
- expect("(a, ...b, ...c) => {}").not.toEval();
- expect("(a b) => {}").not.toEval();
- expect("(a ...b) => {}").not.toEval();
- expect("(a = 1 = 2) => {}").not.toEval();
- expect("()\n=> {}").not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/functions/constructor-basic.js b/Libraries/LibJS/Tests/functions/constructor-basic.js
deleted file mode 100644
index cf58525634..0000000000
--- a/Libraries/LibJS/Tests/functions/constructor-basic.js
+++ /dev/null
@@ -1,11 +0,0 @@
-test("basic functionality", () => {
- function Foo() {
- this.x = 123;
- }
-
- expect(Foo.prototype.constructor).toBe(Foo);
-
- const foo = new Foo();
- expect(foo.constructor).toBe(Foo);
- expect(foo.x).toBe(123);
-});
diff --git a/Libraries/LibJS/Tests/functions/function-TypeError.js b/Libraries/LibJS/Tests/functions/function-TypeError.js
deleted file mode 100644
index 41fb6ae196..0000000000
--- a/Libraries/LibJS/Tests/functions/function-TypeError.js
+++ /dev/null
@@ -1,47 +0,0 @@
-test("calling non-function", () => {
- expect(() => {
- const a = true;
- a();
- }).toThrowWithMessage(TypeError, "true is not a function (evaluated from 'a')");
-});
-
-test("calling number", () => {
- expect(() => {
- const a = 100 + 20 + 3;
- a();
- }).toThrowWithMessage(TypeError, "123 is not a function (evaluated from 'a')");
-});
-
-test("calling undefined object key", () => {
- expect(() => {
- const o = {};
- o.a();
- }).toThrowWithMessage(TypeError, "undefined is not a function (evaluated from 'o.a')");
-});
-
-test("calling object", () => {
- expect(() => {
- Math();
- }).toThrowWithMessage(
- TypeError,
- "[object MathObject] is not a function (evaluated from 'Math')"
- );
-});
-
-test("constructing object", () => {
- expect(() => {
- new Math();
- }).toThrowWithMessage(
- TypeError,
- "[object MathObject] is not a constructor (evaluated from 'Math')"
- );
-});
-
-test("constructing native function", () => {
- expect(() => {
- new isNaN();
- }).toThrowWithMessage(
- TypeError,
- "[object NativeFunction] is not a constructor (evaluated from 'isNaN')"
- );
-});
diff --git a/Libraries/LibJS/Tests/functions/function-default-parameters.js b/Libraries/LibJS/Tests/functions/function-default-parameters.js
deleted file mode 100644
index 5a3cafc3b3..0000000000
--- a/Libraries/LibJS/Tests/functions/function-default-parameters.js
+++ /dev/null
@@ -1,143 +0,0 @@
-test("single default parameter", () => {
- function func(a = 6) {
- return typeof a;
- }
-
- const arrowFunc = (a = 6) => typeof a;
-
- expect(func()).toBe("number");
- expect(func(5)).toBe("number");
- expect(func(undefined)).toBe("number");
- expect(func(false)).toBe("boolean");
- expect(func(null)).toBe("object");
- expect(func({})).toBe("object");
-
- expect(arrowFunc()).toBe("number");
- expect(arrowFunc(5)).toBe("number");
- expect(arrowFunc(undefined)).toBe("number");
- expect(arrowFunc(false)).toBe("boolean");
- expect(arrowFunc(null)).toBe("object");
- expect(arrowFunc({})).toBe("object");
-});
-
-test("two parameters, second one is default", () => {
- function func(a, b = 1) {
- return a + b;
- }
-
- const arrowFunc = (a, b = 1) => a + b;
-
- expect(func(4, 5)).toBe(9);
- expect(func(4)).toBe(5);
- expect(func(4, undefined)).toBe(5);
- expect(func()).toBeNaN();
-
- expect(arrowFunc(4, 5)).toBe(9);
- expect(arrowFunc(4)).toBe(5);
- expect(arrowFunc(4, undefined)).toBe(5);
- expect(arrowFunc()).toBeNaN();
-});
-
-test("two parameters, first one is default", () => {
- function func(a = 5, b) {
- return a + b;
- }
-
- const arrowFunc = (a = 5, b) => a + b;
-
- expect(func(4, 5)).toBe(9);
- expect(func(undefined, 4)).toBe(9);
- expect(func()).toBeNaN();
-
- expect(arrowFunc(4, 5)).toBe(9);
- expect(arrowFunc(undefined, 4)).toBe(9);
- expect(arrowFunc()).toBeNaN();
-});
-
-test("default parameter references a previous parameter", () => {
- function func(a, b = a) {
- return a + b;
- }
-
- const arrowFunc = (a, b = a) => a + b;
-
- expect(func(4, 5)).toBe(9);
- expect(func(4)).toBe(8);
- expect(func("hf")).toBe("hfhf");
- expect(func(true)).toBe(2);
- expect(func()).toBeNaN();
-
- expect(arrowFunc(4, 5)).toBe(9);
- expect(arrowFunc(4)).toBe(8);
- expect(arrowFunc("hf")).toBe("hfhf");
- expect(arrowFunc(true)).toBe(2);
- expect(arrowFunc()).toBeNaN();
-});
-
-test("parameter with a function default value", () => {
- function func(
- a = function () {
- return 5;
- }
- ) {
- return a();
- }
-
- const arrowFunc = (
- a = function () {
- return 5;
- }
- ) => a();
-
- expect(func()).toBe(5);
- expect(
- func(function () {
- return 10;
- })
- ).toBe(10);
- expect(func(() => 10)).toBe(10);
-
- expect(arrowFunc()).toBe(5);
- expect(
- arrowFunc(function () {
- return 10;
- })
- ).toBe(10);
- expect(arrowFunc(() => 10)).toBe(10);
-});
-
-test("parameter with an arrow function default value", () => {
- function func(a = () => 5) {
- return a();
- }
-
- const arrowFunc = (a = () => 5) => a();
-
- expect(func()).toBe(5);
- expect(
- func(function () {
- return 10;
- })
- ).toBe(10);
- expect(func(() => 10)).toBe(10);
- expect(arrowFunc()).toBe(5);
- expect(
- arrowFunc(function () {
- return 10;
- })
- ).toBe(10);
- expect(arrowFunc(() => 10)).toBe(10);
-});
-
-test("parameter with an object default value", () => {
- function func(a = { foo: "bar" }) {
- return a.foo;
- }
-
- const arrowFunc = (a = { foo: "bar" }) => a.foo;
-
- expect(func()).toBe("bar");
- expect(func({ foo: "baz" })).toBe("baz");
- expect(arrowFunc()).toBe("bar");
- expect(arrowFunc({ foo: "baz" })).toBe("baz");
-});
diff --git a/Libraries/LibJS/Tests/functions/function-duplicate-parameters.js b/Libraries/LibJS/Tests/functions/function-duplicate-parameters.js
deleted file mode 100644
index 8a44337ba3..0000000000
--- a/Libraries/LibJS/Tests/functions/function-duplicate-parameters.js
+++ /dev/null
@@ -1,45 +0,0 @@
-test("function with duplicate parameter names", () => {
- function foo(bar, _, bar) {
- return bar;
- }
- expect(foo(1, 2, 3)).toBe(3);
-});
-
-test("syntax errors", () => {
- // Regular function in strict mode
- expect(`
- "use strict";
- function foo(bar, bar) {}
- `).not.toEval();
-
- // Arrow function in strict mode
- expect(`
- "use strict";
- const foo = (bar, bar) => {};
- `).not.toEval();
-
- // Arrow function in non-strict mode
- expect(`
- const foo = (bar, bar) => {};
- `).not.toEval();
-
- // Regular function with rest parameter
- expect(`
- function foo(bar, ...bar) {}
- `).not.toEval();
-
- // Arrow function with rest parameter
- expect(`
- const foo = (bar, ...bar) => {};
- `).not.toEval();
-
- // Regular function with default parameter
- expect(`
- function foo(bar, bar = 1) {}
- `).not.toEval();
-
- // Arrow function with default parameter
- expect(`
- const foo = (bar, bar = 1) => {};
- `).not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/functions/function-hoisting.js b/Libraries/LibJS/Tests/functions/function-hoisting.js
deleted file mode 100644
index 3345cc4d5f..0000000000
--- a/Libraries/LibJS/Tests/functions/function-hoisting.js
+++ /dev/null
@@ -1,39 +0,0 @@
-test("basic functionality", () => {
- let callHoisted = hoisted();
- function hoisted() {
- return "foo";
- }
- expect(hoisted()).toBe("foo");
- expect(callHoisted).toBe("foo");
-});
-
-// First two calls produce a ReferenceError, but the declarations should be hoisted
-test.skip("functions are hoisted across non-lexical scopes", () => {
- expect(scopedHoisted).toBeUndefined();
- expect(callScopedHoisted).toBeUndefined();
- {
- var callScopedHoisted = scopedHoisted();
- function scopedHoisted() {
- return "foo";
- }
- expect(scopedHoisted()).toBe("foo");
- expect(callScopedHoisted).toBe("foo");
- }
- expect(scopedHoisted()).toBe("foo");
- expect(callScopedHoisted).toBe("foo");
-});
-
-test("functions are not hoisted across lexical scopes", () => {
- const test = () => {
- var iife = (function () {
- return declaredLater();
- })();
- function declaredLater() {
- return "yay";
- }
- return iife;
- };
-
- expect(() => declaredLater).toThrow(ReferenceError);
- expect(test()).toBe("yay");
-});
diff --git a/Libraries/LibJS/Tests/functions/function-length.js b/Libraries/LibJS/Tests/functions/function-length.js
deleted file mode 100644
index d57b773c09..0000000000
--- a/Libraries/LibJS/Tests/functions/function-length.js
+++ /dev/null
@@ -1,23 +0,0 @@
-test("basic functionality", () => {
- function foo() {}
- expect(foo).toHaveLength(0);
- expect((foo.length = 5)).toBe(5);
- expect(foo).toHaveLength(0);
-
- function bar(a, b, c) {}
- expect(bar).toHaveLength(3);
- expect((bar.length = 5)).toBe(5);
- expect(bar).toHaveLength(3);
-});
-
-test("functions with special parameter lists", () => {
- function baz(a, b = 1, c) {}
- expect(baz).toHaveLength(1);
- expect((baz.length = 5)).toBe(5);
- expect(baz).toHaveLength(1);
-
- function qux(a, b, ...c) {}
- expect(qux).toHaveLength(2);
- expect((qux.length = 2)).toBe(2);
- expect(qux).toHaveLength(2);
-});
diff --git a/Libraries/LibJS/Tests/functions/function-missing-arg.js b/Libraries/LibJS/Tests/functions/function-missing-arg.js
deleted file mode 100644
index f599d05ced..0000000000
--- a/Libraries/LibJS/Tests/functions/function-missing-arg.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- function foo(a, b) {
- return a + b;
- }
-
- expect(foo()).toBeNaN();
- expect(foo(1)).toBeNaN();
- expect(foo(2, 3)).toBe(5);
- expect(foo(2, 3, 4)).toBe(5);
-});
diff --git a/Libraries/LibJS/Tests/functions/function-name.js b/Libraries/LibJS/Tests/functions/function-name.js
deleted file mode 100644
index 90520187d9..0000000000
--- a/Libraries/LibJS/Tests/functions/function-name.js
+++ /dev/null
@@ -1,57 +0,0 @@
-test("basic functionality", () => {
- expect(function () {}.name).toBe("");
-
- function bar() {}
- expect(bar.name).toBe("bar");
- expect((bar.name = "baz")).toBe("baz");
- expect(bar.name).toBe("bar");
-});
-
-test("function assigned to variable", () => {
- let foo = function () {};
- expect(foo.name).toBe("foo");
- expect((foo.name = "bar")).toBe("bar");
- expect(foo.name).toBe("foo");
-
- let a, b;
- a = b = function () {};
- expect(a.name).toBe("b");
- expect(b.name).toBe("b");
-});
-
-test("functions in array assigned to variable", () => {
- const arr = [function () {}, function () {}, function () {}];
- expect(arr[0].name).toBe("arr");
- expect(arr[1].name).toBe("arr");
- expect(arr[2].name).toBe("arr");
-});
-
-test("functions in objects", () => {
- let f;
- let o = { a: function () {} };
-
- expect(o.a.name).toBe("a");
- f = o.a;
- expect(f.name).toBe("a");
- expect(o.a.name).toBe("a");
-
- o = { ...o, b: f };
- expect(o.a.name).toBe("a");
- expect(o.b.name).toBe("a");
-
- o.c = function () {};
- expect(o.c.name).toBe("c");
-});
-
-test("names of native functions", () => {
- expect(console.debug.name).toBe("debug");
- expect((console.debug.name = "warn")).toBe("warn");
- expect(console.debug.name).toBe("debug");
-});
-
-test("cyclic members should not cause infinite recursion (#3471)", () => {
- let a = [() => 4];
- a[1] = a;
- a = a;
- expect(a[0].name).toBe("a");
-});
diff --git a/Libraries/LibJS/Tests/functions/function-new-target.js b/Libraries/LibJS/Tests/functions/function-new-target.js
deleted file mode 100644
index 9eb7659391..0000000000
--- a/Libraries/LibJS/Tests/functions/function-new-target.js
+++ /dev/null
@@ -1,25 +0,0 @@
-test("basic functionality", () => {
- function foo() {
- return new.target;
- }
- expect(foo()).toBeUndefined();
- expect(new foo()).toEqual(foo);
-
- function bar() {
- const baz = () => new.target;
- return baz();
- }
- expect(bar()).toBeUndefined();
- expect(new bar()).toEqual(bar);
-
- class baz {
- constructor() {
- this.newTarget = new.target;
- }
- }
- expect(new baz().newTarget).toEqual(baz);
-});
-
-test("syntax error outside of function", () => {
- expect("new.target").not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/functions/function-prototype-writable.js b/Libraries/LibJS/Tests/functions/function-prototype-writable.js
deleted file mode 100644
index ba8be23f43..0000000000
--- a/Libraries/LibJS/Tests/functions/function-prototype-writable.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("a function's prototype property should be writable", () => {
- function x() {}
- var desc = Object.getOwnPropertyDescriptor(x, "prototype");
- expect(desc.writable).toBe(true);
- expect(desc.enumerable).toBe(false);
- expect(desc.configurable).toBe(false);
-
- x.prototype = 1;
- expect(x.prototype).toBe(1);
-});
diff --git a/Libraries/LibJS/Tests/functions/function-rest-params.js b/Libraries/LibJS/Tests/functions/function-rest-params.js
deleted file mode 100644
index 83ed411675..0000000000
--- a/Libraries/LibJS/Tests/functions/function-rest-params.js
+++ /dev/null
@@ -1,47 +0,0 @@
-test("rest parameter with no arguments", () => {
- function foo(...a) {
- expect(a).toBeInstanceOf(Array);
- expect(a).toHaveLength(0);
- }
- foo();
-});
-
-test("rest parameter with arguments", () => {
- function foo(...a) {
- expect(a).toEqual(["foo", 123, undefined, { foo: "bar" }]);
- }
- foo("foo", 123, undefined, { foo: "bar" });
-});
-
-test("rest parameter after normal parameters with no arguments", () => {
- function foo(a, b, ...c) {
- expect(a).toBe("foo");
- expect(b).toBe(123);
- expect(c).toEqual([]);
- }
- foo("foo", 123);
-});
-
-test("rest parameter after normal parameters with arguments", () => {
- function foo(a, b, ...c) {
- expect(a).toBe("foo");
- expect(b).toBe(123);
- expect(c).toEqual([undefined, { foo: "bar" }]);
- }
- foo("foo", 123, undefined, { foo: "bar" });
-});
-
-test("basic arrow function rest parameters", () => {
- let foo = (...a) => {
- expect(a).toBeInstanceOf(Array);
- expect(a).toHaveLength(0);
- };
- foo();
-
- foo = (a, b, ...c) => {
- expect(a).toBe("foo");
- expect(b).toBe(123);
- expect(c).toEqual([undefined, { foo: "bar" }]);
- };
- foo("foo", 123, undefined, { foo: "bar" });
-});
diff --git a/Libraries/LibJS/Tests/functions/function-spread.js b/Libraries/LibJS/Tests/functions/function-spread.js
deleted file mode 100644
index fcfcd9cd48..0000000000
--- a/Libraries/LibJS/Tests/functions/function-spread.js
+++ /dev/null
@@ -1,38 +0,0 @@
-test("basic functionality", () => {
- const sum = (a, b, c) => a + b + c;
- const a = [1, 2, 3];
-
- expect(sum(...a)).toBe(6);
- expect(sum(1, ...a)).toBe(4);
- expect(sum(...a, 10)).toBe(6);
-
- const foo = (a, b, c) => c;
-
- const o = { bar: [1, 2, 3] };
- expect(foo(...o.bar)).toBe(3);
- expect(foo(..."abc")).toBe("c");
-});
-
-test("spreading custom iterable", () => {
- let o = {
- [Symbol.iterator]() {
- return {
- i: 0,
- next() {
- if (this.i++ === 3) {
- return { done: true };
- }
- return { value: this.i };
- },
- };
- },
- };
-
- expect(Math.max(...o)).toBe(3);
-});
-
-test("spreading non iterable", () => {
- expect(() => {
- [...1];
- }).toThrowWithMessage(TypeError, "1 is not iterable");
-});
diff --git a/Libraries/LibJS/Tests/functions/function-strict-mode.js b/Libraries/LibJS/Tests/functions/function-strict-mode.js
deleted file mode 100644
index 99ec10b9a7..0000000000
--- a/Libraries/LibJS/Tests/functions/function-strict-mode.js
+++ /dev/null
@@ -1,60 +0,0 @@
-test("non strict-mode by default", () => {
- expect(isStrictMode()).toBeFalse();
-});
-
-test("use strict with double quotes", () => {
- "use strict";
- expect(isStrictMode()).toBeTrue();
-});
-
-// prettier-ignore
-test("use strict with single quotes", () => {
- 'use strict';
- expect(isStrictMode()).toBeTrue();
-});
-
-// prettier-ignore
-test("use strict with backticks does not yield strict mode", () => {
- `use strict`;
- expect(isStrictMode()).toBeFalse();
-});
-
-// prettier-ignore
-test("use strict with single quotes after statement does not yield strict mode code", () => {
- ;'use strict';
- expect(isStrictMode()).toBeFalse();
-});
-
-// prettier-ignore
-test("use strict with double quotes after statement does not yield strict mode code", () => {
- ;"use strict";
- expect(isStrictMode()).toBeFalse();
-});
-
-test("use strict interrupted by a line continuation does not yield strict mode code", () => {
- "use \
-strict";
- expect(isStrictMode()).toBeFalse();
-});
-
-test("strict mode propagates down the scope chain", () => {
- "use strict";
- expect(isStrictMode()).toBeTrue();
- (function () {
- expect(isStrictMode()).toBeTrue();
- })();
-});
-
-test("strict mode does not propagate up the scope chain", () => {
- expect(isStrictMode()).toBeFalse();
- (function () {
- "use strict";
- expect(isStrictMode()).toBeTrue();
- })();
- expect(isStrictMode()).toBeFalse();
-});
-
-test('only the string "use strict" yields strict mode code', () => {
- "use stric";
- expect(isStrictMode()).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/functions/function-this-in-arguments.js b/Libraries/LibJS/Tests/functions/function-this-in-arguments.js
deleted file mode 100644
index cf24b6f8aa..0000000000
--- a/Libraries/LibJS/Tests/functions/function-this-in-arguments.js
+++ /dev/null
@@ -1,16 +0,0 @@
-test("basic functionality", () => {
- expect(typeof this).toBe("object");
- expect(this).toBe(globalThis);
-});
-
-test("this inside instantiated functions is not globalThis", () => {
- let functionThis;
- function Foo() {
- this.x = 5;
- functionThis = this;
- }
-
- new Foo();
- expect(typeof functionThis).toBe("object");
- expect(functionThis.x).toBe(5);
-});
diff --git a/Libraries/LibJS/Tests/if-statement-function-declaration.js b/Libraries/LibJS/Tests/if-statement-function-declaration.js
deleted file mode 100644
index 583585ebe5..0000000000
--- a/Libraries/LibJS/Tests/if-statement-function-declaration.js
+++ /dev/null
@@ -1,41 +0,0 @@
-describe("function declarations in if statement clauses", () => {
- test("if clause", () => {
- if (true) function foo() {}
- if (false) function bar() {}
- expect(typeof globalThis.foo).toBe("function");
- expect(typeof globalThis.bar).toBe("undefined");
- });
-
- test("else clause", () => {
- if (false);
- else function foo() {}
- if (true);
- else function bar() {}
- expect(typeof globalThis.foo).toBe("function");
- expect(typeof globalThis.bar).toBe("undefined");
- });
-
- test("if and else clause", () => {
- if (true) function foo() {}
- else function bar() {}
- expect(typeof globalThis.foo).toBe("function");
- expect(typeof globalThis.bar).toBe("undefined");
- });
-
- test("syntax error in strict mode", () => {
- expect(`
- "use strict";
- if (true) function foo() {}
- `).not.toEval();
- expect(`
- "use strict";
- if (false);
- else function foo() {}
- `).not.toEval();
- expect(`
- "use strict";
- if (false) function foo() {}
- else function bar() {}
- `).not.toEval();
- });
-});
diff --git a/Libraries/LibJS/Tests/indexed-access-string-object.js b/Libraries/LibJS/Tests/indexed-access-string-object.js
deleted file mode 100644
index 7946cbfbf4..0000000000
--- a/Libraries/LibJS/Tests/indexed-access-string-object.js
+++ /dev/null
@@ -1,15 +0,0 @@
-test("string literal indexing", () => {
- var s = "foo";
- expect(s[0]).toBe("f");
- expect(s[1]).toBe("o");
- expect(s[2]).toBe("o");
- expect(s[3]).toBeUndefined();
-});
-
-test("string object indexing", () => {
- var s = new String("bar");
- expect(s[0]).toBe("b");
- expect(s[1]).toBe("a");
- expect(s[2]).toBe("r");
- expect(s[3]).toBeUndefined();
-});
diff --git a/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js b/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js
deleted file mode 100644
index ec5024f8ec..0000000000
--- a/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js
+++ /dev/null
@@ -1,32 +0,0 @@
-test("assignment to function call", () => {
- expect(() => {
- function foo() {}
- foo() = "foo";
- }).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment");
-});
-
-test("assignment to function call in strict mode", () => {
- expect("'use strict'; foo() = 'foo'").not.toEval();
-});
-
-test("assignment to inline function call", () => {
- expect(() => {
- (function () {})() = "foo";
- }).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment");
-});
-
-test("assignment to invalid LHS is syntax error", () => {
- expect("1 += 1").not.toEval();
- expect("1 -= 1").not.toEval();
- expect("1 *= 1").not.toEval();
- expect("1 /= 1").not.toEval();
- expect("1 %= 1").not.toEval();
- expect("1 **= 1").not.toEval();
- expect("1 &= 1").not.toEval();
- expect("1 |= 1").not.toEval();
- expect("1 ^= 1").not.toEval();
- expect("1 <<= 1").not.toEval();
- expect("1 >>= 1").not.toEval();
- expect("1 >>>= 1").not.toEval();
- expect("1 = 1").not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/iterators/%IteratorPrototype%.js b/Libraries/LibJS/Tests/iterators/%IteratorPrototype%.js
deleted file mode 100644
index efdb32e51a..0000000000
--- a/Libraries/LibJS/Tests/iterators/%IteratorPrototype%.js
+++ /dev/null
@@ -1,12 +0,0 @@
-const getIteratorPrototype = () =>
- Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
-
-test("prototype of %IteratorPrototype% is %ObjectPrototype%", () => {
- let itProto = getIteratorPrototype();
- expect(Object.getPrototypeOf(itProto)).toBe(Object.getPrototypeOf({}));
-});
-
-test("@@iterator of %IteratorPrototype% is itself", () => {
- let itProto = getIteratorPrototype();
- expect(itProto[Symbol.iterator]()).toBe(itProto);
-});
diff --git a/Libraries/LibJS/Tests/iterators/array-iterator.js b/Libraries/LibJS/Tests/iterators/array-iterator.js
deleted file mode 100644
index 82af3e942d..0000000000
--- a/Libraries/LibJS/Tests/iterators/array-iterator.js
+++ /dev/null
@@ -1,53 +0,0 @@
-test("length", () => {
- expect(Array.prototype[Symbol.iterator]).toHaveLength(0);
-});
-
-test("@@toStringTag", () => {
- expect([].values()[Symbol.toStringTag]).toBe("Array Iterator");
- expect([].values().toString()).toBe("[object Array Iterator]");
-});
-
-test("same function as Array.prototype.values", () => {
- expect(Array.prototype[Symbol.iterator]).toBe(Array.prototype.values);
-});
-
-test("basic functionality", () => {
- const a = [1, 2, 3];
- const it = a[Symbol.iterator]();
- expect(it.next()).toEqual({ value: 1, done: false });
- expect(it.next()).toEqual({ value: 2, done: false });
- expect(it.next()).toEqual({ value: 3, done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
-});
-
-test("works when applied to non-object", () => {
- [true, false, 9, 2n, Symbol()].forEach(primitive => {
- const it = [][Symbol.iterator].call(primitive);
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
- });
-});
-
-test("item added to array before exhaustion is accessible", () => {
- const a = [1, 2];
- const it = a[Symbol.iterator]();
- expect(it.next()).toEqual({ value: 1, done: false });
- expect(it.next()).toEqual({ value: 2, done: false });
- a.push(3);
- expect(it.next()).toEqual({ value: 3, done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
-});
-
-test("item added to array after exhaustion is inaccessible", () => {
- const a = [1, 2];
- const it = a[Symbol.iterator]();
- expect(it.next()).toEqual({ value: 1, done: false });
- expect(it.next()).toEqual({ value: 2, done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
- a.push(3);
- expect(it.next()).toEqual({ value: undefined, done: true });
-});
diff --git a/Libraries/LibJS/Tests/iterators/string-iterator.js b/Libraries/LibJS/Tests/iterators/string-iterator.js
deleted file mode 100644
index 379f6f05fc..0000000000
--- a/Libraries/LibJS/Tests/iterators/string-iterator.js
+++ /dev/null
@@ -1,48 +0,0 @@
-test("length", () => {
- expect(String.prototype[Symbol.iterator]).toHaveLength(0);
-});
-
-test("basic functionality", () => {
- const s = "abcd";
- const it = s[Symbol.iterator]();
- expect(it.next()).toEqual({ value: "a", done: false });
- expect(it.next()).toEqual({ value: "b", done: false });
- expect(it.next()).toEqual({ value: "c", done: false });
- expect(it.next()).toEqual({ value: "d", done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
- expect(it.next()).toEqual({ value: undefined, done: true });
-});
-
-test("casts |this| to string", () => {
- const it = String.prototype[Symbol.iterator].call(45);
- expect(it.next()).toEqual({ value: "4", done: false });
- expect(it.next()).toEqual({ value: "5", done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
-
- const it = String.prototype[Symbol.iterator].call(false);
- expect(it.next()).toEqual({ value: "f", done: false });
- expect(it.next()).toEqual({ value: "a", done: false });
- expect(it.next()).toEqual({ value: "l", done: false });
- expect(it.next()).toEqual({ value: "s", done: false });
- expect(it.next()).toEqual({ value: "e", done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
-
- expect(() => {
- String.prototype[Symbol.iterator].call(null);
- }).toThrowWithMessage(TypeError, "ToObject on null or undefined");
- expect(() => {
- String.prototype[Symbol.iterator].call(undefined);
- }).toThrowWithMessage(TypeError, "ToObject on null or undefined");
-});
-
-test("utf8 compatible", () => {
- const it = "ab\u{1f41e}cde"[Symbol.iterator]();
- expect(it.next()).toEqual({ value: "a", done: false });
- expect(it.next()).toEqual({ value: "b", done: false });
- expect(it.next()).toEqual({ value: "🐞", done: false });
- expect(it.next()).toEqual({ value: "c", done: false });
- expect(it.next()).toEqual({ value: "d", done: false });
- expect(it.next()).toEqual({ value: "e", done: false });
- expect(it.next()).toEqual({ value: undefined, done: true });
-});
diff --git a/Libraries/LibJS/Tests/labels.js b/Libraries/LibJS/Tests/labels.js
deleted file mode 100644
index 1747e8d0bb..0000000000
--- a/Libraries/LibJS/Tests/labels.js
+++ /dev/null
@@ -1,47 +0,0 @@
-test("labeled plain scope", () => {
- test: {
- let o = 1;
- expect(o).toBe(1);
- break test;
- expect().fail();
- }
-});
-
-test("break on plain scope from inner scope", () => {
- outer: {
- {
- break outer;
- }
- expect().fail();
- }
-});
-
-test("labeled for loop with break", () => {
- let counter = 0;
- outer: for (a of [1, 2, 3]) {
- for (b of [4, 5, 6]) {
- if (a === 2 && b === 5) break outer;
- counter++;
- }
- }
- expect(counter).toBe(4);
-});
-
-test("labeled for loop with continue", () => {
- let counter = 0;
- outer: for (a of [1, 2, 3]) {
- for (b of [4, 5, 6]) {
- if (b === 6) continue outer;
- counter++;
- }
- }
- expect(counter).toBe(6);
-});
-
-test("invalid label across scope", () => {
- expect(`
- label: {
- (() => { break label; });
- }
- `).not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/let-scoping.js b/Libraries/LibJS/Tests/let-scoping.js
deleted file mode 100644
index 27c92e23f9..0000000000
--- a/Libraries/LibJS/Tests/let-scoping.js
+++ /dev/null
@@ -1,14 +0,0 @@
-test("let scoping", () => {
- let i = 1;
- {
- let i = 3;
- expect(i).toBe(3);
- }
- expect(i).toBe(1);
-
- {
- const i = 2;
- expect(i).toBe(2);
- }
- expect(i).toBe(1);
-});
diff --git a/Libraries/LibJS/Tests/loops/break-basic.js b/Libraries/LibJS/Tests/loops/break-basic.js
deleted file mode 100644
index 1bb141c618..0000000000
--- a/Libraries/LibJS/Tests/loops/break-basic.js
+++ /dev/null
@@ -1,30 +0,0 @@
-test("Toplevel break inside loop", () => {
- var j = 0;
- for (var i = 0; i < 9; ++i) {
- break;
- ++j;
- }
- expect(j).toBe(0);
-});
-
-test("break inside sub-blocks", () => {
- var j = 0;
- for (var i = 0; i < 9; ++i) {
- if (j == 4) {
- break;
- }
- ++j;
- }
- expect(j).toBe(4);
-});
-
-test("break inside curly sub-blocks", () => {
- var j = 0;
- for (var i = 0; i < 9; ++i) {
- if (j == 4) {
- break;
- }
- ++j;
- }
- expect(j).toBe(4);
-});
diff --git a/Libraries/LibJS/Tests/loops/continue-basic.js b/Libraries/LibJS/Tests/loops/continue-basic.js
deleted file mode 100644
index 765a9ead18..0000000000
--- a/Libraries/LibJS/Tests/loops/continue-basic.js
+++ /dev/null
@@ -1,10 +0,0 @@
-test("basic functionality", () => {
- var j = 0;
- for (var i = 0; i < 9; ++i) {
- if (i == 3) {
- continue;
- }
- ++j;
- }
- expect(j).toBe(8);
-});
diff --git a/Libraries/LibJS/Tests/loops/do-while-basic.js b/Libraries/LibJS/Tests/loops/do-while-basic.js
deleted file mode 100644
index c935c5f0a6..0000000000
--- a/Libraries/LibJS/Tests/loops/do-while-basic.js
+++ /dev/null
@@ -1,24 +0,0 @@
-test("basic functionality", () => {
- let number = 0;
- do {
- number++;
- } while (number < 9);
- expect(number).toBe(9);
-});
-
-test("no braces", () => {
- let number = 0;
- do number++;
- while (number < 3);
- expect(number).toBe(3);
-});
-
-test("exception in test expression", () => {
- expect(() => {
- do {} while (foo);
- }).toThrow(ReferenceError);
-});
-
-test("automatic semicolon insertion", () => {
- expect("do {} while (false) foo").toEval();
-});
diff --git a/Libraries/LibJS/Tests/loops/for-basic.js b/Libraries/LibJS/Tests/loops/for-basic.js
deleted file mode 100644
index 8a270ddee6..0000000000
--- a/Libraries/LibJS/Tests/loops/for-basic.js
+++ /dev/null
@@ -1,15 +0,0 @@
-test("basic functionality", () => {
- let a = [];
- for (let i = 0; i < 3; ++i) {
- a.push(i);
- }
- expect(a).toEqual([0, 1, 2]);
-});
-
-test("only condition", () => {
- let a = [];
- for (; a.length < 3; ) {
- a.push("x");
- }
- expect(a).toEqual(["x", "x", "x"]);
-});
diff --git a/Libraries/LibJS/Tests/loops/for-head-errors.js b/Libraries/LibJS/Tests/loops/for-head-errors.js
deleted file mode 100644
index c1b96014b8..0000000000
--- a/Libraries/LibJS/Tests/loops/for-head-errors.js
+++ /dev/null
@@ -1,23 +0,0 @@
-test("using undefined variable in initializer", () => {
- expect(() => {
- for (let i = foo; i < 100; ++i) {}
- }).toThrowWithMessage(ReferenceError, "'foo' is not defined");
-});
-
-test("using undefined variable in condition", () => {
- expect(() => {
- for (let i = 0; i < foo; ++i) {}
- }).toThrowWithMessage(ReferenceError, "'foo' is not defined");
-});
-
-test("using undefined variable in updater", () => {
- let loopCount = 0;
-
- expect(() => {
- for (let i = 0; i < 100; ++foo) {
- loopCount++;
- }
- }).toThrowWithMessage(ReferenceError, "'foo' is not defined");
-
- expect(loopCount).toBe(1);
-});
diff --git a/Libraries/LibJS/Tests/loops/for-in-basic.js b/Libraries/LibJS/Tests/loops/for-in-basic.js
deleted file mode 100644
index 5a35ee1c91..0000000000
--- a/Libraries/LibJS/Tests/loops/for-in-basic.js
+++ /dev/null
@@ -1,45 +0,0 @@
-test("iterate through empty string", () => {
- const a = [];
- for (const property in "") {
- a.push(property);
- }
- expect(a).toEqual([]);
-});
-
-test("iterate through number", () => {
- const a = [];
- for (const property in 123) {
- a.push(property);
- }
- expect(a).toEqual([]);
-});
-
-test("iterate through empty object", () => {
- const a = [];
- for (const property in {}) {
- a.push(property);
- }
- expect(a).toEqual([]);
-});
-
-test("iterate through string", () => {
- const a = [];
- for (const property in "hello") {
- a.push(property);
- }
- expect(a).toEqual(["0", "1", "2", "3", "4"]);
-});
-
-test("iterate through object", () => {
- const a = [];
- for (const property in { a: 1, b: 2, c: 2 }) {
- a.push(property);
- }
- expect(a).toEqual(["a", "b", "c"]);
-});
-
-test("use already-declared variable", () => {
- var property;
- for (property in "abc");
- expect(property).toBe("2");
-});
diff --git a/Libraries/LibJS/Tests/loops/for-no-curlies.js b/Libraries/LibJS/Tests/loops/for-no-curlies.js
deleted file mode 100644
index 913347c395..0000000000
--- a/Libraries/LibJS/Tests/loops/for-no-curlies.js
+++ /dev/null
@@ -1,5 +0,0 @@
-test("basic functionality", () => {
- let number = 0;
- for (let i = 0; i < 3; ++i) for (let j = 0; j < 3; ++j) number++;
- expect(number).toBe(9);
-});
diff --git a/Libraries/LibJS/Tests/loops/for-of-basic.js b/Libraries/LibJS/Tests/loops/for-of-basic.js
deleted file mode 100644
index e08d096c68..0000000000
--- a/Libraries/LibJS/Tests/loops/for-of-basic.js
+++ /dev/null
@@ -1,100 +0,0 @@
-describe("correct behavior", () => {
- test("iterate through array", () => {
- const a = [];
- for (const num of [1, 2, 3]) {
- a.push(num);
- }
- expect(a).toEqual([1, 2, 3]);
- });
-
- test("iterate through string", () => {
- const a = [];
- for (const char of "hello") {
- a.push(char);
- }
- expect(a).toEqual(["h", "e", "l", "l", "o"]);
- });
-
- test("iterate through string object", () => {
- const a = [];
- for (const char of new String("hello")) {
- a.push(char);
- }
- expect(a).toEqual(["h", "e", "l", "l", "o"]);
- });
-
- test("use already-declared variable", () => {
- var char;
- for (char of "abc");
- expect(char).toBe("c");
- });
-
- test("respects custom Symbol.iterator method", () => {
- const o = {
- [Symbol.iterator]() {
- return {
- i: 0,
- next() {
- if (this.i++ == 3) {
- return { done: true };
- }
- return { value: this.i, done: false };
- },
- };
- },
- };
-
- const a = [];
- for (const k of o) {
- a.push(k);
- }
-
- expect(a).toEqual([1, 2, 3]);
- });
-
- test("loops through custom iterator if there is an exception thrown part way through", () => {
- // This tests against the way custom iterators used to be implemented, where the values
- // were all collected at once before the for-of body was executed, instead of getting
- // the values one at a time
- const o = {
- [Symbol.iterator]() {
- return {
- i: 0,
- next() {
- if (this.i++ === 3) {
- throw new Error();
- }
- return { value: this.i };
- },
- };
- },
- };
-
- const a = [];
-
- try {
- for (let k of o) {
- a.push(k);
- }
- expect().fail();
- } catch (e) {
- expect(a).toEqual([1, 2, 3]);
- }
- });
-});
-
-describe("errors", () => {
- test("right hand side is a primitive", () => {
- expect(() => {
- for (const _ of 123) {
- }
- }).toThrowWithMessage(TypeError, "123 is not iterable");
- });
-
- test("right hand side is an object", () => {
- expect(() => {
- for (const _ of { foo: 1, bar: 2 }) {
- }
- }).toThrowWithMessage(TypeError, "[object Object] is not iterable");
- });
-});
diff --git a/Libraries/LibJS/Tests/loops/for-scopes.js b/Libraries/LibJS/Tests/loops/for-scopes.js
deleted file mode 100644
index 2f89bd1229..0000000000
--- a/Libraries/LibJS/Tests/loops/for-scopes.js
+++ /dev/null
@@ -1,18 +0,0 @@
-test("var in for head", () => {
- for (var v = 5; false; );
- expect(v).toBe(5);
-});
-
-test("let in for head", () => {
- for (let l = 5; false; );
- expect(() => {
- l;
- }).toThrowWithMessage(ReferenceError, "'l' is not defined");
-});
-
-test("const in for head", () => {
- for (const c = 5; false; );
- expect(() => {
- c;
- }).toThrowWithMessage(ReferenceError, "'c' is not defined");
-});
diff --git a/Libraries/LibJS/Tests/loops/while-basic.js b/Libraries/LibJS/Tests/loops/while-basic.js
deleted file mode 100644
index f3a4a2da88..0000000000
--- a/Libraries/LibJS/Tests/loops/while-basic.js
+++ /dev/null
@@ -1,25 +0,0 @@
-test("basic functionality", () => {
- let number = 0;
- while (number < 9) {
- number++;
- }
- expect(number).toBe(9);
-});
-
-test("no braces", () => {
- let number = 0;
- while (number < 3) number++;
- expect(number).toBe(3);
-});
-
-test("does not loop when initially false", () => {
- while (false) {
- expect().fail();
- }
-});
-
-test("exception in test expression", () => {
- expect(() => {
- while (foo);
- }).toThrow(ReferenceError);
-});
diff --git a/Libraries/LibJS/Tests/new-expression.js b/Libraries/LibJS/Tests/new-expression.js
deleted file mode 100644
index 827b156910..0000000000
--- a/Libraries/LibJS/Tests/new-expression.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// prettier-ignore
-test("new-expression parsing", () => {
- function Foo() {
- this.x = 1;
- }
-
- let foo = new Foo();
- expect(foo.x).toBe(1);
-
- foo = new Foo
- expect(foo.x).toBe(1);
-
- foo = new
- Foo
- ();
- expect(foo.x).toBe(1);
-
- foo = new Foo + 2
- expect(foo).toBe("[object Object]2");
-});
-
-// prettier-ignore
-test("new-expressions with object keys", () => {
- let a = {
- b: function () {
- this.x = 2;
- },
- };
-
- foo = new a.b();
- expect(foo.x).toBe(2);
-
- foo = new a.b;
- expect(foo.x).toBe(2);
-
- foo = new
- a.b();
- expect(foo.x).toBe(2);
-});
-
-test("new-expressions with function calls", () => {
- function funcGetter() {
- return function (a, b) {
- this.x = a + b;
- };
- }
-
- foo = new funcGetter()(1, 5);
- expect(foo).toBeUndefined();
-
- foo = new (funcGetter())(1, 5);
- expect(foo.x).toBe(6);
-});
diff --git a/Libraries/LibJS/Tests/numeric-literals-basic.js b/Libraries/LibJS/Tests/numeric-literals-basic.js
deleted file mode 100644
index b4b9f75181..0000000000
--- a/Libraries/LibJS/Tests/numeric-literals-basic.js
+++ /dev/null
@@ -1,52 +0,0 @@
-// FIXME: Some of the test cases below are duplicated, presumably to test
-// uppercase as well which then got lowercased by Prettier at some point.
-
-test("hex literals", () => {
- expect(0xff).toBe(255);
- expect(0xff).toBe(255);
-});
-
-test("octal literals", () => {
- expect(0o10).toBe(8);
- expect(0o10).toBe(8);
- expect(010).toBe(8);
- expect(089).toBe(89);
-});
-
-test("binary literals", () => {
- expect(0b10).toBe(2);
- expect(0b10).toBe(2);
-});
-
-test("exponential literals", () => {
- expect(1e3).toBe(1000);
- expect(1e3).toBe(1000);
- expect(1e-3).toBe(0.001);
- expect(1e1).toBe(10);
- expect(0.1e1).toBe(1);
- expect(0.1e1).toBe(1);
- expect(0.1e1).toBe(1);
- expect(0.1e1).toBe(1);
-});
-
-test("decimal numbers", () => {
- expect(1).toBe(1);
- expect(0.1).toBe(0.1);
-});
-
-test("accessing properties of decimal numbers", () => {
- Number.prototype.foo = "foo";
- expect((1).foo).toBe("foo");
- expect((1.1).foo).toBe("foo");
- expect((0.1).foo).toBe("foo");
-});
-
-test("invalid numeric literals", () => {
- expect("1e").not.toEval();
- expect("0x").not.toEval();
- expect("0b").not.toEval();
- expect("0o").not.toEval();
- expect("'use strict'; 0755").not.toEval();
- expect("1in[]").not.toEval();
- expect("2instanceof foo").not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/object-basic.js b/Libraries/LibJS/Tests/object-basic.js
deleted file mode 100644
index 5b3b78fb19..0000000000
--- a/Libraries/LibJS/Tests/object-basic.js
+++ /dev/null
@@ -1,169 +0,0 @@
-describe("correct behavior", () => {
- test("numeric indexing", () => {
- const o = { 1: 23 };
-
- expect(o[1]).toBe(23);
- expect(o[1n]).toBe(23);
- expect(o["1"]).toBe(23);
-
- o[10] = "123";
- expect(o[10]).toBe("123");
- expect(o["10"]).toBe("123");
-
- o[10n] = "1234";
- expect(o[10]).toBe("1234");
- expect(o["10"]).toBe("1234");
- });
-
- test("string indexing", () => {
- let foo = "bar";
-
- const o = {
- foo,
- bar: "baz",
- qux: true ? 10 : 20,
- hello: "friends",
- };
-
- expect(o.foo).toBe("bar");
- expect(o["foo"]).toBe("bar");
- expect(o.qux).toBe(10), expect(o.hello).toBe("friends");
- expect(o["hello"]).toBe("friends");
- });
-
- test("symbol keys", () => {
- let object = {};
- let symbol = Symbol("foo");
-
- object[symbol] = 2;
- expect(object[symbol]).toBe(2);
- });
-
- test("numeric keys", () => {
- const hex = { 0x10: "16" };
- const oct = { 0o10: "8" };
- const bin = { 0b10: "2" };
- const float = { 0.5: "0.5" };
-
- expect(hex["16"]).toBe("16");
- expect(oct["8"]).toBe("8");
- expect(bin["2"]).toBe("2");
- expect(float["0.5"]).toBe("0.5");
- });
-
- test("computed properties", () => {
- const foo = "bar";
- const computed = "computed";
- const o = {
- [1 + 2]: 42,
- [`I am a ${computed} key`]: foo,
- };
-
- expect(o[3]).toBe(42);
- expect(o["I am a computed key"]).toBe("bar");
- });
-
- test("duplicate keys", () => {
- const o = {
- duplicate: "hello",
- duplicate: "world",
- };
- expect(o.duplicate).toBe("world");
- });
-
- test("assigning after creation", () => {
- const o = {};
- o.baz = "test";
-
- expect(o.baz).toBe("test");
- expect(o["baz"]).toBe("test");
-
- expect(o[-1]).toBeUndefined();
- o[-1] = "hello friends";
- expect(o[-1]).toBe("hello friends");
- expect(o["-1"]).toBe("hello friends");
- });
-
- test("floating point keys", () => {
- const math = { 3.14: "pi" };
- expect(math["3.14"]).toBe("pi");
- expect(math[3.14]).toBe("pi");
- });
-
- test("keywords as property keys", () => {
- const o2 = {
- return: 1,
- yield: 1,
- for: 1,
- catch: 1,
- break: 1,
- };
-
- expect(o2.return).toBe(1);
- expect(o2.yield).toBe(1);
- expect(o2.for).toBe(1);
- expect(o2.catch).toBe(1);
- expect(o2.break).toBe(1);
- });
-
- test("prototypical inheritance", () => {
- var base = {
- getNumber() {
- return 10;
- },
- };
-
- var derived = {
- getNumber() {
- return 20 + super.getNumber();
- },
- };
-
- Object.setPrototypeOf(derived, base);
- expect(derived.getNumber()).toBe(30);
- });
-});
-
-describe("side effects", () => {
- let a;
- const append = x => {
- a.push(x);
- };
-
- test("computed key side effects", () => {
- a = [];
- const o3 = { [append(1)]: 1, [append(2)]: 2, [append(3)]: 3 };
- expect(a).toHaveLength(3);
- expect(a[0]).toBe(1);
- expect(a[1]).toBe(2);
- expect(a[2]).toBe(3);
- expect(o3.undefined).toBe(3);
- });
-
- test("value side effects", () => {
- a = [];
- const o4 = { test: append(1), test: append(2), test: append(3) };
- expect(a).toHaveLength(3);
- expect(a[0]).toBe(1);
- expect(a[1]).toBe(2);
- expect(a[2]).toBe(3);
- expect(o4.test).toBeUndefined();
- });
-});
-
-describe("errors", () => {
- test("syntax errors", () => {
- expect("({ foo: function() { super.bar; } })").not.toEval();
- expect("({ get ...foo })").not.toEval();
- expect("({ get... foo })").not.toEval();
- expect("({ get foo })").not.toEval();
- expect("({ get foo: bar })").not.toEval();
- expect("({ get [foo]: bar })").not.toEval();
- expect("({ get ...[foo] })").not.toEval();
- expect("({ get foo(bar) {} })").not.toEval();
- expect("({ set foo() {} })").not.toEval();
- expect("({ set foo(...bar) {} })").not.toEval();
- expect("({ set foo(bar, baz) {} })").not.toEval();
- expect("({ ...foo: bar })").not.toEval();
- });
-});
diff --git a/Libraries/LibJS/Tests/object-expression-computed-property.js b/Libraries/LibJS/Tests/object-expression-computed-property.js
deleted file mode 100644
index 7fa579d21e..0000000000
--- a/Libraries/LibJS/Tests/object-expression-computed-property.js
+++ /dev/null
@@ -1,12 +0,0 @@
-test("Issue #3712, negative/non-int computed property in object expression", () => {
- const o = {
- [1.23]: "foo",
- [-1]: "foo",
- [NaN]: "foo",
- [Infinity]: "foo",
- };
- expect(o[1.23]).toBe("foo");
- expect(o[-1]).toBe("foo");
- expect(o[NaN]).toBe("foo");
- expect(o[Infinity]).toBe("foo");
-});
diff --git a/Libraries/LibJS/Tests/object-getter-setter-shorthand.js b/Libraries/LibJS/Tests/object-getter-setter-shorthand.js
deleted file mode 100644
index 02b513800b..0000000000
--- a/Libraries/LibJS/Tests/object-getter-setter-shorthand.js
+++ /dev/null
@@ -1,62 +0,0 @@
-test("normal methods named get and set", () => {
- let o = {
- get() {
- return 5;
- },
- set() {
- return 10;
- },
- };
- expect(o.get()).toBe(5);
- expect(o.set()).toBe(10);
-});
-
-test("basic get and set", () => {
- let o = {
- get x() {
- return 5;
- },
- set x(_) {},
- };
- expect(o.x).toBe(5);
- o.x = 10;
- expect(o.x).toBe(5);
-});
-
-test("get and set with 'this'", () => {
- let o = {
- get x() {
- return this._x + 1;
- },
- set x(value) {
- this._x = value + 1;
- },
- };
-
- expect(o.x).toBeNaN();
- o.x = 10;
- expect(o.x).toBe(12);
- o.x = 20;
- expect(o.x).toBe(22);
-});
-
-test("multiple getters", () => {
- let o = {
- get x() {
- return 5;
- },
- get x() {
- return 10;
- },
- };
- expect(o.x).toBe(10);
-});
-
-test("setter return value", () => {
- o = {
- set x(value) {
- return 10;
- },
- };
- expect((o.x = 20)).toBe(20);
-});
diff --git a/Libraries/LibJS/Tests/object-method-shorthand.js b/Libraries/LibJS/Tests/object-method-shorthand.js
deleted file mode 100644
index 8d8dfd512f..0000000000
--- a/Libraries/LibJS/Tests/object-method-shorthand.js
+++ /dev/null
@@ -1,50 +0,0 @@
-test("basic method shorthand", () => {
- const o = {
- foo: "bar",
- getFoo() {
- return this.foo;
- },
- };
- expect(o.getFoo()).toBe("bar");
-});
-
-test("numeric literal method shorthand", () => {
- const o = {
- foo: "bar",
- 12() {
- return this.foo;
- },
- };
- expect(o[12]()).toBe("bar");
-});
-
-test("string literal method shorthand", () => {
- const o = {
- foo: "bar",
- "hello friends"() {
- return this.foo;
- },
- };
- expect(o["hello friends"]()).toBe("bar");
-});
-
-test("computed property method shorthand", () => {
- const o = {
- foo: "bar",
- [4 + 10]() {
- return this.foo;
- },
- };
- expect(o[14]()).toBe("bar");
-});
-
-test("symbol computed property shorthand", () => {
- const s = Symbol("foo");
- const o = {
- foo: "bar",
- [s]() {
- return this.foo;
- },
- };
- expect(o[s]()).toBe("bar");
-});
diff --git a/Libraries/LibJS/Tests/object-spread.js b/Libraries/LibJS/Tests/object-spread.js
deleted file mode 100644
index 93008a8352..0000000000
--- a/Libraries/LibJS/Tests/object-spread.js
+++ /dev/null
@@ -1,117 +0,0 @@
-const testObjSpread = obj => {
- expect(obj).toEqual({
- foo: 0,
- bar: 1,
- baz: 2,
- qux: 3,
- });
-};
-
-const testObjStrSpread = obj => {
- expect(obj).toEqual(["a", "b", "c", "d"]);
-};
-
-test("spread object literal inside object literal", () => {
- const obj = {
- foo: 0,
- ...{ bar: 1, baz: 2 },
- qux: 3,
- };
- testObjSpread(obj);
-});
-
-test("spread object with assigned property inside object literal", () => {
- const obj = { foo: 0, bar: 1, baz: 2 };
- obj.qux = 3;
- testObjSpread({ ...obj });
-});
-
-test("spread object inside object literal", () => {
- let a = { bar: 1, baz: 2 };
- const obj = { foo: 0, ...a, qux: 3 };
- testObjSpread(obj);
-});
-
-test("complex nested object spreading", () => {
- const obj = {
- ...{},
- ...{
- ...{ foo: 0, bar: 1, baz: 2 },
- },
- qux: 3,
- };
- testObjSpread(obj);
-});
-
-test("spread string in object literal", () => {
- const obj = { ..."abcd" };
- testObjStrSpread(obj);
-});
-
-test("spread array in object literal", () => {
- const obj = { ...["a", "b", "c", "d"] };
- testObjStrSpread(obj);
-});
-
-test("spread array with holes in object literal", () => {
- const obj = { ...[, , "a", , , , "b", "c", , "d", , ,] };
- expect(obj).toEqual({ 2: "a", 6: "b", 7: "c", 9: "d" });
-});
-
-test("spread string object in object literal", () => {
- const obj = { ...String("abcd") };
- testObjStrSpread(obj);
-});
-
-test("spread object with non-enumerable property", () => {
- const a = { foo: 0 };
- Object.defineProperty(a, "bar", {
- value: 1,
- enumerable: false,
- });
- const obj = { ...a };
- expect(obj.foo).toBe(0);
- expect(obj).not.toHaveProperty("bar");
-});
-
-test("spread object with symbol keys", () => {
- const s = Symbol("baz");
- const a = {
- foo: "bar",
- [s]: "qux",
- };
- const obj = { ...a };
- expect(obj.foo).toBe("bar");
- expect(obj[s]).toBe("qux");
-});
-
-test("spreading non-spreadable values", () => {
- let empty = {
- ...undefined,
- ...null,
- ...1,
- ...true,
- ...function () {},
- ...Date,
- };
- expect(Object.getOwnPropertyNames(empty)).toHaveLength(0);
-});
-
-test("respects custom Symbol.iterator method", () => {
- let o = {
- [Symbol.iterator]() {
- return {
- i: 0,
- next() {
- if (this.i++ == 3) {
- return { done: true };
- }
- return { value: this.i, done: false };
- },
- };
- },
- };
-
- let a = [...o];
- expect(a).toEqual([1, 2, 3]);
-});
diff --git a/Libraries/LibJS/Tests/operators/assignment-operators.js b/Libraries/LibJS/Tests/operators/assignment-operators.js
deleted file mode 100644
index 3ab2d01a5b..0000000000
--- a/Libraries/LibJS/Tests/operators/assignment-operators.js
+++ /dev/null
@@ -1,135 +0,0 @@
-let x, o;
-
-test("basic functionality", () => {
- x = 1;
- expect((x = 2)).toBe(2);
- expect(x).toBe(2);
-
- x = 1;
- expect((x += 2)).toBe(3);
- expect(x).toBe(3);
-
- x = 3;
- expect((x -= 2)).toBe(1);
- expect(x).toBe(1);
-
- x = 3;
- expect((x *= 2)).toBe(6);
- expect(x).toBe(6);
-
- x = 6;
- expect((x /= 2)).toBe(3);
- expect(x).toBe(3);
-
- x = 6;
- expect((x %= 4)).toBe(2);
- expect(x).toBe(2);
-
- x = 2;
- expect((x **= 3)).toBe(8);
- expect(x).toBe(8);
-
- x = 3;
- expect((x &= 2)).toBe(2);
- expect(x).toBe(2);
-
- x = 3;
- expect((x |= 4)).toBe(7);
- expect(x).toBe(7);
-
- x = 6;
- expect((x ^= 2)).toBe(4);
- expect(x).toBe(4);
-
- x = 2;
- expect((x <<= 2)).toBe(8);
- expect(x).toBe(8);
-
- x = 8;
- expect((x >>= 2)).toBe(2);
- expect(x).toBe(2);
-
- x = -(2 ** 32 - 10);
- expect((x >>>= 2)).toBe(2);
- expect(x).toBe(2);
-});
-
-test("logical assignment operators", () => {
- // short circuiting evaluation
- x = false;
- expect((x &&= expect.fail())).toBeFalse();
-
- x = true;
- expect((x ||= expect.fail())).toBeTrue();
-
- x = "foo";
- expect((x ??= expect.fail())).toBe("foo");
-
- const prepareObject = (shortCircuitValue, assignmentValue) => ({
- get shortCircuit() {
- return shortCircuitValue;
- },
- set shortCircuit(_) {
- // assignment will short circuit in all test cases
- // so its setter must never be called
- expect().fail();
- },
- assignment: assignmentValue,
- });
-
- o = prepareObject(false, true);
- expect((o.shortCircuit &&= "foo")).toBeFalse();
- expect(o.shortCircuit).toBeFalse();
- expect((o.assignment &&= "bar")).toBe("bar");
- expect(o.assignment).toBe("bar");
-
- o = prepareObject(true, false);
- expect((o.shortCircuit ||= "foo")).toBeTrue();
- expect(o.shortCircuit).toBeTrue();
- expect((o.assignment ||= "bar")).toBe("bar");
- expect(o.assignment).toBe("bar");
-
- o = prepareObject("test", null);
- expect((o.shortCircuit ??= "foo")).toBe("test");
- expect(o.shortCircuit).toBe("test");
- expect((o.assignment ??= "bar")).toBe("bar");
- expect(o.assignment).toBe("bar");
-});
-
-test("evaluation order", () => {
- for (const op of [
- "=",
- "+=",
- "-=",
- "*=",
- "/=",
- "%=",
- "**=",
- "&=",
- "|=",
- "^=",
- "<<=",
- ">>=",
- ">>>=",
- "&&=",
- "||=",
- "??=",
- ]) {
- var a = [];
- function b() {
- b.hasBeenCalled = true;
- throw Error();
- }
- function c() {
- c.hasBeenCalled = true;
- throw Error();
- }
- b.hasBeenCalled = false;
- c.hasBeenCalled = false;
- expect(() => {
- new Function(`a[b()] ${op} c()`)();
- }).toThrow(Error);
- expect(b.hasBeenCalled).toBeTrue();
- expect(c.hasBeenCalled).toBeFalse();
- }
-});
diff --git a/Libraries/LibJS/Tests/operators/binary-bitwise-and.js b/Libraries/LibJS/Tests/operators/binary-bitwise-and.js
deleted file mode 100644
index 5eb4f19cc3..0000000000
--- a/Libraries/LibJS/Tests/operators/binary-bitwise-and.js
+++ /dev/null
@@ -1,60 +0,0 @@
-test("basic numeric and", () => {
- expect(0 & 0).toBe(0);
- expect(0 & 1).toBe(0);
- expect(0 & 2).toBe(0);
- expect(0 & 3).toBe(0);
- expect(0 & 4).toBe(0);
- expect(0 & 5).toBe(0);
-
- expect(1 & 0).toBe(0);
- expect(1 & 1).toBe(1);
- expect(1 & 2).toBe(0);
- expect(1 & 3).toBe(1);
- expect(1 & 4).toBe(0);
- expect(1 & 5).toBe(1);
-
- expect(2 & 0).toBe(0);
- expect(2 & 1).toBe(0);
- expect(2 & 2).toBe(2);
- expect(2 & 3).toBe(2);
- expect(2 & 4).toBe(0);
- expect(2 & 5).toBe(0);
-
- expect(3 & 0).toBe(0);
- expect(3 & 1).toBe(1);
- expect(3 & 2).toBe(2);
- expect(3 & 3).toBe(3);
- expect(3 & 4).toBe(0);
- expect(3 & 5).toBe(1);
-
- expect(4 & 0).toBe(0);
- expect(4 & 1).toBe(0);
- expect(4 & 2).toBe(0);
- expect(4 & 3).toBe(0);
- expect(4 & 4).toBe(4);
- expect(4 & 5).toBe(4);
-
- expect(5 & 0).toBe(0);
- expect(5 & 1).toBe(1);
- expect(5 & 2).toBe(0);
- expect(5 & 3).toBe(1);
- expect(5 & 4).toBe(4);
- expect(5 & 5).toBe(5);
-});
-
-test("and with non-numeric values", () => {
- let x = 3;
- let y = 7;
-
- expect("42" & 6).toBe(2);
- expect(x & y).toBe(3);
- expect(x & [[[[13]]]]).toBe(1);
- expect(undefined & y).toBe(0);
- expect("a" & "b").toBe(0);
- expect(null & null).toBe(0);
- expect(undefined & undefined).toBe(0);
- expect(NaN & NaN).toBe(0);
- expect(NaN & 6).toBe(0);
- expect(Infinity & Infinity).toBe(0);
- expect(-Infinity & Infinity).toBe(0);
-});
diff --git a/Libraries/LibJS/Tests/operators/binary-bitwise-left-shift.js b/Libraries/LibJS/Tests/operators/binary-bitwise-left-shift.js
deleted file mode 100644
index d0c9d8d5f9..0000000000
--- a/Libraries/LibJS/Tests/operators/binary-bitwise-left-shift.js
+++ /dev/null
@@ -1,60 +0,0 @@
-test("basic numeric shifting", () => {
- expect(0 << 0).toBe(0);
- expect(0 << 1).toBe(0);
- expect(0 << 2).toBe(0);
- expect(0 << 3).toBe(0);
- expect(0 << 4).toBe(0);
- expect(0 << 5).toBe(0);
-
- expect(1 << 0).toBe(1);
- expect(1 << 1).toBe(2);
- expect(1 << 2).toBe(4);
- expect(1 << 3).toBe(8);
- expect(1 << 4).toBe(16);
- expect(1 << 5).toBe(32);
-
- expect(2 << 0).toBe(2);
- expect(2 << 1).toBe(4);
- expect(2 << 2).toBe(8);
- expect(2 << 3).toBe(16);
- expect(2 << 4).toBe(32);
- expect(2 << 5).toBe(64);
-
- expect(3 << 0).toBe(3);
- expect(3 << 1).toBe(6);
- expect(3 << 2).toBe(12);
- expect(3 << 3).toBe(24);
- expect(3 << 4).toBe(48);
- expect(3 << 5).toBe(96);
-
- expect(4 << 0).toBe(4);
- expect(4 << 1).toBe(8);
- expect(4 << 2).toBe(16);
- expect(4 << 3).toBe(32);
- expect(4 << 4).toBe(64);
- expect(4 << 5).toBe(128);
-
- expect(5 << 0).toBe(5);
- expect(5 << 1).toBe(10);
- expect(5 << 2).toBe(20);
- expect(5 << 3).toBe(40);
- expect(5 << 4).toBe(80);
- expect(5 << 5).toBe(160);
-});
-
-test("shifting with non-numeric values", () => {
- let x = 3;
- let y = 7;
-
- expect("42" << 6).toBe(2688);
- expect(x << y).toBe(384);
- expect(x << [[[[12]]]]).toBe(12288);
- expect(undefined << y).toBe(0);
- expect("a" << "b").toBe(0);
- expect(null << null).toBe(0);
- expect(undefined << undefined).toBe(0);
- expect(NaN << NaN).toBe(0);
- expect(NaN << 6).toBe(0);
- expect(Infinity << Infinity).toBe(0);
- expect(-Infinity << Infinity).toBe(0);
-});
diff --git a/Libraries/LibJS/Tests/operators/binary-bitwise-or.js b/Libraries/LibJS/Tests/operators/binary-bitwise-or.js
deleted file mode 100644
index 485d1226d2..0000000000
--- a/Libraries/LibJS/Tests/operators/binary-bitwise-or.js
+++ /dev/null
@@ -1,60 +0,0 @@
-test("basic numeric or", () => {
- expect(0 | 0).toBe(0);
- expect(0 | 1).toBe(1);
- expect(0 | 2).toBe(2);
- expect(0 | 3).toBe(3);
- expect(0 | 4).toBe(4);
- expect(0 | 5).toBe(5);
-
- expect(1 | 0).toBe(1);
- expect(1 | 1).toBe(1);
- expect(1 | 2).toBe(3);
- expect(1 | 3).toBe(3);
- expect(1 | 4).toBe(5);
- expect(1 | 5).toBe(5);
-
- expect(2 | 0).toBe(2);
- expect(2 | 1).toBe(3);
- expect(2 | 2).toBe(2);
- expect(2 | 3).toBe(3);
- expect(2 | 4).toBe(6);
- expect(2 | 5).toBe(7);
-
- expect(3 | 0).toBe(3);
- expect(3 | 1).toBe(3);
- expect(3 | 2).toBe(3);
- expect(3 | 3).toBe(3);
- expect(3 | 4).toBe(7);
- expect(3 | 5).toBe(7);
-
- expect(4 | 0).toBe(4);
- expect(4 | 1).toBe(5);
- expect(4 | 2).toBe(6);
- expect(4 | 3).toBe(7);
- expect(4 | 4).toBe(4);
- expect(4 | 5).toBe(5);
-
- expect(5 | 0).toBe(5);
- expect(5 | 1).toBe(5);
- expect(5 | 2).toBe(7);
- expect(5 | 3).toBe(7);
- expect(5 | 4).toBe(5);
- expect(5 | 5).toBe(5);
-});
-
-test("or with non-numeric values", () => {
- let x = 3;
- let y = 7;
-
- expect("42" | 6).toBe(46);
- expect(x | y).toBe(7);
- expect(x | [[[[12]]]]).toBe(15);
- expect(undefined | y).toBe(7);
- expect("a" | "b").toBe(0);
- expect(null | null).toBe(0);
- expect(undefined | undefined).toBe(0);
- expect(NaN | NaN).toBe(0);
- expect(NaN | 6).toBe(6);
- expect(Infinity | Infinity).toBe(0);
- expect(-Infinity | Infinity).toBe(0);
-});
diff --git a/Libraries/LibJS/Tests/operators/binary-bitwise-right-shift.js b/Libraries/LibJS/Tests/operators/binary-bitwise-right-shift.js
deleted file mode 100644
index f071c5da92..0000000000
--- a/Libraries/LibJS/Tests/operators/binary-bitwise-right-shift.js
+++ /dev/null
@@ -1,62 +0,0 @@
-test("basic numeric shifting", () => {
- expect(0 >> 0).toBe(0);
- expect(0 >> 1).toBe(0);
- expect(0 >> 2).toBe(0);
- expect(0 >> 3).toBe(0);
- expect(0 >> 4).toBe(0);
- expect(0 >> 5).toBe(0);
-
- expect(1 >> 0).toBe(1);
- expect(1 >> 1).toBe(0);
- expect(1 >> 2).toBe(0);
- expect(1 >> 3).toBe(0);
- expect(1 >> 4).toBe(0);
- expect(1 >> 5).toBe(0);
-
- expect(5 >> 0).toBe(5);
- expect(5 >> 1).toBe(2);
- expect(5 >> 2).toBe(1);
- expect(5 >> 3).toBe(0);
- expect(5 >> 4).toBe(0);
- expect(5 >> 5).toBe(0);
-
- expect(42 >> 0).toBe(42);
- expect(42 >> 1).toBe(21);
- expect(42 >> 2).toBe(10);
- expect(42 >> 3).toBe(5);
- expect(42 >> 4).toBe(2);
- expect(42 >> 5).toBe(1);
-});
-
-test("numeric shifting with negative lhs values", () => {
- expect(-1 >> 0).toBe(-1);
- expect(-1 >> 1).toBe(-1);
- expect(-1 >> 2).toBe(-1);
- expect(-1 >> 3).toBe(-1);
- expect(-1 >> 4).toBe(-1);
- expect(-1 >> 5).toBe(-1);
-
- expect(-5 >> 0).toBe(-5);
- expect(-5 >> 1).toBe(-3);
- expect(-5 >> 2).toBe(-2);
- expect(-5 >> 3).toBe(-1);
- expect(-5 >> 4).toBe(-1);
- expect(-5 >> 5).toBe(-1);
-});
-
-test("shifting with non-numeric values", () => {
- let x = 67;
- let y = 4;
-
- expect("42" >> 3).toBe(5);
- expect(x >> y).toBe(4);
- expect(x >> [[[[5]]]]).toBe(2);
- expect(undefined >> y).toBe(0);
- expect("a" >> "b").toBe(0);
- expect(null >> null).toBe(0);
- expect(undefined >> undefined).toBe(0);
- expect(NaN >> NaN).toBe(0);
- expect(6 >> NaN).toBe(6);
- expect(Infinity >> Infinity).toBe(0);
- expect(-Infinity >> Infinity).toBe(0);
-});
diff --git a/Libraries/LibJS/Tests/operators/binary-bitwise-unsigned-right-shift.js b/Libraries/LibJS/Tests/operators/binary-bitwise-unsigned-right-shift.js
deleted file mode 100644
index 4a950e18ef..0000000000
--- a/Libraries/LibJS/Tests/operators/binary-bitwise-unsigned-right-shift.js
+++ /dev/null
@@ -1,62 +0,0 @@
-test("basic numeric shifting", () => {
- expect(0 >>> 0).toBe(0);
- expect(0 >>> 1).toBe(0);
- expect(0 >>> 2).toBe(0);
- expect(0 >>> 3).toBe(0);
- expect(0 >>> 4).toBe(0);
- expect(0 >>> 5).toBe(0);
-
- expect(1 >>> 0).toBe(1);
- expect(1 >>> 1).toBe(0);
- expect(1 >>> 2).toBe(0);
- expect(1 >>> 3).toBe(0);
- expect(1 >>> 4).toBe(0);
- expect(1 >>> 5).toBe(0);
-
- expect(5 >>> 0).toBe(5);
- expect(5 >>> 1).toBe(2);
- expect(5 >>> 2).toBe(1);
- expect(5 >>> 3).toBe(0);
- expect(5 >>> 4).toBe(0);
- expect(5 >>> 5).toBe(0);
-
- expect(42 >>> 0).toBe(42);
- expect(42 >>> 1).toBe(21);
- expect(42 >>> 2).toBe(10);
- expect(42 >>> 3).toBe(5);
- expect(42 >>> 4).toBe(2);
- expect(42 >>> 5).toBe(1);
-});
-
-test("numeric shifting with negative lhs values", () => {
- expect(-1 >>> 0).toBe(4294967295);
- expect(-1 >>> 1).toBe(2147483647);
- expect(-1 >>> 2).toBe(1073741823);
- expect(-1 >>> 3).toBe(536870911);
- expect(-1 >>> 4).toBe(268435455);
- expect(-1 >>> 5).toBe(134217727);
-
- expect(-5 >>> 0).toBe(4294967291);
- expect(-5 >>> 1).toBe(2147483645);
- expect(-5 >>> 2).toBe(1073741822);
- expect(-5 >>> 3).toBe(536870911);
- expect(-5 >>> 4).toBe(268435455);
- expect(-5 >>> 5).toBe(134217727);
-});
-
-test("shifting with non-numeric values", () => {
- let x = -67;
- let y = 4;
-
- expect("-42" >>> 3).toBe(536870906);
- expect(x >>> y).toBe(268435451);
- expect(x >>> [[[[5]]]]).toBe(134217725);
- expect(undefined >>> y).toBe(0);
- expect("a" >>> "b").toBe(0);
- expect(null >>> null).toBe(0);
- expect(undefined >>> undefined).toBe(0);
- expect(NaN >>> NaN).toBe(0);
- expect(6 >>> NaN).toBe(6);
- expect(Infinity >>> Infinity).toBe(0);
- expect(-Infinity >>> Infinity).toBe(0);
-});
diff --git a/Libraries/LibJS/Tests/operators/binary-bitwise-xor.js b/Libraries/LibJS/Tests/operators/binary-bitwise-xor.js
deleted file mode 100644
index 356ad01ca4..0000000000
--- a/Libraries/LibJS/Tests/operators/binary-bitwise-xor.js
+++ /dev/null
@@ -1,60 +0,0 @@
-test("basic numeric xor", () => {
- expect(0 ^ 0).toBe(0);
- expect(0 ^ 1).toBe(1);
- expect(0 ^ 2).toBe(2);
- expect(0 ^ 3).toBe(3);
- expect(0 ^ 4).toBe(4);
- expect(0 ^ 5).toBe(5);
-
- expect(1 ^ 0).toBe(1);
- expect(1 ^ 1).toBe(0);
- expect(1 ^ 2).toBe(3);
- expect(1 ^ 3).toBe(2);
- expect(1 ^ 4).toBe(5);
- expect(1 ^ 5).toBe(4);
-
- expect(2 ^ 0).toBe(2);
- expect(2 ^ 1).toBe(3);
- expect(2 ^ 2).toBe(0);
- expect(2 ^ 3).toBe(1);
- expect(2 ^ 4).toBe(6);
- expect(2 ^ 5).toBe(7);
-
- expect(3 ^ 0).toBe(3);
- expect(3 ^ 1).toBe(2);
- expect(3 ^ 2).toBe(1);
- expect(3 ^ 3).toBe(0);
- expect(3 ^ 4).toBe(7);
- expect(3 ^ 5).toBe(6);
-
- expect(4 ^ 0).toBe(4);
- expect(4 ^ 1).toBe(5);
- expect(4 ^ 2).toBe(6);
- expect(4 ^ 3).toBe(7);
- expect(4 ^ 4).toBe(0);
- expect(4 ^ 5).toBe(1);
-
- expect(5 ^ 0).toBe(5);
- expect(5 ^ 1).toBe(4);
- expect(5 ^ 2).toBe(7);
- expect(5 ^ 3).toBe(6);
- expect(5 ^ 4).toBe(1);
- expect(5 ^ 5).toBe(0);
-});
-
-test("xor with non-numeric values", () => {
- let x = 3;
- let y = 7;
-
- expect("42" ^ 6).toBe(44);
- expect(x ^ y).toBe(4);
- expect(x ^ [[[[12]]]]).toBe(15);
- expect(undefined ^ y).toBe(7);
- expect("a" ^ "b").toBe(0);
- expect(null ^ null).toBe(0);
- expect(undefined ^ undefined).toBe(0);
- expect(NaN ^ NaN).toBe(0);
- expect(NaN ^ 6).toBe(6);
- expect(Infinity ^ Infinity).toBe(0);
- expect(-Infinity ^ Infinity).toBe(0);
-});
diff --git a/Libraries/LibJS/Tests/operators/binary-relational.js b/Libraries/LibJS/Tests/operators/binary-relational.js
deleted file mode 100644
index 307f7164e4..0000000000
--- a/Libraries/LibJS/Tests/operators/binary-relational.js
+++ /dev/null
@@ -1,729 +0,0 @@
-test("basic functionality", () => {
- const vals = [
- 1,
- 2,
- 1.23,
- 2.34567,
- 1n,
- 2n,
- [],
- [1],
- [2],
- [1, 2],
- "foo",
- "fooo",
- "🔥",
- "❤️",
- "bar",
- {},
- { a: 1 },
- { a: 2 },
- { b: 1 },
- true,
- false,
- undefined,
- null,
- NaN,
- +Infinity,
- -Infinity,
- ];
-
- // Each row contains: xIndex, yIndex, (x < y), (x > y), (x <= y), (x >= y)
- // where x = vals[xIndex], y = vals[yIndex]
- // Table can be generated using a mature engine and the following code:
- // for (var xIndex = 0; xIndex < vals.length; ++xIndex) {
- // for (var yIndex = 0; yIndex < vals.length; ++yIndex) {
- // var x = vals[xIndex];
- // var y = vals[yIndex];
- // console.log(`[${xIndex}, ${yIndex}, ${x < y}, ${x > y}, ${x <= y}, ${x >= y}]`);
- // }
- // }
- const table = [
- [0, 0, false, false, true, true],
- [0, 1, true, false, true, false],
- [0, 2, true, false, true, false],
- [0, 3, true, false, true, false],
- [0, 4, false, false, true, true],
- [0, 5, true, false, true, false],
- [0, 6, false, true, false, true],
- [0, 7, false, false, true, true],
- [0, 8, true, false, true, false],
- [0, 9, false, false, false, false],
- [0, 10, false, false, false, false],
- [0, 11, false, false, false, false],
- [0, 12, false, false, false, false],
- [0, 13, false, false, false, false],
- [0, 14, false, false, false, false],
- [0, 15, false, false, false, false],
- [0, 16, false, false, false, false],
- [0, 17, false, false, false, false],
- [0, 18, false, false, false, false],
- [0, 19, false, false, true, true],
- [0, 20, false, true, false, true],
- [0, 21, false, false, false, false],
- [0, 22, false, true, false, true],
- [0, 23, false, false, false, false],
- [0, 24, true, false, true, false],
- [0, 25, false, true, false, true],
- [1, 0, false, true, false, true],
- [1, 1, false, false, true, true],
- [1, 2, false, true, false, true],
- [1, 3, true, false, true, false],
- [1, 4, false, true, false, true],
- [1, 5, false, false, true, true],
- [1, 6, false, true, false, true],
- [1, 7, false, true, false, true],
- [1, 8, false, false, true, true],
- [1, 9, false, false, false, false],
- [1, 10, false, false, false, false],
- [1, 11, false, false, false, false],
- [1, 12, false, false, false, false],
- [1, 13, false, false, false, false],
- [1, 14, false, false, false, false],
- [1, 15, false, false, false, false],
- [1, 16, false, false, false, false],
- [1, 17, false, false, false, false],
- [1, 18, false, false, false, false],
- [1, 19, false, true, false, true],
- [1, 20, false, true, false, true],
- [1, 21, false, false, false, false],
- [1, 22, false, true, false, true],
- [1, 23, false, false, false, false],
- [1, 24, true, false, true, false],
- [1, 25, false, true, false, true],
- [2, 0, false, true, false, true],
- [2, 1, true, false, true, false],
- [2, 2, false, false, true, true],
- [2, 3, true, false, true, false],
- [2, 4, false, true, false, true],
- [2, 5, true, false, true, false],
- [2, 6, false, true, false, true],
- [2, 7, false, true, false, true],
- [2, 8, true, false, true, false],
- [2, 9, false, false, false, false],
- [2, 10, false, false, false, false],
- [2, 11, false, false, false, false],
- [2, 12, false, false, false, false],
- [2, 13, false, false, false, false],
- [2, 14, false, false, false, false],
- [2, 15, false, false, false, false],
- [2, 16, false, false, false, false],
- [2, 17, false, false, false, false],
- [2, 18, false, false, false, false],
- [2, 19, false, true, false, true],
- [2, 20, false, true, false, true],
- [2, 21, false, false, false, false],
- [2, 22, false, true, false, true],
- [2, 23, false, false, false, false],
- [2, 24, true, false, true, false],
- [2, 25, false, true, false, true],
- [3, 0, false, true, false, true],
- [3, 1, false, true, false, true],
- [3, 2, false, true, false, true],
- [3, 3, false, false, true, true],
- [3, 4, false, true, false, true],
- [3, 5, false, true, false, true],
- [3, 6, false, true, false, true],
- [3, 7, false, true, false, true],
- [3, 8, false, true, false, true],
- [3, 9, false, false, false, false],
- [3, 10, false, false, false, false],
- [3, 11, false, false, false, false],
- [3, 12, false, false, false, false],
- [3, 13, false, false, false, false],
- [3, 14, false, false, false, false],
- [3, 15, false, false, false, false],
- [3, 16, false, false, false, false],
- [3, 17, false, false, false, false],
- [3, 18, false, false, false, false],
- [3, 19, false, true, false, true],
- [3, 20, false, true, false, true],
- [3, 21, false, false, false, false],
- [3, 22, false, true, false, true],
- [3, 23, false, false, false, false],
- [3, 24, true, false, true, false],
- [3, 25, false, true, false, true],
- [4, 0, false, false, true, true],
- [4, 1, true, false, true, false],
- [4, 2, true, false, true, false],
- [4, 3, true, false, true, false],
- [4, 4, false, false, true, true],
- [4, 5, true, false, true, false],
- [4, 6, false, true, false, true],
- [4, 7, false, false, true, true],
- [4, 8, true, false, true, false],
- [4, 9, false, false, false, false],
- [4, 10, false, false, false, false],
- [4, 11, false, false, false, false],
- [4, 12, false, false, false, false],
- [4, 13, false, false, false, false],
- [4, 14, false, false, false, false],
- [4, 15, false, false, false, false],
- [4, 16, false, false, false, false],
- [4, 17, false, false, false, false],
- [4, 18, false, false, false, false],
- [4, 19, false, false, true, true],
- [4, 20, false, true, false, true],
- [4, 21, false, false, false, false],
- [4, 22, false, true, false, true],
- [4, 23, false, false, false, false],
- [4, 24, true, false, true, false],
- [4, 25, false, true, false, true],
- [5, 0, false, true, false, true],
- [5, 1, false, false, true, true],
- [5, 2, false, true, false, true],
- [5, 3, true, false, true, false],
- [5, 4, false, true, false, true],
- [5, 5, false, false, true, true],
- [5, 6, false, true, false, true],
- [5, 7, false, true, false, true],
- [5, 8, false, false, true, true],
- [5, 9, false, false, false, false],
- [5, 10, false, false, false, false],
- [5, 11, false, false, false, false],
- [5, 12, false, false, false, false],
- [5, 13, false, false, false, false],
- [5, 14, false, false, false, false],
- [5, 15, false, false, false, false],
- [5, 16, false, false, false, false],
- [5, 17, false, false, false, false],
- [5, 18, false, false, false, false],
- [5, 19, false, true, false, true],
- [5, 20, false, true, false, true],
- [5, 21, false, false, false, false],
- [5, 22, false, true, false, true],
- [5, 23, false, false, false, false],
- [5, 24, true, false, true, false],
- [5, 25, false, true, false, true],
- [6, 0, true, false, true, false],
- [6, 1, true, false, true, false],
- [6, 2, true, false, true, false],
- [6, 3, true, false, true, false],
- [6, 4, true, false, true, false],
- [6, 5, true, false, true, false],
- [6, 6, false, false, true, true],
- [6, 7, true, false, true, false],
- [6, 8, true, false, true, false],
- [6, 9, true, false, true, false],
- [6, 10, true, false, true, false],
- [6, 11, true, false, true, false],
- [6, 12, true, false, true, false],
- [6, 13, true, false, true, false],
- [6, 14, true, false, true, false],
- [6, 15, true, false, true, false],
- [6, 16, true, false, true, false],
- [6, 17, true, false, true, false],
- [6, 18, true, false, true, false],
- [6, 19, true, false, true, false],
- [6, 20, false, false, true, true],
- [6, 21, false, false, false, false],
- [6, 22, false, false, true, true],
- [6, 23, false, false, false, false],
- [6, 24, true, false, true, false],
- [6, 25, false, true, false, true],
- [7, 0, false, false, true, true],
- [7, 1, true, false, true, false],
- [7, 2, true, false, true, false],
- [7, 3, true, false, true, false],
- [7, 4, false, false, true, true],
- [7, 5, true, false, true, false],
- [7, 6, false, true, false, true],
- [7, 7, false, false, true, true],
- [7, 8, true, false, true, false],
- [7, 9, true, false, true, false],
- [7, 10, true, false, true, false],
- [7, 11, true, false, true, false],
- [7, 12, true, false, true, false],
- [7, 13, true, false, true, false],
- [7, 14, true, false, true, false],
- [7, 15, true, false, true, false],
- [7, 16, true, false, true, false],
- [7, 17, true, false, true, false],
- [7, 18, true, false, true, false],
- [7, 19, false, false, true, true],
- [7, 20, false, true, false, true],
- [7, 21, false, false, false, false],
- [7, 22, false, true, false, true],
- [7, 23, false, false, false, false],
- [7, 24, true, false, true, false],
- [7, 25, false, true, false, true],
- [8, 0, false, true, false, true],
- [8, 1, false, false, true, true],
- [8, 2, false, true, false, true],
- [8, 3, true, false, true, false],
- [8, 4, false, true, false, true],
- [8, 5, false, false, true, true],
- [8, 6, false, true, false, true],
- [8, 7, false, true, false, true],
- [8, 8, false, false, true, true],
- [8, 9, false, true, false, true],
- [8, 10, true, false, true, false],
- [8, 11, true, false, true, false],
- [8, 12, true, false, true, false],
- [8, 13, true, false, true, false],
- [8, 14, true, false, true, false],
- [8, 15, true, false, true, false],
- [8, 16, true, false, true, false],
- [8, 17, true, false, true, false],
- [8, 18, true, false, true, false],
- [8, 19, false, true, false, true],
- [8, 20, false, true, false, true],
- [8, 21, false, false, false, false],
- [8, 22, false, true, false, true],
- [8, 23, false, false, false, false],
- [8, 24, true, false, true, false],
- [8, 25, false, true, false, true],
- [9, 0, false, false, false, false],
- [9, 1, false, false, false, false],
- [9, 2, false, false, false, false],
- [9, 3, false, false, false, false],
- [9, 4, false, false, false, false],
- [9, 5, false, false, false, false],
- [9, 6, false, true, false, true],
- [9, 7, false, true, false, true],
- [9, 8, true, false, true, false],
- [9, 9, false, false, true, true],
- [9, 10, true, false, true, false],
- [9, 11, true, false, true, false],
- [9, 12, true, false, true, false],
- [9, 13, true, false, true, false],
- [9, 14, true, false, true, false],
- [9, 15, true, false, true, false],
- [9, 16, true, false, true, false],
- [9, 17, true, false, true, false],
- [9, 18, true, false, true, false],
- [9, 19, false, false, false, false],
- [9, 20, false, false, false, false],
- [9, 21, false, false, false, false],
- [9, 22, false, false, false, false],
- [9, 23, false, false, false, false],
- [9, 24, false, false, false, false],
- [9, 25, false, false, false, false],
- [10, 0, false, false, false, false],
- [10, 1, false, false, false, false],
- [10, 2, false, false, false, false],
- [10, 3, false, false, false, false],
- [10, 4, false, false, false, false],
- [10, 5, false, false, false, false],
- [10, 6, false, true, false, true],
- [10, 7, false, true, false, true],
- [10, 8, false, true, false, true],
- [10, 9, false, true, false, true],
- [10, 10, false, false, true, true],
- [10, 11, true, false, true, false],
- [10, 12, true, false, true, false],
- [10, 13, true, false, true, false],
- [10, 14, false, true, false, true],
- [10, 15, false, true, false, true],
- [10, 16, false, true, false, true],
- [10, 17, false, true, false, true],
- [10, 18, false, true, false, true],
- [10, 19, false, false, false, false],
- [10, 20, false, false, false, false],
- [10, 21, false, false, false, false],
- [10, 22, false, false, false, false],
- [10, 23, false, false, false, false],
- [10, 24, false, false, false, false],
- [10, 25, false, false, false, false],
- [11, 0, false, false, false, false],
- [11, 1, false, false, false, false],
- [11, 2, false, false, false, false],
- [11, 3, false, false, false, false],
- [11, 4, false, false, false, false],
- [11, 5, false, false, false, false],
- [11, 6, false, true, false, true],
- [11, 7, false, true, false, true],
- [11, 8, false, true, false, true],
- [11, 9, false, true, false, true],
- [11, 10, false, true, false, true],
- [11, 11, false, false, true, true],
- [11, 12, true, false, true, false],
- [11, 13, true, false, true, false],
- [11, 14, false, true, false, true],
- [11, 15, false, true, false, true],
- [11, 16, false, true, false, true],
- [11, 17, false, true, false, true],
- [11, 18, false, true, false, true],
- [11, 19, false, false, false, false],
- [11, 20, false, false, false, false],
- [11, 21, false, false, false, false],
- [11, 22, false, false, false, false],
- [11, 23, false, false, false, false],
- [11, 24, false, false, false, false],
- [11, 25, false, false, false, false],
- [12, 0, false, false, false, false],
- [12, 1, false, false, false, false],
- [12, 2, false, false, false, false],
- [12, 3, false, false, false, false],
- [12, 4, false, false, false, false],
- [12, 5, false, false, false, false],
- [12, 6, false, true, false, true],
- [12, 7, false, true, false, true],
- [12, 8, false, true, false, true],
- [12, 9, false, true, false, true],
- [12, 10, false, true, false, true],
- [12, 11, false, true, false, true],
- [12, 12, false, false, true, true],
- [12, 13, false, true, false, true],
- [12, 14, false, true, false, true],
- [12, 15, false, true, false, true],
- [12, 16, false, true, false, true],
- [12, 17, false, true, false, true],
- [12, 18, false, true, false, true],
- [12, 19, false, false, false, false],
- [12, 20, false, false, false, false],
- [12, 21, false, false, false, false],
- [12, 22, false, false, false, false],
- [12, 23, false, false, false, false],
- [12, 24, false, false, false, false],
- [12, 25, false, false, false, false],
- [13, 0, false, false, false, false],
- [13, 1, false, false, false, false],
- [13, 2, false, false, false, false],
- [13, 3, false, false, false, false],
- [13, 4, false, false, false, false],
- [13, 5, false, false, false, false],
- [13, 6, false, true, false, true],
- [13, 7, false, true, false, true],
- [13, 8, false, true, false, true],
- [13, 9, false, true, false, true],
- [13, 10, false, true, false, true],
- [13, 11, false, true, false, true],
- [13, 12, true, false, true, false],
- [13, 13, false, false, true, true],
- [13, 14, false, true, false, true],
- [13, 15, false, true, false, true],
- [13, 16, false, true, false, true],
- [13, 17, false, true, false, true],
- [13, 18, false, true, false, true],
- [13, 19, false, false, false, false],
- [13, 20, false, false, false, false],
- [13, 21, false, false, false, false],
- [13, 22, false, false, false, false],
- [13, 23, false, false, false, false],
- [13, 24, false, false, false, false],
- [13, 25, false, false, false, false],
- [14, 0, false, false, false, false],
- [14, 1, false, false, false, false],
- [14, 2, false, false, false, false],
- [14, 3, false, false, false, false],
- [14, 4, false, false, false, false],
- [14, 5, false, false, false, false],
- [14, 6, false, true, false, true],
- [14, 7, false, true, false, true],
- [14, 8, false, true, false, true],
- [14, 9, false, true, false, true],
- [14, 10, true, false, true, false],
- [14, 11, true, false, true, false],
- [14, 12, true, false, true, false],
- [14, 13, true, false, true, false],
- [14, 14, false, false, true, true],
- [14, 15, false, true, false, true],
- [14, 16, false, true, false, true],
- [14, 17, false, true, false, true],
- [14, 18, false, true, false, true],
- [14, 19, false, false, false, false],
- [14, 20, false, false, false, false],
- [14, 21, false, false, false, false],
- [14, 22, false, false, false, false],
- [14, 23, false, false, false, false],
- [14, 24, false, false, false, false],
- [14, 25, false, false, false, false],
- [15, 0, false, false, false, false],
- [15, 1, false, false, false, false],
- [15, 2, false, false, false, false],
- [15, 3, false, false, false, false],
- [15, 4, false, false, false, false],
- [15, 5, false, false, false, false],
- [15, 6, false, true, false, true],
- [15, 7, false, true, false, true],
- [15, 8, false, true, false, true],
- [15, 9, false, true, false, true],
- [15, 10, true, false, true, false],
- [15, 11, true, false, true, false],
- [15, 12, true, false, true, false],
- [15, 13, true, false, true, false],
- [15, 14, true, false, true, false],
- [15, 15, false, false, true, true],
- [15, 16, false, false, true, true],
- [15, 17, false, false, true, true],
- [15, 18, false, false, true, true],
- [15, 19, false, false, false, false],
- [15, 20, false, false, false, false],
- [15, 21, false, false, false, false],
- [15, 22, false, false, false, false],
- [15, 23, false, false, false, false],
- [15, 24, false, false, false, false],
- [15, 25, false, false, false, false],
- [16, 0, false, false, false, false],
- [16, 1, false, false, false, false],
- [16, 2, false, false, false, false],
- [16, 3, false, false, false, false],
- [16, 4, false, false, false, false],
- [16, 5, false, false, false, false],
- [16, 6, false, true, false, true],
- [16, 7, false, true, false, true],
- [16, 8, false, true, false, true],
- [16, 9, false, true, false, true],
- [16, 10, true, false, true, false],
- [16, 11, true, false, true, false],
- [16, 12, true, false, true, false],
- [16, 13, true, false, true, false],
- [16, 14, true, false, true, false],
- [16, 15, false, false, true, true],
- [16, 16, false, false, true, true],
- [16, 17, false, false, true, true],
- [16, 18, false, false, true, true],
- [16, 19, false, false, false, false],
- [16, 20, false, false, false, false],
- [16, 21, false, false, false, false],
- [16, 22, false, false, false, false],
- [16, 23, false, false, false, false],
- [16, 24, false, false, false, false],
- [16, 25, false, false, false, false],
- [17, 0, false, false, false, false],
- [17, 1, false, false, false, false],
- [17, 2, false, false, false, false],
- [17, 3, false, false, false, false],
- [17, 4, false, false, false, false],
- [17, 5, false, false, false, false],
- [17, 6, false, true, false, true],
- [17, 7, false, true, false, true],
- [17, 8, false, true, false, true],
- [17, 9, false, true, false, true],
- [17, 10, true, false, true, false],
- [17, 11, true, false, true, false],
- [17, 12, true, false, true, false],
- [17, 13, true, false, true, false],
- [17, 14, true, false, true, false],
- [17, 15, false, false, true, true],
- [17, 16, false, false, true, true],
- [17, 17, false, false, true, true],
- [17, 18, false, false, true, true],
- [17, 19, false, false, false, false],
- [17, 20, false, false, false, false],
- [17, 21, false, false, false, false],
- [17, 22, false, false, false, false],
- [17, 23, false, false, false, false],
- [17, 24, false, false, false, false],
- [17, 25, false, false, false, false],
- [18, 0, false, false, false, false],
- [18, 1, false, false, false, false],
- [18, 2, false, false, false, false],
- [18, 3, false, false, false, false],
- [18, 4, false, false, false, false],
- [18, 5, false, false, false, false],
- [18, 6, false, true, false, true],
- [18, 7, false, true, false, true],
- [18, 8, false, true, false, true],
- [18, 9, false, true, false, true],
- [18, 10, true, false, true, false],
- [18, 11, true, false, true, false],
- [18, 12, true, false, true, false],
- [18, 13, true, false, true, false],
- [18, 14, true, false, true, false],
- [18, 15, false, false, true, true],
- [18, 16, false, false, true, true],
- [18, 17, false, false, true, true],
- [18, 18, false, false, true, true],
- [18, 19, false, false, false, false],
- [18, 20, false, false, false, false],
- [18, 21, false, false, false, false],
- [18, 22, false, false, false, false],
- [18, 23, false, false, false, false],
- [18, 24, false, false, false, false],
- [18, 25, false, false, false, false],
- [19, 0, false, false, true, true],
- [19, 1, true, false, true, false],
- [19, 2, true, false, true, false],
- [19, 3, true, false, true, false],
- [19, 4, false, false, true, true],
- [19, 5, true, false, true, false],
- [19, 6, false, true, false, true],
- [19, 7, false, false, true, true],
- [19, 8, true, false, true, false],
- [19, 9, false, false, false, false],
- [19, 10, false, false, false, false],
- [19, 11, false, false, false, false],
- [19, 12, false, false, false, false],
- [19, 13, false, false, false, false],
- [19, 14, false, false, false, false],
- [19, 15, false, false, false, false],
- [19, 16, false, false, false, false],
- [19, 17, false, false, false, false],
- [19, 18, false, false, false, false],
- [19, 19, false, false, true, true],
- [19, 20, false, true, false, true],
- [19, 21, false, false, false, false],
- [19, 22, false, true, false, true],
- [19, 23, false, false, false, false],
- [19, 24, true, false, true, false],
- [19, 25, false, true, false, true],
- [20, 0, true, false, true, false],
- [20, 1, true, false, true, false],
- [20, 2, true, false, true, false],
- [20, 3, true, false, true, false],
- [20, 4, true, false, true, false],
- [20, 5, true, false, true, false],
- [20, 6, false, false, true, true],
- [20, 7, true, false, true, false],
- [20, 8, true, false, true, false],
- [20, 9, false, false, false, false],
- [20, 10, false, false, false, false],
- [20, 11, false, false, false, false],
- [20, 12, false, false, false, false],
- [20, 13, false, false, false, false],
- [20, 14, false, false, false, false],
- [20, 15, false, false, false, false],
- [20, 16, false, false, false, false],
- [20, 17, false, false, false, false],
- [20, 18, false, false, false, false],
- [20, 19, true, false, true, false],
- [20, 20, false, false, true, true],
- [20, 21, false, false, false, false],
- [20, 22, false, false, true, true],
- [20, 23, false, false, false, false],
- [20, 24, true, false, true, false],
- [20, 25, false, true, false, true],
- [21, 0, false, false, false, false],
- [21, 1, false, false, false, false],
- [21, 2, false, false, false, false],
- [21, 3, false, false, false, false],
- [21, 4, false, false, false, false],
- [21, 5, false, false, false, false],
- [21, 6, false, false, false, false],
- [21, 7, false, false, false, false],
- [21, 8, false, false, false, false],
- [21, 9, false, false, false, false],
- [21, 10, false, false, false, false],
- [21, 11, false, false, false, false],
- [21, 12, false, false, false, false],
- [21, 13, false, false, false, false],
- [21, 14, false, false, false, false],
- [21, 15, false, false, false, false],
- [21, 16, false, false, false, false],
- [21, 17, false, false, false, false],
- [21, 18, false, false, false, false],
- [21, 19, false, false, false, false],
- [21, 20, false, false, false, false],
- [21, 21, false, false, false, false],
- [21, 22, false, false, false, false],
- [21, 23, false, false, false, false],
- [21, 24, false, false, false, false],
- [21, 25, false, false, false, false],
- [22, 0, true, false, true, false],
- [22, 1, true, false, true, false],
- [22, 2, true, false, true, false],
- [22, 3, true, false, true, false],
- [22, 4, true, false, true, false],
- [22, 5, true, false, true, false],
- [22, 6, false, false, true, true],
- [22, 7, true, false, true, false],
- [22, 8, true, false, true, false],
- [22, 9, false, false, false, false],
- [22, 10, false, false, false, false],
- [22, 11, false, false, false, false],
- [22, 12, false, false, false, false],
- [22, 13, false, false, false, false],
- [22, 14, false, false, false, false],
- [22, 15, false, false, false, false],
- [22, 16, false, false, false, false],
- [22, 17, false, false, false, false],
- [22, 18, false, false, false, false],
- [22, 19, true, false, true, false],
- [22, 20, false, false, true, true],
- [22, 21, false, false, false, false],
- [22, 22, false, false, true, true],
- [22, 23, false, false, false, false],
- [22, 24, true, false, true, false],
- [22, 25, false, true, false, true],
- [23, 0, false, false, false, false],
- [23, 1, false, false, false, false],
- [23, 2, false, false, false, false],
- [23, 3, false, false, false, false],
- [23, 4, false, false, false, false],
- [23, 5, false, false, false, false],
- [23, 6, false, false, false, false],
- [23, 7, false, false, false, false],
- [23, 8, false, false, false, false],
- [23, 9, false, false, false, false],
- [23, 10, false, false, false, false],
- [23, 11, false, false, false, false],
- [23, 12, false, false, false, false],
- [23, 13, false, false, false, false],
- [23, 14, false, false, false, false],
- [23, 15, false, false, false, false],
- [23, 16, false, false, false, false],
- [23, 17, false, false, false, false],
- [23, 18, false, false, false, false],
- [23, 19, false, false, false, false],
- [23, 20, false, false, false, false],
- [23, 21, false, false, false, false],
- [23, 22, false, false, false, false],
- [23, 23, false, false, false, false],
- [23, 24, false, false, false, false],
- [23, 25, false, false, false, false],
- [24, 0, false, true, false, true],
- [24, 1, false, true, false, true],
- [24, 2, false, true, false, true],
- [24, 3, false, true, false, true],
- [24, 4, false, true, false, true],
- [24, 5, false, true, false, true],
- [24, 6, false, true, false, true],
- [24, 7, false, true, false, true],
- [24, 8, false, true, false, true],
- [24, 9, false, false, false, false],
- [24, 10, false, false, false, false],
- [24, 11, false, false, false, false],
- [24, 12, false, false, false, false],
- [24, 13, false, false, false, false],
- [24, 14, false, false, false, false],
- [24, 15, false, false, false, false],
- [24, 16, false, false, false, false],
- [24, 17, false, false, false, false],
- [24, 18, false, false, false, false],
- [24, 19, false, true, false, true],
- [24, 20, false, true, false, true],
- [24, 21, false, false, false, false],
- [24, 22, false, true, false, true],
- [24, 23, false, false, false, false],
- [24, 24, false, false, true, true],
- [24, 25, false, true, false, true],
- [25, 0, true, false, true, false],
- [25, 1, true, false, true, false],
- [25, 2, true, false, true, false],
- [25, 3, true, false, true, false],
- [25, 4, true, false, true, false],
- [25, 5, true, false, true, false],
- [25, 6, true, false, true, false],
- [25, 7, true, false, true, false],
- [25, 8, true, false, true, false],
- [25, 9, false, false, false, false],
- [25, 10, false, false, false, false],
- [25, 11, false, false, false, false],
- [25, 12, false, false, false, false],
- [25, 13, false, false, false, false],
- [25, 14, false, false, false, false],
- [25, 15, false, false, false, false],
- [25, 16, false, false, false, false],
- [25, 17, false, false, false, false],
- [25, 18, false, false, false, false],
- [25, 19, true, false, true, false],
- [25, 20, true, false, true, false],
- [25, 21, false, false, false, false],
- [25, 22, true, false, true, false],
- [25, 23, false, false, false, false],
- [25, 24, true, false, true, false],
- [25, 25, false, false, true, true],
- ];
-
- for (let test of table) {
- let x = vals[test[0]];
- let y = vals[test[1]];
-
- expect(x < y).toBe(test[2]);
- expect(x > y).toBe(test[3]);
- expect(x <= y).toBe(test[4]);
- expect(x >= y).toBe(test[5]);
- }
-});
diff --git a/Libraries/LibJS/Tests/operators/bitwise-not.js b/Libraries/LibJS/Tests/operators/bitwise-not.js
deleted file mode 100644
index 1ad75d5c92..0000000000
--- a/Libraries/LibJS/Tests/operators/bitwise-not.js
+++ /dev/null
@@ -1,23 +0,0 @@
-test("basic functionality", () => {
- expect(~0).toBe(-1);
- expect(~1).toBe(-2);
- expect(~2).toBe(-3);
- expect(~3).toBe(-4);
- expect(~4).toBe(-5);
- expect(~5).toBe(-6);
- expect(~-1).toBe(0);
- expect(~42).toBe(-43);
- expect(~9999).toBe(-10000);
-});
-
-test("non-numeric values", () => {
- expect(~"42").toBe(-43);
- expect(~"foo").toBe(-1);
- expect(~[]).toBe(-1);
- expect(~{}).toBe(-1);
- expect(~undefined).toBe(-1);
- expect(~null).toBe(-1);
- expect(~NaN).toBe(-1);
- expect(~Infinity).toBe(-1);
- expect(~-Infinity).toBe(-1);
-});
diff --git a/Libraries/LibJS/Tests/operators/comma-operator.js b/Libraries/LibJS/Tests/operators/comma-operator.js
deleted file mode 100644
index 368a43fff5..0000000000
--- a/Libraries/LibJS/Tests/operators/comma-operator.js
+++ /dev/null
@@ -1,24 +0,0 @@
-test("inside parenthesis", () => {
- expect((1, 2, 3)).toBe(3);
- expect((1, 2 + 3, 4)).toBe(4);
-});
-
-test("with post-increment operator", () => {
- let foo = 0;
- foo = (foo++, foo);
- expect(foo).toBe(1);
-});
-
-test("with assignment operator", () => {
- var a, b, c;
- expect(((a = b = 3), (c = 4))).toBe(4);
- expect(a).toBe(3);
- expect(b).toBe(3);
- expect(c).toBe(4);
-
- var x, y, z;
- expect((x = ((y = 5), (z = 6)))).toBe(6);
- expect(x).toBe(6);
- expect(y).toBe(5);
- expect(z).toBe(6);
-});
diff --git a/Libraries/LibJS/Tests/operators/delete-basic.js b/Libraries/LibJS/Tests/operators/delete-basic.js
deleted file mode 100644
index e619e711a2..0000000000
--- a/Libraries/LibJS/Tests/operators/delete-basic.js
+++ /dev/null
@@ -1,61 +0,0 @@
-test("deleting object properties", () => {
- const o = {};
- o.x = 1;
- o.y = 2;
- o.z = 3;
- expect(Object.getOwnPropertyNames(o)).toHaveLength(3);
-
- expect(delete o.x).toBeTrue();
- expect(o.hasOwnProperty("x")).toBeFalse();
- expect(o.hasOwnProperty("y")).toBeTrue();
- expect(o.hasOwnProperty("z")).toBeTrue();
- expect(Object.getOwnPropertyNames(o)).toHaveLength(2);
-
- expect(delete o.y).toBeTrue();
- expect(o.hasOwnProperty("x")).toBeFalse();
- expect(o.hasOwnProperty("y")).toBeFalse();
- expect(o.hasOwnProperty("z")).toBeTrue();
- expect(Object.getOwnPropertyNames(o)).toHaveLength(1);
-
- expect(delete o.z).toBeTrue();
- expect(o.hasOwnProperty("x")).toBeFalse();
- expect(o.hasOwnProperty("y")).toBeFalse();
- expect(o.hasOwnProperty("z")).toBeFalse();
- expect(Object.getOwnPropertyNames(o)).toHaveLength(0);
-});
-
-test("deleting array indices", () => {
- const a = [3, 5, 7];
-
- expect(Object.getOwnPropertyNames(a)).toHaveLength(4);
-
- expect(delete a[0]).toBeTrue();
- expect(a.hasOwnProperty(0)).toBeFalse();
- expect(a.hasOwnProperty(1)).toBeTrue();
- expect(a.hasOwnProperty(2)).toBeTrue();
- expect(Object.getOwnPropertyNames(a)).toHaveLength(3);
-
- expect(delete a[1]).toBeTrue();
- expect(a.hasOwnProperty(0)).toBeFalse();
- expect(a.hasOwnProperty(1)).toBeFalse();
- expect(a.hasOwnProperty(2)).toBeTrue();
- expect(Object.getOwnPropertyNames(a)).toHaveLength(2);
-
- expect(delete a[2]).toBeTrue();
- expect(a.hasOwnProperty(0)).toBeFalse();
- expect(a.hasOwnProperty(1)).toBeFalse();
- expect(a.hasOwnProperty(2)).toBeFalse();
- expect(Object.getOwnPropertyNames(a)).toHaveLength(1);
-
- expect(delete a["42"]).toBeTrue();
- expect(Object.getOwnPropertyNames(a)).toHaveLength(1);
-});
-
-test("deleting non-configurable property", () => {
- const q = {};
- Object.defineProperty(q, "foo", { value: 1, writable: false, enumerable: false });
- expect(q.foo).toBe(1);
-
- expect(delete q.foo).toBeFalse();
- expect(q.hasOwnProperty("foo")).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/operators/delete-global-variable.js b/Libraries/LibJS/Tests/operators/delete-global-variable.js
deleted file mode 100644
index 81c5ccac66..0000000000
--- a/Libraries/LibJS/Tests/operators/delete-global-variable.js
+++ /dev/null
@@ -1,9 +0,0 @@
-a = 1;
-
-test("basic functionality", () => {
- expect(delete a).toBeTrue();
-
- expect(() => {
- a;
- }).toThrowWithMessage(ReferenceError, "'a' is not defined");
-});
diff --git a/Libraries/LibJS/Tests/operators/delete-globalThis-property-crash.js b/Libraries/LibJS/Tests/operators/delete-globalThis-property-crash.js
deleted file mode 100644
index 27a219c5d6..0000000000
--- a/Libraries/LibJS/Tests/operators/delete-globalThis-property-crash.js
+++ /dev/null
@@ -1,8 +0,0 @@
-a = 1;
-
-test("basic functionality", () => {
- expect(delete globalThis.a).toBeTrue();
- expect(() => {
- a = 2;
- }).not.toThrow();
-});
diff --git a/Libraries/LibJS/Tests/operators/in-operator-basic.js b/Libraries/LibJS/Tests/operators/in-operator-basic.js
deleted file mode 100644
index 1deec41f76..0000000000
--- a/Libraries/LibJS/Tests/operators/in-operator-basic.js
+++ /dev/null
@@ -1,32 +0,0 @@
-test("in operator with objects", () => {
- const o = { foo: "bar", bar: undefined };
- expect("" in o).toBeFalse();
- expect("foo" in o).toBeTrue();
- expect("bar" in o).toBeTrue();
- expect("baz" in o).toBeFalse();
- expect("toString" in o).toBeTrue();
-});
-
-test("in operator with arrays", () => {
- const a = ["hello", "friends"];
- expect(0 in a).toBeTrue();
- expect(1 in a).toBeTrue();
- expect(2 in a).toBeFalse();
- expect("0" in a).toBeTrue();
- expect("hello" in a).toBeFalse();
- expect("friends" in a).toBeFalse();
- expect("length" in a).toBeTrue();
-});
-
-test("in operator with string object", () => {
- const s = new String("foo");
- expect("length" in s).toBeTrue();
-});
-
-test("error when used with primitives", () => {
- ["foo", 123, null, undefined].forEach(value => {
- expect(() => {
- "prop" in value;
- }).toThrowWithMessage(TypeError, "'in' operator must be used on an object");
- });
-});
diff --git a/Libraries/LibJS/Tests/operators/instanceof-basic.js b/Libraries/LibJS/Tests/operators/instanceof-basic.js
deleted file mode 100644
index 3d2b38c496..0000000000
--- a/Libraries/LibJS/Tests/operators/instanceof-basic.js
+++ /dev/null
@@ -1,36 +0,0 @@
-test("basic functionality", () => {
- function Foo() {
- this.x = 123;
- }
-
- const foo = new Foo();
- expect(foo instanceof Foo).toBeTrue();
-});
-
-test("derived ES5 classes", () => {
- function Base() {
- this.is_base = true;
- }
-
- function Derived() {
- this.is_derived = true;
- }
-
- Object.setPrototypeOf(Derived.prototype, Base.prototype);
-
- const d = new Derived();
- expect(d instanceof Derived).toBeTrue();
- expect(d instanceof Base).toBeTrue();
-});
-
-test("issue #3930, instanceof on arrow function", () => {
- function f() {}
- const a = () => {};
-
- expect(() => {
- f instanceof a;
- }).toThrow(TypeError);
- expect(() => {
- a instanceof a;
- }).toThrow(TypeError);
-});
diff --git a/Libraries/LibJS/Tests/operators/logical-and.js b/Libraries/LibJS/Tests/operators/logical-and.js
deleted file mode 100644
index 6d916a5b0e..0000000000
--- a/Libraries/LibJS/Tests/operators/logical-and.js
+++ /dev/null
@@ -1,50 +0,0 @@
-test("booleans", () => {
- expect(true && true).toBeTrue();
- expect(false && false).toBeFalse();
- expect(true && false).toBeFalse();
- expect(false && true).toBeFalse();
-});
-
-test("strings", () => {
- expect("" && "").toBe("");
- expect("" && false).toBe("");
- expect("" && true).toBe("");
- expect(false && "").toBeFalse();
- expect(true && "").toBe("");
- expect("foo" && "bar").toBe("bar");
- expect("foo" && false).toBeFalse();
- expect("foo" && true).toBeTrue();
- expect(false && "bar").toBeFalse();
- expect(true && "bar").toBe("bar");
-});
-
-test("numbers", () => {
- expect(false && 1 === 2).toBeFalse();
- expect(true && 1 === 2).toBeFalse();
- expect(0 && false).toBe(0);
- expect(0 && true).toBe(0);
- expect(42 && false).toBeFalse();
- expect(42 && true).toBeTrue();
- expect(false && 0).toBeFalse();
- expect(true && 0).toBe(0);
- expect(false && 42).toBeFalse();
- expect(true && 42).toBe(42);
-});
-
-test("objects", () => {
- expect([] && false).toBeFalse();
- expect([] && true).toBeTrue();
- expect(false && []).toBeFalse();
- expect(true && []).toHaveLength(0);
-});
-
-test("null & undefined", () => {
- expect(null && false).toBeNull();
- expect(null && true).toBeNull();
- expect(false && null).toBeFalse();
- expect(true && null).toBeNull();
- expect(undefined && false).toBeUndefined();
- expect(undefined && true).toBeUndefined();
- expect(false && undefined).toBeFalse();
- expect(true && undefined).toBeUndefined();
-});
diff --git a/Libraries/LibJS/Tests/operators/logical-expressions-short-circuit.js b/Libraries/LibJS/Tests/operators/logical-expressions-short-circuit.js
deleted file mode 100644
index 28ad1b3d81..0000000000
--- a/Libraries/LibJS/Tests/operators/logical-expressions-short-circuit.js
+++ /dev/null
@@ -1,13 +0,0 @@
-test("basic functionality", () => {
- let foo = 1;
- false && (foo = 2);
- expect(foo).toBe(1);
-
- foo = 1;
- true || (foo = 2);
- expect(foo).toBe(1);
-
- foo = 1;
- true ?? (foo = 2);
- expect(foo).toBe(1);
-});
diff --git a/Libraries/LibJS/Tests/operators/logical-nullish-coalescing.js b/Libraries/LibJS/Tests/operators/logical-nullish-coalescing.js
deleted file mode 100644
index f8d778208f..0000000000
--- a/Libraries/LibJS/Tests/operators/logical-nullish-coalescing.js
+++ /dev/null
@@ -1,50 +0,0 @@
-test("booleans", () => {
- expect(true ?? true).toBeTrue();
- expect(false ?? false).toBeFalse();
- expect(true ?? false).toBeTrue();
- expect(false ?? true).toBeFalse();
-});
-
-test("strings", () => {
- expect("" ?? "").toBe("");
- expect("" ?? false).toBe("");
- expect("" ?? true).toBe("");
- expect(false ?? "").toBeFalse();
- expect(true ?? "").toBeTrue();
- expect("foo" ?? "bar").toBe("foo");
- expect("foo" ?? false).toBe("foo");
- expect("foo" ?? true).toBe("foo");
- expect(false ?? "bar").toBeFalse();
- expect(true ?? "bar").toBeTrue();
-});
-
-test("numbers", () => {
- expect(false ?? 1 === 2).toBeFalse();
- expect(true ?? 1 === 2).toBeTrue();
- expect(0 ?? false).toBe(0);
- expect(0 ?? true).toBe(0);
- expect(42 ?? false).toBe(42);
- expect(42 ?? true).toBe(42);
- expect(false ?? 0).toBeFalse();
- expect(true ?? 0).toBeTrue();
- expect(false ?? 42).toBeFalse();
- expect(true ?? 42).toBeTrue();
-});
-
-test("objects", () => {
- expect([] ?? false).toHaveLength(0);
- expect([] ?? true).toHaveLength(0);
- expect(false ?? []).toBeFalse();
- expect(true ?? []).toBeTrue();
-});
-
-test("null & undefined", () => {
- expect(null ?? false).toBeFalse();
- expect(null ?? true).toBeTrue();
- expect(false ?? null).toBeFalse();
- expect(true ?? null).toBeTrue();
- expect(undefined ?? false).toBeFalse();
- expect(undefined ?? true).toBeTrue();
- expect(false ?? undefined).toBeFalse();
- expect(true ?? undefined).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/operators/logical-or.js b/Libraries/LibJS/Tests/operators/logical-or.js
deleted file mode 100644
index 9d5d71c5a0..0000000000
--- a/Libraries/LibJS/Tests/operators/logical-or.js
+++ /dev/null
@@ -1,50 +0,0 @@
-test("booleans", () => {
- expect(true || true).toBeTrue();
- expect(false || false).toBeFalse();
- expect(true || false).toBeTrue();
- expect(false || true).toBeTrue();
-});
-
-test("strings", () => {
- expect("" || "").toBe("");
- expect("" || false).toBeFalse();
- expect("" || true).toBeTrue();
- expect(false || "").toBe("");
- expect(true || "").toBeTrue();
- expect("foo" || "bar").toBe("foo");
- expect("foo" || false).toBe("foo");
- expect("foo" || true).toBe("foo");
- expect(false || "bar").toBe("bar");
- expect(true || "bar").toBeTrue();
-});
-
-test("numbers", () => {
- expect(false || 1 === 2).toBeFalse();
- expect(true || 1 === 2).toBeTrue();
- expect(0 || false).toBeFalse();
- expect(0 || true).toBeTrue();
- expect(42 || false).toBe(42);
- expect(42 || true).toBe(42);
- expect(false || 0).toBe(0);
- expect(true || 0).toBeTrue();
- expect(false || 42).toBe(42);
- expect(true || 42).toBeTrue();
-});
-
-test("objects", () => {
- expect([] || false).toHaveLength(0);
- expect([] || true).toHaveLength(0);
- expect(false || []).toHaveLength(0);
- expect(true || []).toBeTrue();
-});
-
-test("null & undefined", () => {
- expect(null || false).toBeFalse();
- expect(null || true).toBeTrue();
- expect(false || null).toBeNull();
- expect(true || null).toBeTrue();
- expect(undefined || false).toBeFalse();
- expect(undefined || true).toBeTrue();
- expect(false || undefined).toBeUndefined();
- expect(true || undefined).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/operators/modulo-basic.js b/Libraries/LibJS/Tests/operators/modulo-basic.js
deleted file mode 100644
index 22b60ea256..0000000000
--- a/Libraries/LibJS/Tests/operators/modulo-basic.js
+++ /dev/null
@@ -1,16 +0,0 @@
-test("basic functionality", () => {
- expect(10 % 3).toBe(1);
- expect(10.5 % 2.5).toBe(0.5);
- expect(-0.99 % 0.99).toBe(-0);
-
- // Examples from MDN:
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
- expect(12 % 5).toBe(2);
- expect(-1 % 2).toBe(-1);
- expect(1 % -2).toBe(1);
- expect(1 % 2).toBe(1);
- expect(2 % 3).toBe(2);
- expect(-4 % 2).toBe(-0);
- expect(5.5 % 2).toBe(1.5);
- expect(NaN % 2).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/operators/ternary-basic.js b/Libraries/LibJS/Tests/operators/ternary-basic.js
deleted file mode 100644
index c0f68fdf83..0000000000
--- a/Libraries/LibJS/Tests/operators/ternary-basic.js
+++ /dev/null
@@ -1,20 +0,0 @@
-test("basic functionality", () => {
- const x = 1;
-
- expect(x === 1 ? true : false).toBeTrue();
- expect(x ? x : 0).toBe(x);
- expect(1 < 2 ? true : false).toBeTrue();
- expect(0 ? 1 : 1 ? 10 : 20).toBe(10);
- expect(0 ? (1 ? 1 : 10) : 20).toBe(20);
-});
-
-test("object values", () => {
- const o = {};
- o.f = true;
- expect(o.f ? true : false).toBeTrue();
- expect(1 ? o.f : null).toBeTrue();
-});
-
-test("issue #4409, '?.' followed by decimal digit", () => {
- expect("return false?.1:.2").toEvalTo(0.2);
-});
diff --git a/Libraries/LibJS/Tests/operators/typeof-basic.js b/Libraries/LibJS/Tests/operators/typeof-basic.js
deleted file mode 100644
index 8a84b5a72b..0000000000
--- a/Libraries/LibJS/Tests/operators/typeof-basic.js
+++ /dev/null
@@ -1,27 +0,0 @@
-test("basic functionality", () => {
- expect(typeof "foo").toBe("string");
- expect(typeof (1 + 2)).toBe("number");
- expect(typeof {}).toBe("object");
- expect(typeof null).toBe("object");
- expect(typeof undefined).toBe("undefined");
- expect(typeof 1n).toBe("bigint");
- expect(typeof Symbol()).toBe("symbol");
- expect(typeof function () {}).toBe("function");
-
- var iExist = 1;
- expect(typeof iExist).toBe("number");
- expect(typeof iDontExist).toBe("undefined");
-});
-
-test("typeof calls property getter", () => {
- var calls = 0;
- Object.defineProperty(globalThis, "foo", {
- get() {
- calls++;
- return 10;
- },
- });
-
- expect(typeof foo).toBe("number");
- expect(calls).toBe(1);
-});
diff --git a/Libraries/LibJS/Tests/operators/void-basic.js b/Libraries/LibJS/Tests/operators/void-basic.js
deleted file mode 100644
index a23becae96..0000000000
--- a/Libraries/LibJS/Tests/operators/void-basic.js
+++ /dev/null
@@ -1,14 +0,0 @@
-test("basic functionality", () => {
- expect(void "").toBeUndefined();
- expect(void "foo").toBeUndefined();
- expect(void 1).toBeUndefined();
- expect(void 42).toBeUndefined();
- expect(void true).toBeUndefined();
- expect(void false).toBeUndefined();
- expect(void null).toBeUndefined();
- expect(void undefined).toBeUndefined();
- expect(void function () {}).toBeUndefined();
- expect(void (() => {})).toBeUndefined();
- expect(void (() => "hello friends")()).toBeUndefined();
- expect((() => void "hello friends")()).toBeUndefined();
-});
diff --git a/Libraries/LibJS/Tests/ordinary-to-primitive.js b/Libraries/LibJS/Tests/ordinary-to-primitive.js
deleted file mode 100644
index 176beadb76..0000000000
--- a/Libraries/LibJS/Tests/ordinary-to-primitive.js
+++ /dev/null
@@ -1,23 +0,0 @@
-test("object with custom toString", () => {
- const o = { toString: () => "foo" };
- expect(o + "bar").toBe("foobar");
- expect([o, "bar"].toString()).toBe("foo,bar");
-});
-
-test("object with uncallable toString and custom valueOf", () => {
- const o = { toString: undefined, valueOf: () => "foo" };
- expect(o + "bar").toBe("foobar");
- expect([o, "bar"].toString()).toBe("foo,bar");
-});
-
-test("object with custom valueOf", () => {
- const o = { valueOf: () => 42 };
- expect(Number(o)).toBe(42);
- expect(o + 1).toBe(43);
-});
-
-test("object with uncallable valueOf and custom toString", () => {
- const o = { valueOf: undefined, toString: () => "42" };
- expect(Number(o)).toBe(42);
- expect(o + 1).toBe("421");
-});
diff --git a/Libraries/LibJS/Tests/parseInt.js b/Libraries/LibJS/Tests/parseInt.js
deleted file mode 100644
index e4115affd0..0000000000
--- a/Libraries/LibJS/Tests/parseInt.js
+++ /dev/null
@@ -1,59 +0,0 @@
-test("basic parseInt() functionality", () => {
- expect(parseInt("0")).toBe(0);
- expect(parseInt("100")).toBe(100);
- expect(parseInt("1000", 16)).toBe(4096);
- expect(parseInt("0xF", 16)).toBe(15);
- expect(parseInt("F", 16)).toBe(15);
- expect(parseInt("17", 8)).toBe(15);
- expect(parseInt(021, 8)).toBe(15);
- expect(parseInt("015", 10)).toBe(15);
- expect(parseInt(15.99, 10)).toBe(15);
- expect(parseInt("15,123", 10)).toBe(15);
- expect(parseInt("FXX123", 16)).toBe(15);
- expect(parseInt("1111", 2)).toBe(15);
- expect(parseInt("15 * 3", 10)).toBe(15);
- expect(parseInt("15e2", 10)).toBe(15);
- expect(parseInt("15px", 10)).toBe(15);
- expect(parseInt("12", 13)).toBe(15);
- expect(parseInt("Hello", 8)).toBeNaN();
- expect(parseInt("546", 2)).toBeNaN();
- expect(parseInt("-F", 16)).toBe(-15);
- expect(parseInt("-0F", 16)).toBe(-15);
- expect(parseInt("-0XF", 16)).toBe(-15);
- expect(parseInt(-15.1, 10)).toBe(-15);
- expect(parseInt("-17", 8)).toBe(-15);
- expect(parseInt("-15", 10)).toBe(-15);
- expect(parseInt("-1111", 2)).toBe(-15);
- expect(parseInt("-15e1", 10)).toBe(-15);
- expect(parseInt("-12", 13)).toBe(-15);
- expect(parseInt(4.7, 10)).toBe(4);
- expect(parseInt("0e0", 16)).toBe(224);
- expect(parseInt("123_456")).toBe(123);
-
- // FIXME: expect(parseInt(4.7 * 1e22, 10)).toBe(4);
- // FIXME: expect(parseInt(0.00000000000434, 10)).toBe(4);
- // FIXME: expect(parseInt(0.0000001,11)).toBe(1);
- // FIXME: expect(parseInt(0.000000124,10)).toBe(1);
- // FIXME: expect(parseInt(1e-7,10)).toBe(1);
- // FIXME: expect(parseInt(1000000000000100000000,10)).toBe(1);
- // FIXME: expect(parseInt(123000000000010000000000,10)).toBe(1);
- // FIXME: expect(parseInt(1e+21,10)).toBe(1);
- // FIXME: expect(parseInt('900719925474099267n')).toBe(900719925474099300)
-});
-
-test("parseInt() radix is coerced to a number", () => {
- const obj = {
- valueOf() {
- return 8;
- },
- };
- expect(parseInt("11", obj)).toBe(9);
- obj.valueOf = function () {
- return 1;
- };
- expect(parseInt("11", obj)).toBeNaN();
- obj.valueOf = function () {
- return Infinity;
- };
- expect(parseInt("11", obj)).toBe(11);
-});
diff --git a/Libraries/LibJS/Tests/parser-declaration-in-single-statement-context.js b/Libraries/LibJS/Tests/parser-declaration-in-single-statement-context.js
deleted file mode 100644
index 5e263427bc..0000000000
--- a/Libraries/LibJS/Tests/parser-declaration-in-single-statement-context.js
+++ /dev/null
@@ -1,6 +0,0 @@
-test("Declaration in single-statement context is a syntax error", () => {
- expect("if (0) const foo = 1").not.toEval();
- expect("while (0) function foo() {}").not.toEval();
- expect("for (var 0;;) class foo() {}").not.toEval();
- expect("do let foo = 1 while (0)").not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/parser-line-terminators.js b/Libraries/LibJS/Tests/parser-line-terminators.js
deleted file mode 100644
index ab88b0eb44..0000000000
--- a/Libraries/LibJS/Tests/parser-line-terminators.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-These tests deliberately produce syntax errors to check what line the parser thinks we're on.
-Note that line numbers are higher than you might expect as the parsed code is:
-
-function anonymous(
-) {
-<code>
-}
-
-⚠ PLEASE MAKE SURE TO NOT LET YOUR EDITOR REMOVE THE LS/PS LINE TERMINATORS!
-*/
-
-test("LINE FEED is a line terminator", () => {
- expect(() => {
- Function("\n\n@");
- }).toThrowWithMessage(SyntaxError, "line: 5, column: 1");
-});
-
-test("CARRIAGE RETURN is a line terminator", () => {
- expect(() => {
- Function("\r\r@");
- }).toThrowWithMessage(SyntaxError, "line: 5, column: 1");
-});
-
-test("LINE SEPARATOR is a line terminator", () => {
- expect(() => {
- Function("

@");
- }).toThrowWithMessage(SyntaxError, "line: 5, column: 1");
-});
-
-test("PARAGRAPH SEPARATOR is a line terminator", () => {
- expect(() => {
- Function("

@");
- }).toThrowWithMessage(SyntaxError, "line: 5, column: 1");
-});
-
-test("CR LF is counted as only one line terminator", () => {
- expect(() => {
- Function("\r\n\r\n@");
- }).toThrowWithMessage(SyntaxError, "line: 5, column: 1");
-});
-
-test("LF/CR are not allowed in string literal", () => {
- expect(() => {
- Function(`"
- "`);
- }).toThrowWithMessage(SyntaxError, "Unexpected token UnterminatedStringLiteral");
-});
-
-test("LS/PS are allowed in string literal", () => {
- expect(`"
"`).toEval();
- expect(`"
"`).toEval();
-});
-
-test("line terminators can be mixed (but please don't)", () => {
- expect(() => {
- Function("\r
\r\n
\n\r@");
- }).toThrowWithMessage(SyntaxError, "line: 9, column: 1");
-});
-
-test("all line terminators are valid for line continuations", () => {
- expect(Function('return "a\\\nb"')()).toBe("ab");
- expect(Function('return "a\\\rb"')()).toBe("ab");
- expect(Function('return "a\\
b"')()).toBe("ab");
- expect(Function('return "a\\
b"')()).toBe("ab");
-});
diff --git a/Libraries/LibJS/Tests/parser-unary-associativity.js b/Libraries/LibJS/Tests/parser-unary-associativity.js
deleted file mode 100644
index 25763eda6c..0000000000
--- a/Libraries/LibJS/Tests/parser-unary-associativity.js
+++ /dev/null
@@ -1,14 +0,0 @@
-test("basic functionality", () => {
- const o = {};
- o.a = 1;
-
- expect(o.a === 1).toBeTrue();
- expect(!o.a === false).toBeTrue();
- expect(!o.a === !o.a).toBeTrue();
- expect(~o.a === ~o.a).toBeTrue();
- expect(+o.a === +o.a).toBeTrue();
- expect(-o.a === -o.a).toBeTrue();
-
- expect((typeof "x" === "string") === true).toBeTrue();
- expect(!(typeof "x" === "string") === false).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/program-strict-mode.js b/Libraries/LibJS/Tests/program-strict-mode.js
deleted file mode 100644
index d8f8941d0f..0000000000
--- a/Libraries/LibJS/Tests/program-strict-mode.js
+++ /dev/null
@@ -1,18 +0,0 @@
-"use strict";
-
-test("basic functionality", () => {
- expect(isStrictMode()).toBeTrue();
-
- (function () {
- expect(isStrictMode()).toBeTrue();
- })();
-
- (() => {
- expect(isStrictMode()).toBeTrue();
- })();
-
- (() => {
- "use strict";
- expect(isStrictMode()).toBeTrue();
- })();
-});
diff --git a/Libraries/LibJS/Tests/return.js b/Libraries/LibJS/Tests/return.js
deleted file mode 100644
index 2c5b8683f6..0000000000
--- a/Libraries/LibJS/Tests/return.js
+++ /dev/null
@@ -1,53 +0,0 @@
-describe("returning from loops", () => {
- test("returning from while loops", () => {
- function foo() {
- while (true) {
- return 10;
- }
- }
-
- expect(foo()).toBe(10);
- });
-
- test("returning from do-while loops", () => {
- function foo() {
- do {
- return 10;
- } while (true);
- }
-
- expect(foo()).toBe(10);
- });
-
- test("returning from for loops", () => {
- function foo() {
- for (let i = 0; i < 5; i++) {
- return 10;
- }
- }
-
- expect(foo()).toBe(10);
- });
-
- test("returning from for-in loops", () => {
- function foo() {
- const o = { a: 1, b: 2 };
- for (let a in o) {
- return 10;
- }
- }
-
- expect(foo()).toBe(10);
- });
-
- test("returning from for-of loops", () => {
- function foo() {
- const o = [1, 2, 3];
- for (let a of o) {
- return 10;
- }
- }
-
- expect(foo()).toBe(10);
- });
-});
diff --git a/Libraries/LibJS/Tests/runtime-error-call-stack-size.js b/Libraries/LibJS/Tests/runtime-error-call-stack-size.js
deleted file mode 100644
index 177bb2d675..0000000000
--- a/Libraries/LibJS/Tests/runtime-error-call-stack-size.js
+++ /dev/null
@@ -1,21 +0,0 @@
-test("infinite recursion", () => {
- function infiniteRecursion() {
- infiniteRecursion();
- }
-
- try {
- infiniteRecursion();
- } catch (e) {
- expect(e).toBeInstanceOf(Error);
- expect(e.name).toBe("RuntimeError");
- expect(e.message).toBe("Call stack size limit exceeded");
- }
-
- expect(() => {
- JSON.stringify({}, () => ({ foo: "bar" }));
- }).toThrowWithMessage(Error, "Call stack size limit exceeded");
-
- expect(() => {
- new Proxy({}, { get: (_, __, p) => p.foo }).foo;
- }).toThrowWithMessage(Error, "Call stack size limit exceeded");
-});
diff --git a/Libraries/LibJS/Tests/strict-mode-blocks.js b/Libraries/LibJS/Tests/strict-mode-blocks.js
deleted file mode 100644
index 35d0264664..0000000000
--- a/Libraries/LibJS/Tests/strict-mode-blocks.js
+++ /dev/null
@@ -1,25 +0,0 @@
-test("Issue #3641, strict mode should be function- or program-level, not block-level", () => {
- function func() {
- expect(isStrictMode()).toBeFalse();
-
- // prettier-ignore
- {
- "use strict";
- expect(isStrictMode()).toBeFalse();
- }
-
- // prettier-ignore
- if (true) {
- "use strict";
- expect(isStrictMode()).toBeFalse();
- }
-
- // prettier-ignore
- do {
- "use strict";
- expect(isStrictMode()).toBeFalse();
- } while (false);
- }
-
- func();
-});
diff --git a/Libraries/LibJS/Tests/strict-mode-errors.js b/Libraries/LibJS/Tests/strict-mode-errors.js
deleted file mode 100644
index ada52e359f..0000000000
--- a/Libraries/LibJS/Tests/strict-mode-errors.js
+++ /dev/null
@@ -1,15 +0,0 @@
-"use strict";
-
-test("basic functionality", () => {
- [true, false, "foo", 123].forEach(primitive => {
- expect(() => {
- primitive.foo = "bar";
- }).toThrowWithMessage(TypeError, "Cannot assign property foo to primitive value");
- expect(() => {
- primitive[Symbol.hasInstance] = 123;
- }).toThrowWithMessage(
- TypeError,
- "Cannot assign property Symbol(Symbol.hasInstance) to primitive value"
- );
- });
-});
diff --git a/Libraries/LibJS/Tests/string-escapes.js b/Libraries/LibJS/Tests/string-escapes.js
deleted file mode 100644
index 8a0920361e..0000000000
--- a/Libraries/LibJS/Tests/string-escapes.js
+++ /dev/null
@@ -1,63 +0,0 @@
-test("hex escapes", () => {
- expect("\x55").toBe("U");
- expect("X55").toBe("X55");
- expect(`\x55`).toBe("U");
- expect(`\X55`).toBe("X55");
- expect("\xff").toBe(String.fromCharCode(0xff));
- expect("'\\x'").not.toEval();
- expect("'\\x1'").not.toEval();
- expect("'\\xz'").not.toEval();
- expect("'\\xzz'").not.toEval();
- expect("'\\x🐞'").not.toEval();
-});
-
-test("unicode escapes", () => {
- expect("\u26a0").toBe("⚠");
- expect(`\u26a0`).toBe("⚠");
- expect("\u{1f41e}").toBe("🐞");
- expect(`\u{1f41e}`).toBe("🐞");
- expect("\u00ff").toBe(String.fromCharCode(0xff));
- expect("'\\u'").not.toEval();
- expect("'\\u1'").not.toEval();
- expect("'\\uf'").not.toEval();
- expect("'\\u123'").not.toEval();
- expect("'\\u123z'").not.toEval();
- expect("'\\uz'").not.toEval();
- expect("'\\uzz'").not.toEval();
- expect("'\\uzzzz'").not.toEval();
- expect("'\\u{'").not.toEval();
- expect("'\\u{}'").not.toEval();
- expect("'\\u{z}'").not.toEval();
- expect("'\\u🐞'").not.toEval();
-});
-
-describe("octal escapes", () => {
- test("basic functionality", () => {
- expect("\1").toBe("\u0001");
- expect("\2").toBe("\u0002");
- expect("\3").toBe("\u0003");
- expect("\4").toBe("\u0004");
- expect("\5").toBe("\u0005");
- expect("\6").toBe("\u0006");
- expect("\7").toBe("\u0007");
- // prettier-ignore
- expect("\8").toBe("8");
- // prettier-ignore
- expect("\9").toBe("9");
- expect("\128").toBe("\n8");
- expect("\141bc").toBe("abc");
- expect("f\157o\142a\162").toBe("foobar");
- expect("\123\145\162\145\156\151\164\171\117\123").toBe("SerenityOS");
- });
-
- test("syntax error in template literal", () => {
- expect("`\\123`").not.toEval();
- });
-
- test("syntax error in strict mode", () => {
- expect("'use strict'; '\\123'").not.toEval();
- expect('"use strict"; "\\123"').not.toEval();
- // Special case, string literal precedes use strict directive
- expect("'\\123'; somethingElse; 'use strict'").not.toEval();
- });
-});
diff --git a/Libraries/LibJS/Tests/string-spread.js b/Libraries/LibJS/Tests/string-spread.js
deleted file mode 100644
index 507bab7710..0000000000
--- a/Libraries/LibJS/Tests/string-spread.js
+++ /dev/null
@@ -1,25 +0,0 @@
-function testArray(arr) {
- return arr.length === 4 && arr[0] === "a" && arr[1] === "b" && arr[2] === "c" && arr[3] === "d";
-}
-
-test("spreading string literal", () => {
- expect(["a", ..."bc", "d"]).toEqual(["a", "b", "c", "d"]);
-});
-
-test("spreading string variable", () => {
- const s = "bc";
- expect(["a", ...s, "d"]).toEqual(["a", "b", "c", "d"]);
-});
-
-test("spreading string in object", () => {
- const obj = { a: "bc" };
- expect(["a", ...obj.a, "d"]).toEqual(["a", "b", "c", "d"]);
-});
-
-test("spreading empty string", () => {
- expect([..."", "a", ..."bc", ..."", "d", ...""]).toEqual(["a", "b", "c", "d"]);
-});
-
-test("spreading string objects", () => {
- expect([..."", ...[...new String("abc")], "d"]).toEqual(["a", "b", "c", "d"]);
-});
diff --git a/Libraries/LibJS/Tests/switch-basic.js b/Libraries/LibJS/Tests/switch-basic.js
deleted file mode 100644
index 36210dda17..0000000000
--- a/Libraries/LibJS/Tests/switch-basic.js
+++ /dev/null
@@ -1,78 +0,0 @@
-describe("basic switch tests", () => {
- test("string case does not match number target", () => {
- switch (1 + 2) {
- case "3":
- expect().fail();
- case 3:
- return;
- case 5:
- case 1:
- break;
- default:
- break;
- }
-
- expect().fail();
- });
-
- test("string concatenation in target", () => {
- var a = "foo";
-
- switch (a + "bar") {
- case 1:
- expect().fail();
- case "foobar":
- case 2:
- return;
- }
- expect().fail();
- });
-
- test("default", () => {
- switch (100) {
- default:
- return;
- }
-
- expect().fail();
- });
-
- test("return from switch statement", () => {
- function foo(value) {
- switch (value) {
- case 42:
- return "return from 'case 42'";
- default:
- return "return from 'default'";
- }
- }
- expect(foo(42)).toBe("return from 'case 42'");
- expect(foo(43)).toBe("return from 'default'");
- });
-
- test("continue from switch statement", () => {
- let i = 0;
- for (; i < 5; ++i) {
- switch (i) {
- case 0:
- continue;
- expect().fail();
- case 0:
- expect().fail();
- default:
- continue;
- expect().fail();
- }
- expect().fail();
- }
- expect(i).toBe(5);
- });
-});
-
-describe("errors", () => {
- test("syntax errors", () => {
- expect("switch () {}").not.toEval();
- expect("switch (foo) { bar }").not.toEval();
- expect("switch (foo) { default: default: }").not.toEval();
- });
-});
diff --git a/Libraries/LibJS/Tests/switch-break.js b/Libraries/LibJS/Tests/switch-break.js
deleted file mode 100644
index c8f30aba7e..0000000000
--- a/Libraries/LibJS/Tests/switch-break.js
+++ /dev/null
@@ -1,20 +0,0 @@
-test("basic functionality", () => {
- let i = 0;
- let three;
- let five;
-
- for (; i < 9; ) {
- switch (i) {
- case 3:
- three = i;
- break;
- case 5:
- five = i;
- break;
- }
- ++i;
- }
-
- expect(three).toBe(3);
- expect(five).toBe(5);
-});
diff --git a/Libraries/LibJS/Tests/tagged-template-literals.js b/Libraries/LibJS/Tests/tagged-template-literals.js
deleted file mode 100644
index 8372333ff6..0000000000
--- a/Libraries/LibJS/Tests/tagged-template-literals.js
+++ /dev/null
@@ -1,108 +0,0 @@
-describe("tagged template literal errors", () => {
- test("undefined variables in template expression throw a ReferenceError", () => {
- expect(() => {
- foo`bar${baz}`;
- }).toThrowWithMessage(ReferenceError, "'foo' is not defined");
-
- expect(() => {
- function foo() {}
- foo`bar${baz}`;
- }).toThrowWithMessage(ReferenceError, "'baz' is not defined");
- });
-
- test("cannot tag a non-function", () => {
- expect(() => {
- undefined``;
- }).toThrowWithMessage(TypeError, "undefined is not a function");
- });
-});
-
-describe("tagged template literal functionality", () => {
- test("empty template tag", () => {
- function test1(strings) {
- expect(strings).toBeInstanceOf(Array);
- expect(strings).toHaveLength(1);
- expect(strings[0]).toBe("");
- return 42;
- }
- expect(test1``).toBe(42);
- });
-
- test("tagging a template literal", () => {
- function test2(s) {
- return function (strings) {
- expect(strings).toBeInstanceOf(Array);
- expect(strings).toHaveLength(1);
- expect(strings[0]).toBe("bar");
- return s + strings[0];
- };
- }
- expect(test2("foo")`bar`).toBe("foobar");
- });
-
- test("tagging an object function key", () => {
- var test3 = {
- foo(strings, p1) {
- expect(strings).toBeInstanceOf(Array);
- expect(strings).toHaveLength(2);
- expect(strings[0]).toBe("");
- expect(strings[1]).toBe("");
- expect(p1).toBe("bar");
- },
- };
- test3.foo`${"bar"}`;
- });
-
- test("tagging with a variable in a template expression", () => {
- function test4(strings, p1) {
- expect(strings).toBeInstanceOf(Array);
- expect(strings).toHaveLength(2);
- expect(strings[0]).toBe("foo");
- expect(strings[1]).toBe("");
- expect(p1).toBe(42);
- }
- var bar = 42;
- test4`foo${bar}`;
- });
-
- test("template tag result of another template tag", () => {
- function test5(strings, p1, p2) {
- expect(strings).toBeInstanceOf(Array);
- expect(strings).toHaveLength(3);
- expect(strings[0]).toBe("foo");
- expect(strings[1]).toBe("baz");
- expect(strings[2]).toBe("");
- expect(p1).toBe(42);
- expect(p2).toBe("qux");
- return (strings, value) => `${value}${strings[0]}`;
- }
- var bar = 42;
- expect(test5`foo${bar}baz${"qux"}``test${123}`).toBe("123test");
- });
-
- test("general test", () => {
- function review(strings, name, rating) {
- return `${strings[0]}**${name}**${strings[1]}_${rating}_${strings[2]}`;
- }
- var name = "SerenityOS";
- var rating = "great";
- expect(review`${name} is a ${rating} project!`).toBe(
- "**SerenityOS** is a _great_ project!"
- );
- });
-
- test("template object structure", () => {
- const getTemplateObject = (...rest) => rest;
- const getRawTemplateStrings = arr => arr.raw;
-
- let o = getTemplateObject`foo\nbar`;
- expect(Object.getOwnPropertyNames(o[0])).toContain("raw");
-
- let raw = getRawTemplateStrings`foo${1 + 3}\nbar`;
- expect(Object.getOwnPropertyNames(raw)).not.toContain("raw");
- expect(raw).toHaveLength(2);
- expect(raw[0]).toBe("foo");
- expect(raw[1]).toHaveLength(5);
- expect(raw[1]).toBe("\\nbar");
- });
-});
diff --git a/Libraries/LibJS/Tests/template-literals.js b/Libraries/LibJS/Tests/template-literals.js
deleted file mode 100644
index 07d81509a8..0000000000
--- a/Libraries/LibJS/Tests/template-literals.js
+++ /dev/null
@@ -1,65 +0,0 @@
-test("plain literals with expression-like characters", () => {
- expect(`foo`).toBe("foo");
- expect(`foo{`).toBe("foo{");
- expect(`foo}`).toBe("foo}");
- expect(`foo$`).toBe("foo$");
-});
-
-test("plain literals with escaped special characters", () => {
- expect(`foo\``).toBe("foo`");
- expect(`foo\$`).toBe("foo$");
- expect(`foo \${"bar"}`).toBe('foo ${"bar"}');
-});
-
-test("literals in expressions", () => {
- expect(`foo ${undefined}`).toBe("foo undefined");
- expect(`foo ${null}`).toBe("foo null");
- expect(`foo ${5}`).toBe("foo 5");
- expect(`foo ${true}`).toBe("foo true");
- expect(`foo ${"bar"}`).toBe("foo bar");
-});
-
-test("objects in expressions", () => {
- expect(`foo ${{}}`).toBe("foo [object Object]");
- expect(`foo ${{ bar: { baz: "qux" } }}`).toBe("foo [object Object]");
-});
-
-test("expressions at beginning of template literal", () => {
- expect(`${"foo"} bar baz`).toBe("foo bar baz");
- expect(`${"foo bar baz"}`).toBe("foo bar baz");
-});
-
-test("multiple template literals", () => {
- expect(`foo ${"bar"} ${"baz"}`).toBe("foo bar baz");
-});
-
-test("variables in expressions", () => {
- let a = 27;
- expect(`${a}`).toBe("27");
- expect(`foo ${a}`).toBe("foo 27");
- expect(`foo ${a ? "bar" : "baz"}`).toBe("foo bar");
- expect(`foo ${(() => a)()}`).toBe("foo 27");
-});
-
-test("template literals in expressions", () => {
- expect(`foo ${`bar`}`).toBe("foo bar");
- expect(`${`${`${`${"foo"}`} bar`}`}`).toBe("foo bar");
-});
-
-test("newline literals (not characters)", () => {
- expect(
- `foo
- bar`
- ).toBe("foo\n bar");
-});
-
-test("line continuation in literals (not characters)", () => {
- expect(
- `foo\
- bar`
- ).toBe("foo bar");
-});
-
-test("reference error from expressions", () => {
- expect(() => `${b}`).toThrowWithMessage(ReferenceError, "'b' is not defined");
-});
diff --git a/Libraries/LibJS/Tests/test-common-tests.js b/Libraries/LibJS/Tests/test-common-tests.js
deleted file mode 100644
index a857d327bb..0000000000
--- a/Libraries/LibJS/Tests/test-common-tests.js
+++ /dev/null
@@ -1,417 +0,0 @@
-test("toBe", () => {
- expect(null).toBe(null);
- expect(undefined).toBe(undefined);
- expect(null).not.toBe(undefined);
-
- expect(1).toBe(1);
- expect(1).not.toBe(2);
-
- expect("1").toBe("1");
- expect("1").not.toBe("2");
-
- expect(true).toBeTrue();
- expect(true).not.toBeFalse();
-
- expect({}).not.toBe({});
- expect([]).not.toBe([]);
-
- function foo() {}
- expect(foo).toBe(foo);
- expect(function () {}).not.toBe(function () {});
-
- let s = Symbol("foo");
- expect(s).toBe(s);
- expect(Symbol("foo")).not.toBe(Symbol("foo"));
-
- expect(1n).toBe(1n);
- expect(1n).not.toBe(1);
-});
-
-test("toBeCloseTo", () => {
- expect(1).toBeCloseTo(1);
- expect(1).not.toBeCloseTo(1.1);
- expect(1).not.toBeCloseTo(1.01);
- expect(1).not.toBeCloseTo(1.001);
- expect(1).not.toBeCloseTo(1.0001);
- expect(1).not.toBeCloseTo(1.00001);
- expect(1).toBeCloseTo(1.000001);
-
- [
- ["foo", 1],
- [1, "foo"],
- [1n, 1],
- ].forEach(arr => {
- expect(() => {
- expect(arr[0]).toBeCloseTo(arr[1]);
- }).toThrow(ExpectationError);
- });
-});
-
-test("toHaveLength", () => {
- expect([]).toHaveLength(0);
- expect([]).not.toHaveLength(1);
- expect([1]).toHaveLength(1);
- expect({ length: 1 }).toHaveLength(1);
-
- expect("a\
-b").toHaveLength(2);
-
- expect(() => {
- expect(1).toHaveLength();
- }).toThrow(ExpectationError);
-});
-
-test("toHaveProperty", () => {
- expect([]).toHaveProperty("length");
- expect([]).toHaveProperty("length", 0);
- expect([1]).not.toHaveProperty("length", 0);
- expect({ foo: "bar" }).toHaveProperty("foo");
- expect({ foo: "bar" }).toHaveProperty("foo", "bar");
-
- expect({ foo: { bar: "baz" } }).toHaveProperty(["foo", "bar"]);
- expect({ foo: { bar: "baz" } }).toHaveProperty(["foo", "bar"], "baz");
- expect({ foo: { bar: "baz" } }).toHaveProperty("foo.bar");
- expect({ foo: { bar: "baz" } }).toHaveProperty("foo.bar", "baz");
-
- expect({ foo: { bar: "baz" } }).toHaveProperty(["foo", "bar"]);
- expect({ foo: { bar: "baz" } }).toHaveProperty(["foo", "bar"], "baz");
- expect({ foo: { bar: "baz" } }).not.toHaveProperty(["foo", "baz"]);
- expect({ foo: { bar: "baz" } }).not.toHaveProperty(["foo", "baz"], "qux");
- expect({ foo: { bar: "baz" } }).not.toHaveProperty("foo.baz");
- expect({ foo: { bar: "baz" } }).not.toHaveProperty("foo.baz", "qux");
-});
-
-test("toBeDefined", () => {
- expect(1).toBeDefined();
- expect(true).toBeDefined();
- expect(false).toBeDefined();
- expect({}).toBeDefined();
- expect([]).toBeDefined();
- expect("a").toBeDefined();
- expect(null).toBeDefined();
- expect(undefined).not.toBeDefined();
-});
-
-test("toBeInstanceOf", () => {
- expect(new Error()).toBeInstanceOf(Error);
- expect(Error).not.toBeInstanceOf(Error);
-
- class Parent {}
- class Child extends Parent {}
-
- expect(new Child()).toBeInstanceOf(Child);
- expect(new Child()).toBeInstanceOf(Parent);
- expect(new Parent()).toBeInstanceOf(Parent);
- expect(new Parent()).not.toBeInstanceOf(Child);
-});
-
-test("toBeNull", () => {
- expect(null).toBeNull();
- expect(undefined).not.toBeNull();
- expect(5).not.toBeNull();
-});
-
-test("toBeUndefined", () => {
- expect(undefined).toBeUndefined();
- expect(null).not.toBeUndefined();
- expect().toBeUndefined();
- expect(5).not.toBeUndefined();
-});
-
-test("toBeNaN", () => {
- expect(NaN).toBeNaN();
- expect(5).not.toBeNaN();
-});
-
-test("toBeTrue", () => {
- expect(true).toBeTrue();
- expect(false).not.toBeTrue();
- expect(null).not.toBeTrue();
- expect(undefined).not.toBeTrue();
- expect(0).not.toBeTrue();
-});
-
-test("toBeFalse", () => {
- expect(true).not.toBeFalse();
- expect(false).toBeFalse();
- expect(null).not.toBeFalse();
- expect(undefined).not.toBeFalse();
- expect(0).not.toBeFalse();
-});
-
-test("toBeLessThan", () => {
- expect(0).toBeLessThan(1);
- expect(0).toBeLessThan(0.1);
- expect(1).not.toBeLessThan(1);
- expect(1).not.toBeLessThan(0);
-
- expect(0n).toBeLessThan(1n);
- expect(1n).not.toBeLessThan(1n);
- expect(1n).not.toBeLessThan(0n);
-
- [
- ["foo", 0],
- [0, "foo"],
- [0, 0n],
- [0n, 0],
- ].forEach(arr => {
- expect(() => {
- expect(arr[0]).toBeLessThan(arr[1]);
- }).toThrow(ExpectationError);
- });
-});
-
-test("toBeLessThanOrEqual", () => {
- expect(0).toBeLessThanOrEqual(1);
- expect(0).toBeLessThanOrEqual(0.1);
- expect(1).toBeLessThanOrEqual(1);
- expect(1).not.toBeLessThanOrEqual(0);
-
- expect(0n).toBeLessThanOrEqual(1n);
- expect(1n).toBeLessThanOrEqual(1n);
- expect(1n).not.toBeLessThanOrEqual(0n);
-
- [
- ["foo", 0],
- [0, "foo"],
- [0, 0n],
- [0n, 0],
- ].forEach(arr => {
- expect(() => {
- expect(arr[0]).toBeLessThanOrEqual(arr[1]);
- }).toThrow(ExpectationError);
- });
-});
-
-test("toBeGreaterThan", () => {
- expect(1).toBeGreaterThan(0);
- expect(0.1).toBeGreaterThan(0);
- expect(1).not.toBeGreaterThan(1);
- expect(0).not.toBeGreaterThan(1);
-
- expect(1n).toBeGreaterThan(0n);
- expect(1n).not.toBeGreaterThan(1n);
- expect(0n).not.toBeGreaterThan(1n);
-
- [
- ["foo", 0],
- [0, "foo"],
- [0, 0n],
- [0n, 0],
- ].forEach(arr => {
- expect(() => {
- expect(arr[0]).toBeGreaterThan(arr[1]);
- }).toThrow(ExpectationError);
- });
-});
-
-test("toBeGreaterThanOrEqual", () => {
- expect(1).toBeGreaterThanOrEqual(0);
- expect(0.1).toBeGreaterThanOrEqual(0);
- expect(1).toBeGreaterThanOrEqual(1);
- expect(0).not.toBeGreaterThanOrEqual(1);
-
- expect(1n).toBeGreaterThanOrEqual(0n);
- expect(1n).toBeGreaterThanOrEqual(1n);
- expect(0n).not.toBeGreaterThanOrEqual(1n);
-
- [
- ["foo", 0],
- [0, "foo"],
- [0, 0n],
- [0n, 0],
- ].forEach(arr => {
- expect(() => {
- expect(arr[0]).toBeGreaterThanOrEqual(arr[1]);
- }).toThrow(ExpectationError);
- });
-});
-
-test("toContain", () => {
- expect([1, 2, 3]).toContain(1);
- expect([1, 2, 3]).toContain(2);
- expect([1, 2, 3]).toContain(3);
- expect([{ foo: 1 }]).not.toContain({ foo: 1 });
-});
-
-test("toContainEqual", () => {
- expect([1, 2, 3]).toContainEqual(1);
- expect([1, 2, 3]).toContainEqual(2);
- expect([1, 2, 3]).toContainEqual(3);
- expect([{ foo: 1 }]).toContainEqual({ foo: 1 });
-});
-
-test("toEqual", () => {
- expect(undefined).toEqual(undefined);
- expect(null).toEqual(null);
- expect(undefined).not.toEqual(null);
- expect(null).not.toEqual(undefined);
- expect(NaN).toEqual(NaN);
-
- expect(1).toEqual(1);
- expect("abcd").toEqual("abcd");
-
- let s = Symbol();
- expect(s).toEqual(s);
- expect(Symbol()).not.toEqual(Symbol());
- expect(Symbol.for("foo")).toEqual(Symbol.for("foo"));
-
- expect({ foo: 1, bar: { baz: [1, 2, 3] } }).toEqual({ foo: 1, bar: { baz: [1, 2, 3] } });
- expect([1, 2, { foo: 1 }, [3, [4, 5]]]).toEqual([1, 2, { foo: 1 }, [3, [4, 5]]]);
-
- function foo() {}
- expect(foo).toEqual(foo);
- expect(function () {}).not.toEqual(function () {});
-});
-
-test("toThrow", () => {
- expect(() => {}).not.toThrow();
- expect(() => {}).not.toThrow("foo");
- expect(() => {}).not.toThrow(TypeError);
- expect(() => {}).not.toThrow(new TypeError("foo"));
-
- let thrower = () => {
- throw new TypeError("foo bar");
- };
-
- expect(thrower).toThrow();
- expect(thrower).toThrow(TypeError);
- expect(thrower).toThrow("o ba");
- expect(thrower).toThrow("foo bar");
- expect(thrower).not.toThrow("baz");
- expect(thrower).not.toThrow(ReferenceError);
- expect(thrower).toThrow(new TypeError("foo bar"));
- expect(thrower).not.toThrow(new TypeError("o ba"));
- expect(thrower).toThrow(new ReferenceError("foo bar"));
- expect(thrower).toThrow({ message: "foo bar" });
-});
-
-test("pass", () => {
- expect().pass();
- expect({}).pass();
-});
-
-test("fail", () => {
- // FIXME: Doesn't really make sense; this is a great candidate
- // for expect.assertions()
- try {
- expect().fail();
- } catch (e) {
- expect(e.name).toBe("ExpectationError");
- }
-});
-
-test("toThrowWithMessage", () => {
- let incorrectUsages = [
- [1, undefined, undefined],
- [() => {}, undefined, undefined],
- [() => {}, function () {}, undefined],
- [() => {}, undefined, "test"],
- ];
-
- incorrectUsages.forEach(arr => {
- expect(() => {
- expect(arr[0]).toThrowWithMessage(arr[1], arr[2]);
- }).toThrow();
- });
-
- let thrower = () => {
- throw new TypeError("foo bar");
- };
-
- expect(thrower).toThrowWithMessage(TypeError, "foo bar");
- expect(thrower).toThrowWithMessage(TypeError, "foo");
- expect(thrower).toThrowWithMessage(TypeError, "o ba");
- expect(thrower).not.toThrowWithMessage(ReferenceError, "foo bar");
- expect(thrower).not.toThrowWithMessage(TypeError, "foo baz");
-});
-
-test("toEval", () => {
- expect("let a = 1").toEval();
- expect("a < 1").toEval();
- expect("&&*^%#%@").not.toEval();
- expect("function foo() { return 1; }; foo();").toEval();
-});
-
-// FIXME: Will have to change when this matcher changes to use the
-// "eval" function
-test("toEvalTo", () => {
- expect("let a = 1").toEvalTo();
- expect("let a = 1").toEvalTo(undefined);
- expect("return 10").toEvalTo(10);
- expect("return 10").not.toEvalTo(5);
-
- expect(() => {
- expect("*^&%%").not.toEvalTo();
- }).toThrow();
-});
-
-test("toHaveConfigurableProperty", () => {
- expect({ foo: 1 }).toHaveConfigurableProperty("foo");
-
- expect(() => {
- expect({ foo: 1 }).not.toHaveConfigurableProperty("bar");
- }).toThrow();
-
- let o = {};
- Object.defineProperty(o, "foo", { configurable: true, value: 1 });
- Object.defineProperty(o, "bar", { configurable: false, value: 1 });
- expect(o).toHaveConfigurableProperty("foo");
- expect(o).not.toHaveConfigurableProperty("bar");
-});
-
-test("toHaveEnumerableProperty", () => {
- expect({ foo: 1 }).toHaveEnumerableProperty("foo");
-
- expect(() => {
- expect({ foo: 1 }).not.toHaveEnumerableProperty("bar");
- }).toThrow();
-
- let o = {};
- Object.defineProperty(o, "foo", { enumerable: true, value: 1 });
- Object.defineProperty(o, "bar", { enumerable: false, value: 1 });
- expect(o).toHaveEnumerableProperty("foo");
- expect(o).not.toHaveEnumerableProperty("bar");
-});
-
-test("toHaveWritableProperty", () => {
- expect({ foo: 1 }).toHaveWritableProperty("foo");
-
- expect(() => {
- expect({ foo: 1 }).not.toHaveWritableProperty("bar");
- }).toThrow();
-
- let o = {};
- Object.defineProperty(o, "foo", { writable: true, value: 1 });
- Object.defineProperty(o, "bar", { writable: false, value: 1 });
- expect(o).toHaveWritableProperty("foo");
- expect(o).not.toHaveWritableProperty("bar");
-});
-
-test("toHaveGetterProperty", () => {
- expect(() => {
- expect({ foo: 1 }).not.toHaveGetterProperty("bar");
- }).toThrow();
-
- let o = {};
- Object.defineProperty(o, "foo", {
- get() {
- return 1;
- },
- });
- Object.defineProperty(o, "bar", { value: 1 });
- expect(o).toHaveGetterProperty("foo");
- expect(o).not.toHaveGetterProperty("bar");
-});
-
-test("toHaveSetterProperty", () => {
- expect(() => {
- expect({ foo: 1 }).not.toHaveSetterProperty("bar");
- }).toThrow();
-
- let o = {};
- Object.defineProperty(o, "foo", { set(_) {} });
- Object.defineProperty(o, "bar", { value: 1 });
- expect(o).toHaveSetterProperty("foo");
- expect(o).not.toHaveSetterProperty("bar");
-});
diff --git a/Libraries/LibJS/Tests/test-common.js b/Libraries/LibJS/Tests/test-common.js
deleted file mode 100644
index 4e6d0e62e0..0000000000
--- a/Libraries/LibJS/Tests/test-common.js
+++ /dev/null
@@ -1,462 +0,0 @@
-let describe;
-let test;
-let expect;
-
-// Stores the results of each test and suite. Has a terrible
-// name to avoid name collision.
-let __TestResults__ = {};
-
-// So test names like "toString" don't automatically produce an error
-Object.setPrototypeOf(__TestResults__, null);
-
-// This array is used to communicate with the C++ program. It treats
-// each message in this array as a separate message. Has a terrible
-// name to avoid name collision.
-let __UserOutput__ = [];
-
-// We also rebind console.log here to use the array above
-console.log = (...args) => {
- __UserOutput__.push(args.join(" "));
-};
-
-class ExpectationError extends Error {
- constructor(message, fileName, lineNumber) {
- super(message, fileName, lineNumber);
- this.name = "ExpectationError";
- }
-}
-
-// Use an IIFE to avoid polluting the global namespace as much as possible
-(() => {
- // FIXME: This is a very naive deepEquals algorithm
- const deepEquals = (a, b) => {
- if (Array.isArray(a)) return Array.isArray(b) && deepArrayEquals(a, b);
- if (typeof a === "object") return typeof b === "object" && deepObjectEquals(a, b);
- return Object.is(a, b);
- };
-
- const deepArrayEquals = (a, b) => {
- if (a.length !== b.length) return false;
- for (let i = 0; i < a.length; ++i) {
- if (!deepEquals(a[i], b[i])) return false;
- }
- return true;
- };
-
- const deepObjectEquals = (a, b) => {
- if (a === null) return b === null;
- for (let key of Reflect.ownKeys(a)) {
- if (!deepEquals(a[key], b[key])) return false;
- }
- return true;
- };
-
- class Expector {
- constructor(target, inverted) {
- this.target = target;
- this.inverted = !!inverted;
- }
-
- get not() {
- return new Expector(this.target, !this.inverted);
- }
-
- toBe(value) {
- this.__doMatcher(() => {
- this.__expect(
- Object.is(this.target, value),
- () =>
- "toBe: expected _" + String(value) + "_, got _" + String(this.target) + "_"
- );
- });
- }
-
- // FIXME: Take a precision argument like jest's toBeCloseTo matcher
- toBeCloseTo(value) {
- this.__expect(
- typeof this.target === "number",
- () => "toBeCloseTo: target not of type number"
- );
- this.__expect(
- typeof value === "number",
- () => "toBeCloseTo: argument not of type number"
- );
-
- this.__doMatcher(() => {
- this.__expect(Math.abs(this.target - value) < 0.000001);
- });
- }
-
- toHaveLength(length) {
- this.__expect(
- typeof this.target.length === "number",
- () => "toHaveLength: target.length not of type number"
- );
-
- this.__doMatcher(() => {
- this.__expect(Object.is(this.target.length, length));
- });
- }
-
- toHaveProperty(property, value) {
- this.__doMatcher(() => {
- let object = this.target;
-
- if (typeof property === "string" && property.includes(".")) {
- let propertyArray = [];
-
- while (property.includes(".")) {
- let index = property.indexOf(".");
- propertyArray.push(property.substring(0, index));
- if (index + 1 >= property.length) break;
- property = property.substring(index + 1, property.length);
- }
-
- propertyArray.push(property);
-
- property = propertyArray;
- }
-
- if (Array.isArray(property)) {
- for (let key of property) {
- this.__expect(object !== undefined && object !== null);
- object = object[key];
- }
- } else {
- object = object[property];
- }
-
- this.__expect(object !== undefined);
- if (value !== undefined) this.__expect(deepEquals(object, value));
- });
- }
-
- toBeDefined() {
- this.__doMatcher(() => {
- this.__expect(this.target !== undefined, () => "toBeDefined: target was undefined");
- });
- }
-
- toBeInstanceOf(class_) {
- this.__doMatcher(() => {
- this.__expect(this.target instanceof class_);
- });
- }
-
- toBeNull() {
- this.__doMatcher(() => {
- this.__expect(this.target === null);
- });
- }
-
- toBeUndefined() {
- this.__doMatcher(() => {
- this.__expect(
- this.target === undefined,
- () => "toBeUndefined: target was not undefined"
- );
- });
- }
-
- toBeNaN() {
- this.__doMatcher(() => {
- this.__expect(
- isNaN(this.target),
- () => "toBeNaN: target was _" + String(this.target) + "_, not NaN"
- );
- });
- }
-
- toBeTrue() {
- this.__doMatcher(() => {
- this.__expect(this.target === true);
- });
- }
-
- toBeFalse() {
- this.__doMatcher(() => {
- this.__expect(this.target === false);
- });
- }
-
- __validateNumericComparisonTypes(value) {
- this.__expect(typeof this.target === "number" || typeof this.target === "bigint");
- this.__expect(typeof value === "number" || typeof value === "bigint");
- this.__expect(typeof this.target === typeof value);
- }
-
- toBeLessThan(value) {
- this.__validateNumericComparisonTypes(value);
-
- this.__doMatcher(() => {
- this.__expect(this.target < value);
- });
- }
-
- toBeLessThanOrEqual(value) {
- this.__validateNumericComparisonTypes(value);
-
- this.__doMatcher(() => {
- this.__expect(this.target <= value);
- });
- }
-
- toBeGreaterThan(value) {
- this.__validateNumericComparisonTypes(value);
-
- this.__doMatcher(() => {
- this.__expect(this.target > value);
- });
- }
-
- toBeGreaterThanOrEqual(value) {
- this.__validateNumericComparisonTypes(value);
-
- this.__doMatcher(() => {
- this.__expect(this.target >= value);
- });
- }
-
- toContain(item) {
- this.__doMatcher(() => {
- for (let element of this.target) {
- if (item === element) return;
- }
-
- throw new ExpectationError();
- });
- }
-
- toContainEqual(item) {
- this.__doMatcher(() => {
- for (let element of this.target) {
- if (deepEquals(item, element)) return;
- }
-
- throw new ExpectationError();
- });
- }
-
- toEqual(value) {
- this.__doMatcher(() => {
- this.__expect(deepEquals(this.target, value));
- });
- }
-
- toThrow(value) {
- this.__expect(typeof this.target === "function");
- this.__expect(
- typeof value === "string" ||
- typeof value === "function" ||
- typeof value === "object" ||
- value === undefined
- );
-
- this.__doMatcher(() => {
- let threw = true;
- try {
- this.target();
- threw = false;
- } catch (e) {
- if (typeof value === "string") {
- this.__expect(e.message.includes(value));
- } else if (typeof value === "function") {
- this.__expect(e instanceof value);
- } else if (typeof value === "object") {
- this.__expect(e.message === value.message);
- }
- }
- this.__expect(threw);
- });
- }
-
- pass(message) {
- // FIXME: This does nothing. If we want to implement things
- // like assertion count, this will have to do something
- }
-
- // jest-extended
- fail(message) {
- this.__doMatcher(() => {
- this.__expect(false, message);
- });
- }
-
- // jest-extended
- toThrowWithMessage(class_, message) {
- this.__expect(typeof this.target === "function");
- this.__expect(class_ !== undefined);
- this.__expect(message !== undefined);
-
- this.__doMatcher(() => {
- try {
- this.target();
- this.__expect(false);
- } catch (e) {
- this.__expect(e instanceof class_);
- this.__expect(e.message.includes(message));
- }
- });
- }
-
- // Test for syntax errors; target must be a string
- toEval() {
- this.__expect(typeof this.target === "string");
- const success = canParseSource(this.target);
- this.__expect(this.inverted ? !success : success);
- }
-
- // Must compile regardless of inverted-ness
- toEvalTo(value) {
- this.__expect(typeof this.target === "string");
-
- let result;
-
- try {
- result = new Function(this.target)();
- } catch (e) {
- throw new ExpectationError();
- }
-
- this.__doMatcher(() => {
- this.__expect(deepEquals(value, result));
- });
- }
-
- toHaveConfigurableProperty(property) {
- this.__expect(this.target !== undefined && this.target !== null);
- let d = Object.getOwnPropertyDescriptor(this.target, property);
- this.__expect(d !== undefined);
-
- this.__doMatcher(() => {
- this.__expect(d.configurable);
- });
- }
-
- toHaveEnumerableProperty(property) {
- this.__expect(this.target !== undefined && this.target !== null);
- let d = Object.getOwnPropertyDescriptor(this.target, property);
- this.__expect(d !== undefined);
-
- this.__doMatcher(() => {
- this.__expect(d.enumerable);
- });
- }
-
- toHaveWritableProperty(property) {
- this.__expect(this.target !== undefined && this.target !== null);
- let d = Object.getOwnPropertyDescriptor(this.target, property);
- this.__expect(d !== undefined);
-
- this.__doMatcher(() => {
- this.__expect(d.writable);
- });
- }
-
- toHaveValueProperty(property, value) {
- this.__expect(this.target !== undefined && this.target !== null);
- let d = Object.getOwnPropertyDescriptor(this.target, property);
- this.__expect(d !== undefined);
-
- this.__doMatcher(() => {
- this.__expect(d.value !== undefined);
- if (value !== undefined) this.__expect(deepEquals(value, d.value));
- });
- }
-
- toHaveGetterProperty(property) {
- this.__expect(this.target !== undefined && this.target !== null);
- let d = Object.getOwnPropertyDescriptor(this.target, property);
- this.__expect(d !== undefined);
-
- this.__doMatcher(() => {
- this.__expect(d.get !== undefined);
- });
- }
-
- toHaveSetterProperty(property) {
- this.__expect(this.target !== undefined && this.target !== null);
- let d = Object.getOwnPropertyDescriptor(this.target, property);
- this.__expect(d !== undefined);
-
- this.__doMatcher(() => {
- this.__expect(d.set !== undefined);
- });
- }
-
- __doMatcher(matcher) {
- if (!this.inverted) {
- matcher();
- } else {
- let threw = false;
- try {
- matcher();
- } catch (e) {
- if (e.name === "ExpectationError") threw = true;
- }
- if (!threw) throw new ExpectationError("not: test didn't fail");
- }
- }
-
- __expect(value, details) {
- if (value !== true) {
- if (details !== undefined) {
- throw new ExpectationError(details());
- } else {
- throw new ExpectationError();
- }
- }
- }
- }
-
- expect = value => new Expector(value);
-
- // describe is able to lump test results inside of it by using this context
- // variable. Top level tests have the default suite message
- const defaultSuiteMessage = "__$$TOP_LEVEL$$__";
- let suiteMessage = defaultSuiteMessage;
-
- describe = (message, callback) => {
- suiteMessage = message;
- callback();
- suiteMessage = defaultSuiteMessage;
- };
-
- test = (message, callback) => {
- if (!__TestResults__[suiteMessage]) __TestResults__[suiteMessage] = {};
-
- const suite = __TestResults__[suiteMessage];
- if (suite[message]) {
- suite[message] = {
- result: "fail",
- };
- return;
- }
-
- try {
- callback();
- suite[message] = {
- result: "pass",
- };
- } catch (e) {
- suite[message] = {
- result: "fail",
- details: String(e),
- };
- }
- };
-
- test.skip = (message, callback) => {
- if (typeof callback !== "function")
- throw new Error("test.skip has invalid second argument (must be a function)");
-
- if (!__TestResults__[suiteMessage]) __TestResults__[suiteMessage] = {};
-
- const suite = __TestResults__[suiteMessage];
- if (suite[message]) throw new Error("Duplicate test name: " + message);
-
- suite[message] = {
- result: "skip",
- };
- };
-})();
diff --git a/Libraries/LibJS/Tests/throw-basic.js b/Libraries/LibJS/Tests/throw-basic.js
deleted file mode 100644
index b393763d92..0000000000
--- a/Libraries/LibJS/Tests/throw-basic.js
+++ /dev/null
@@ -1,34 +0,0 @@
-test("throw literal", () => {
- try {
- throw 1;
- expect().fail();
- } catch (e) {
- if (e.name === "ExpectationError") throw e;
- expect(e).toBe(1);
- }
-});
-
-test("throw array", () => {
- try {
- throw [99];
- expect().fail();
- } catch (e) {
- if (e.name === "ExpectationError") throw e;
- expect(e).toEqual([99]);
- }
-});
-
-test("call function that throws", () => {
- function foo() {
- throw "hello";
- expect().fail();
- }
-
- try {
- foo();
- expect().fail();
- } catch (e) {
- if (e.name === "ExpectationError") throw e;
- expect(e).toBe("hello");
- }
-});
diff --git a/Libraries/LibJS/Tests/to-number-basic.js b/Libraries/LibJS/Tests/to-number-basic.js
deleted file mode 100644
index 4509537839..0000000000
--- a/Libraries/LibJS/Tests/to-number-basic.js
+++ /dev/null
@@ -1,75 +0,0 @@
-test("non-numeric primitives", () => {
- expect(+false).toBe(0);
- expect(-false).toBe(-0);
- expect(+true).toBe(1);
- expect(-true).toBe(-1);
- expect(+null).toBe(0);
- expect(-null).toBe(-0);
- expect(+undefined).toBeNaN();
- expect(-undefined).toBeNaN();
-});
-
-test("arrays", () => {
- expect(+[]).toBe(0);
- expect(-[]).toBe(-0);
- expect(+[,]).toBe(0);
- expect(-[,]).toBe(-0);
- expect(+[null]).toBe(0);
- expect(-[null]).toBe(-0);
- expect(+[undefined]).toBe(0);
- expect(-[undefined]).toBe(-0);
- expect(+[[[[[]]]]]).toBe(0);
- expect(-[[[[[]]]]]).toBe(-0);
- expect(+[[[[[42]]]]]).toBe(42);
- expect(-[[[[[42]]]]]).toBe(-42);
-
- expect(+[, , ,]).toBeNaN();
- expect(-[, , ,]).toBeNaN();
- expect(+[undefined, undefined]).toBeNaN();
- expect(-[undefined, undefined]).toBeNaN();
- expect(+[1, 2, 3]).toBeNaN();
- expect(-[1, 2, 3]).toBeNaN();
- expect(+[[[["foo"]]]]).toBeNaN();
- expect(-[[[["foo"]]]]).toBeNaN();
-});
-
-test("strings", () => {
- expect(+"").toBe(0);
- expect(-"").toBe(-0);
- expect(+"42").toBe(42);
- expect(-"42").toBe(-42);
- expect(+"1.23").toBe(1.23);
- expect(-"1.23").toBe(-1.23);
-
- expect(+"foo").toBeNaN();
- expect(-"foo").toBeNaN();
-});
-
-test("numbers", () => {
- expect(+42).toBe(42);
- expect(-42).toBe(-42);
- expect(+1.23).toBe(1.23);
- expect(-1.23).toBe(-1.23);
-});
-
-test("infinity", () => {
- expect(+"Infinity").toBe(Infinity);
- expect(+"+Infinity").toBe(Infinity);
- expect(+"-Infinity").toBe(-Infinity);
- expect(-"Infinity").toBe(-Infinity);
- expect(-"+Infinity").toBe(-Infinity);
- expect(-"-Infinity").toBe(Infinity);
-});
-
-test("space and space-like escapes", () => {
- expect(+" \r \t \n ").toBe(0);
- expect(+" \n \t Infinity \r ").toBe(Infinity);
- expect(+"\r \n1.23 \t\t\t \n").toBe(1.23);
-});
-
-test("object literals", () => {
- expect(+{}).toBeNaN();
- expect(-{}).toBeNaN();
- expect(+{ a: 1 }).toBeNaN();
- expect(-{ a: 1 }).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/to-number-exception.js b/Libraries/LibJS/Tests/to-number-exception.js
deleted file mode 100644
index b9247d9636..0000000000
--- a/Libraries/LibJS/Tests/to-number-exception.js
+++ /dev/null
@@ -1,25 +0,0 @@
-const message = "oops, Value::to_number() failed";
-
-const o = {
- toString() {
- throw new Error(message);
- },
-};
-
-test("basic functionality", () => {
- expect(() => {
- +o;
- }).toThrowWithMessage(Error, message);
-
- expect(() => {
- o - 1;
- }).toThrowWithMessage(Error, message);
-
- expect(() => {
- "foo".charAt(o);
- }).toThrowWithMessage(Error, message);
-
- expect(() => {
- "bar".repeat(o);
- }).toThrowWithMessage(Error, message);
-});
diff --git a/Libraries/LibJS/Tests/try-catch-finally-nested.js b/Libraries/LibJS/Tests/try-catch-finally-nested.js
deleted file mode 100644
index da9ad2d438..0000000000
--- a/Libraries/LibJS/Tests/try-catch-finally-nested.js
+++ /dev/null
@@ -1,55 +0,0 @@
-test("Nested try/catch/finally with exceptions", () => {
- // This test uses a combination of boolean "checkpoint" flags
- // and expect().fail() to ensure certain code paths have been
- // reached and others haven't.
- var level1TryHasBeenExecuted = false;
- var level1CatchHasBeenExecuted = false;
- var level1FinallyHasBeenExecuted = false;
- var level2TryHasBeenExecuted = false;
- var level2CatchHasBeenExecuted = false;
- var level3TryHasBeenExecuted = false;
- var level3CatchHasBeenExecuted = false;
- var level3FinallyHasBeenExecuted = false;
- expect(() => {
- try {
- level1TryHasBeenExecuted = true;
- foo();
- expect().fail();
- } catch (e) {
- level1CatchHasBeenExecuted = true;
- try {
- level2TryHasBeenExecuted = true;
- try {
- level3TryHasBeenExecuted = true;
- bar();
- expect().fail();
- } catch (e) {
- level3CatchHasBeenExecuted = true;
- } finally {
- level3FinallyHasBeenExecuted = true;
- baz();
- expect().fail();
- }
- expect().fail();
- } catch (e) {
- level2CatchHasBeenExecuted = true;
- qux();
- expect().fail();
- }
- expect().fail();
- } finally {
- level1FinallyHasBeenExecuted = true;
- throw Error("Error in final finally");
- expect().fail();
- }
- expect().fail();
- }).toThrow(Error, "Error in final finally");
- expect(level1TryHasBeenExecuted).toBeTrue();
- expect(level1CatchHasBeenExecuted).toBeTrue();
- expect(level1FinallyHasBeenExecuted).toBeTrue();
- expect(level2TryHasBeenExecuted).toBeTrue();
- expect(level2CatchHasBeenExecuted).toBeTrue();
- expect(level3TryHasBeenExecuted).toBeTrue();
- expect(level3CatchHasBeenExecuted).toBeTrue();
- expect(level3FinallyHasBeenExecuted).toBeTrue();
-});
diff --git a/Libraries/LibJS/Tests/try-catch-finally.js b/Libraries/LibJS/Tests/try-catch-finally.js
deleted file mode 100644
index 1ff0104734..0000000000
--- a/Libraries/LibJS/Tests/try-catch-finally.js
+++ /dev/null
@@ -1,172 +0,0 @@
-test("try/catch without exception", () => {
- var tryHasBeenExecuted = false;
- var catchHasBeenExecuted = false;
- try {
- tryHasBeenExecuted = true;
- } catch (e) {
- catchHasBeenExecuted = true;
- }
- expect(tryHasBeenExecuted).toBeTrue();
- expect(catchHasBeenExecuted).toBeFalse();
-});
-
-test("try/catch with exception in try", () => {
- var tryHasBeenExecuted = false;
- var catchHasBeenExecuted = false;
- var tryError = Error("Error in try");
- try {
- tryHasBeenExecuted = true;
- throw tryError;
- expect().fail();
- } catch (e) {
- catchHasBeenExecuted = true;
- expect(e).toBe(tryError);
- }
- expect(tryHasBeenExecuted).toBeTrue();
- expect(catchHasBeenExecuted).toBeTrue();
-});
-
-test("try/catch with exception in try and catch", () => {
- var tryHasBeenExecuted = false;
- var catchHasBeenExecuted = false;
- var tryError = Error("Error in try");
- var catchError = Error("Error in catch");
- expect(() => {
- try {
- tryHasBeenExecuted = true;
- throw tryError;
- expect().fail();
- } catch (e) {
- catchHasBeenExecuted = true;
- expect(e).toBe(tryError);
- throw catchError;
- expect().fail();
- }
- }).toThrow(Error, "Error in catch");
- expect(tryHasBeenExecuted).toBeTrue();
- expect(catchHasBeenExecuted).toBeTrue();
-});
-
-test("try/catch/finally without exception", () => {
- var tryHasBeenExecuted = false;
- var catchHasBeenExecuted = false;
- var finallyHasBeenExecuted = false;
- try {
- tryHasBeenExecuted = true;
- } catch (e) {
- catchHasBeenExecuted = true;
- } finally {
- finallyHasBeenExecuted = true;
- }
- expect(tryHasBeenExecuted).toBeTrue();
- expect(catchHasBeenExecuted).toBeFalse();
- expect(finallyHasBeenExecuted).toBeTrue();
-});
-
-test("try/catch/finally with exception in try and catch", () => {
- var tryHasBeenExecuted = false;
- var catchHasBeenExecuted = false;
- var finallyHasBeenExecuted = false;
- var tryError = Error("Error in try");
- var catchError = Error("Error in catch");
- expect(() => {
- try {
- tryHasBeenExecuted = true;
- throw tryError;
- expect().fail();
- } catch (e) {
- catchHasBeenExecuted = true;
- expect(e).toBe(tryError);
- throw catchError;
- expect().fail();
- } finally {
- finallyHasBeenExecuted = true;
- }
- }).toThrow(Error, "Error in catch");
- expect(tryHasBeenExecuted).toBeTrue();
- expect(catchHasBeenExecuted).toBeTrue();
- expect(finallyHasBeenExecuted).toBeTrue();
-});
-
-test("try/catch/finally with exception in finally", () => {
- var tryHasBeenExecuted = false;
- var catchHasBeenExecuted = false;
- var finallyHasBeenExecuted = false;
- var finallyError = Error("Error in finally");
- expect(() => {
- try {
- tryHasBeenExecuted = true;
- } catch (e) {
- catchHasBeenExecuted = true;
- } finally {
- finallyHasBeenExecuted = true;
- throw finallyError;
- expect().fail();
- }
- }).toThrow(Error, "Error in finally");
- expect(tryHasBeenExecuted).toBeTrue();
- expect(catchHasBeenExecuted).toBeFalse();
- expect(finallyHasBeenExecuted).toBeTrue();
-});
-
-test("try/catch/finally with exception in try and finally", () => {
- var tryHasBeenExecuted = false;
- var catchHasBeenExecuted = false;
- var finallyHasBeenExecuted = false;
- var tryError = Error("Error in try");
- var finallyError = Error("Error in finally");
- expect(() => {
- try {
- tryHasBeenExecuted = true;
- throw tryError;
- expect().fail();
- } catch (e) {
- catchHasBeenExecuted = true;
- expect(e).toBe(tryError);
- } finally {
- finallyHasBeenExecuted = true;
- throw finallyError;
- expect().fail();
- }
- }).toThrow(Error, "Error in finally");
- expect(tryHasBeenExecuted).toBeTrue();
- expect(catchHasBeenExecuted).toBeTrue();
- expect(finallyHasBeenExecuted).toBeTrue();
-});
-
-test("try/catch/finally with exception in try, catch and finally", () => {
- var tryHasBeenExecuted = false;
- var catchHasBeenExecuted = false;
- var finallyHasBeenExecuted = false;
- var tryError = Error("Error in try");
- var catchError = Error("Error in catch");
- var finallyError = Error("Error in finally");
- expect(() => {
- try {
- tryHasBeenExecuted = true;
- throw tryError;
- expect().fail();
- } catch (e) {
- catchHasBeenExecuted = true;
- expect(e).toBe(tryError);
- throw catchError;
- expect().fail();
- } finally {
- finallyHasBeenExecuted = true;
- throw finallyError;
- expect().fail();
- }
- }).toThrow(Error, "Error in finally");
- expect(tryHasBeenExecuted).toBeTrue();
- expect(catchHasBeenExecuted).toBeTrue();
- expect(finallyHasBeenExecuted).toBeTrue();
-});
-
-test("try statement must have either 'catch' or 'finally' clause", () => {
- expect("try {} catch {}").toEval();
- expect("try {} catch (e) {}").toEval();
- expect("try {} finally {}").toEval();
- expect("try {} catch {} finally {}").toEval();
- expect("try {} catch (e) {} finally {}").toEval();
- expect("try {}").not.toEval();
-});
diff --git a/Libraries/LibJS/Tests/update-expression-on-member-expression.js b/Libraries/LibJS/Tests/update-expression-on-member-expression.js
deleted file mode 100644
index e9a29d6ea2..0000000000
--- a/Libraries/LibJS/Tests/update-expression-on-member-expression.js
+++ /dev/null
@@ -1,8 +0,0 @@
-test("basic update expression", () => {
- const o = {};
- o.f = 1;
-
- expect(o.f++).toBe(1);
- expect(++o.f).toBe(3);
- expect(++o.missing).toBeNaN();
-});
diff --git a/Libraries/LibJS/Tests/update-expressions-basic.js b/Libraries/LibJS/Tests/update-expressions-basic.js
deleted file mode 100644
index 5eacc6a069..0000000000
--- a/Libraries/LibJS/Tests/update-expressions-basic.js
+++ /dev/null
@@ -1,53 +0,0 @@
-describe("correct behavior", () => {
- test("basic functionality", () => {
- let n = 0;
- expect(++n).toBe(1);
- expect(n).toBe(1);
-
- n = 0;
- expect(n++).toBe(0);
- expect(n).toBe(1);
-
- n = 0;
- expect(--n).toBe(-1);
- expect(n).toBe(-1);
-
- n = 0;
- expect(n--).toBe(0);
- expect(n).toBe(-1);
-
- let a = [];
- expect(a++).toBe(0);
- expect(a).toBe(1);
-
- let b = true;
- expect(b--).toBe(1);
- expect(b).toBe(0);
- });
-
- test("updates that produce NaN", () => {
- let s = "foo";
- expect(++s).toBeNaN();
- expect(s).toBeNaN();
-
- s = "foo";
- expect(s++).toBeNaN();
- expect(s).toBeNaN();
-
- s = "foo";
- expect(--s).toBeNaN();
- expect(s).toBeNaN();
-
- s = "foo";
- expect(s--).toBeNaN();
- expect(s).toBeNaN();
- });
-});
-
-describe("errors", () => {
- test("update expression throws reference error", () => {
- expect(() => {
- ++x;
- }).toThrowWithMessage(ReferenceError, "'x' is not defined");
- });
-});
diff --git a/Libraries/LibJS/Tests/use-strict-directive.js b/Libraries/LibJS/Tests/use-strict-directive.js
deleted file mode 100644
index c0bbd2ed9e..0000000000
--- a/Libraries/LibJS/Tests/use-strict-directive.js
+++ /dev/null
@@ -1,61 +0,0 @@
-test("valid 'use strict; directive", () => {
- expect(
- (() => {
- "use strict";
- return isStrictMode();
- })()
- ).toBeTrue();
- expect(
- // prettier-ignore
- (() => {
- 'use strict';
- return isStrictMode();
- })()
- ).toBeTrue();
-});
-
-test("invalid 'use strict; directive", () => {
- expect(
- (() => {
- " use strict ";
- return isStrictMode();
- })()
- ).toBeFalse();
- expect(
- (() => {
- `use strict`;
- return isStrictMode();
- })()
- ).toBeFalse();
- expect(
- (() => {
- "use\
- strict";
- return isStrictMode();
- })()
- ).toBeFalse();
- expect(
- (() => {
- "use\ strict";
- return isStrictMode();
- })()
- ).toBeFalse();
- expect(
- (() => {
- "use \163trict";
- return isStrictMode();
- })()
- ).toBeFalse();
- expect(
- (() => {
- `"use strict"`;
- return isStrictMode();
- })()
- ).toBeFalse();
- expect(
- (() => {
- "use strict" + 1;
- return isStrictMode();
- })()
- ).toBeFalse();
-});
diff --git a/Libraries/LibJS/Tests/var-multiple-declarator.js b/Libraries/LibJS/Tests/var-multiple-declarator.js
deleted file mode 100644
index ba40d09b9e..0000000000
--- a/Libraries/LibJS/Tests/var-multiple-declarator.js
+++ /dev/null
@@ -1,8 +0,0 @@
-test("basic functionality", () => {
- var a = 1,
- b = 2,
- c = a + b;
- expect(a).toBe(1);
- expect(b).toBe(2);
- expect(c).toBe(3);
-});
diff --git a/Libraries/LibJS/Tests/var-scoping.js b/Libraries/LibJS/Tests/var-scoping.js
deleted file mode 100644
index 86c5f1d5c7..0000000000
--- a/Libraries/LibJS/Tests/var-scoping.js
+++ /dev/null
@@ -1,17 +0,0 @@
-test("basic functionality", () => {
- function foo() {
- i = 3;
- expect(i).toBe(3);
- var i;
- }
-
- foo();
-
- var caught_exception;
- try {
- j = i;
- } catch (e) {
- caught_exception = e;
- }
- expect(caught_exception).not.toBeUndefined();
-});
diff --git a/Libraries/LibJS/Tests/variable-undefined.js b/Libraries/LibJS/Tests/variable-undefined.js
deleted file mode 100644
index 4399d5332d..0000000000
--- a/Libraries/LibJS/Tests/variable-undefined.js
+++ /dev/null
@@ -1,14 +0,0 @@
-test("basic functionality", () => {
- function foo(a) {
- return a;
- }
-
- var x = undefined;
- expect(x).toBeUndefined();
- expect(foo(x)).toBeUndefined();
-
- var o = {};
- o.x = x;
- expect(o.x).toBeUndefined();
- expect(o.x).toBe(x);
-});
diff --git a/Libraries/LibJS/Tests/with-basic.js b/Libraries/LibJS/Tests/with-basic.js
deleted file mode 100644
index c2ef01698b..0000000000
--- a/Libraries/LibJS/Tests/with-basic.js
+++ /dev/null
@@ -1,24 +0,0 @@
-test("basic with statement functionality", () => {
- var object = { foo: 5, bar: 6, baz: 7 };
- var qux = 1;
-
- var bar = 99;
-
- with (object) {
- expect(foo).toBe(5);
- expect(bar).toBe(6);
- expect(baz).toBe(7);
- expect(qux).toBe(1);
- expect(typeof quz).toBe("undefined");
-
- bar = 2;
- }
-
- expect(object.bar).toBe(2);
-
- expect(bar).toBe(99);
-});
-
-test("syntax error in strict mode", () => {
- expect("'use strict'; with (foo) {}").not.toEval();
-});