Skip to content

Commit a4298a2

Browse files
committed
test some entries
1 parent 48b58dd commit a4298a2

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

scripts/build-entries/entries-definitions.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,7 @@ export const features = {
22702270
},
22712271
'regexp/exec': {
22722272
modules: ['es.regexp.exec'],
2273-
template: $prototype,
2273+
template: $justImport,
22742274
namespace: 'RegExp',
22752275
name: 'exec',
22762276
injectOn: 'instance',

tests/entries/unit.mjs

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ for (PATH of ['@core-js/pure', 'core-js']) {
1717
for (const NS of ['es', 'stable', 'actual', 'full']) {
1818
let O;
1919
ok(load(NS, 'global-this').Math === Math);
20+
ok(new (load(NS, 'aggregate-error/constructor'))([42]).errors[0] === 42);
2021
ok(new (load(NS, 'aggregate-error'))([42]).errors[0] === 42);
2122
ok(load(NS, 'object/assign')({ q: 1 }, { w: 2 }).w === 2);
2223
ok(load(NS, 'object/create')(Array.prototype) instanceof Array);
@@ -241,21 +242,22 @@ for (PATH of ['@core-js/pure', 'core-js']) {
241242
ok('raw' in load(NS, 'string'));
242243
load(NS, 'regexp/constructor');
243244
ok(load(NS, 'regexp/escape')('10$') === '\\x310\\$');
244-
load(NS, 'regexp/to-string');
245+
load(NS, 'regexp/dot-all');
246+
load(NS, 'regexp/exec');
245247
ok(load(NS, 'regexp/flags')(/./g) === 'g');
246248
load(NS, 'regexp/match');
247249
load(NS, 'regexp/replace');
248250
load(NS, 'regexp/search');
249251
load(NS, 'regexp/split');
250-
load(NS, 'regexp/dot-all');
251252
load(NS, 'regexp/sticky');
252253
load(NS, 'regexp/test');
254+
load(NS, 'regexp/to-string');
253255
load(NS, 'regexp');
254256
ok(load(NS, 'json').stringify([1]) === '[1]');
255257
ok(load(NS, 'json/stringify')([1]) === '[1]');
256258
ok(load(NS, 'date/to-json')(Infinity) === null);
257259
ok(load(NS, 'date'));
258-
ok(typeof load(NS, 'symbol') == 'function');
260+
ok(typeof load(NS, 'symbol/constructor') == 'function');
259261
ok(typeof load(NS, 'symbol/for') == 'function');
260262
ok(typeof load(NS, 'symbol/key-for') == 'function');
261263
ok(Function[load(NS, 'symbol/has-instance')](it => it));
@@ -272,34 +274,46 @@ for (PATH of ['@core-js/pure', 'core-js']) {
272274
ok(load(NS, 'symbol/unscopables'));
273275
ok(load(NS, 'symbol/async-iterator'));
274276
load(NS, 'symbol/description');
275-
const Map = load(NS, 'map');
276-
ok(load(NS, 'map/group-by')([], it => it) instanceof load(NS, 'map'));
277-
const Set = load(NS, 'set');
278-
const WeakMap = load(NS, 'weak-map');
279-
const WeakSet = load(NS, 'weak-set');
277+
ok(typeof load(NS, 'symbol') == 'function');
278+
const Map = load(NS, 'map/constructor');
280279
ok(new Map([[1, 2], [3, 4]]).size === 2);
280+
const Set = load(NS, 'set/constructor');
281281
ok(new Set([1, 2, 3, 2, 1]).size === 3);
282+
const WeakMap = load(NS, 'weak-map/constructor');
282283
ok(new WeakMap([[O = {}, 42]]).get(O) === 42);
284+
const WeakSet = load(NS, 'weak-set/constructor');
283285
ok(new WeakSet([O = {}]).has(O));
286+
ok(load(NS, 'map/group-by')([], it => it) instanceof load(NS, 'map'));
284287
ok(load(NS, 'set/difference')(new Set([1, 2, 3]), new Set([3, 4, 5])).size === 2);
285288
ok(load(NS, 'set/intersection')(new Set([1, 2, 3]), new Set([1, 3, 4])).size === 2);
286289
ok(load(NS, 'set/is-disjoint-from')(new Set([1, 2, 3]), new Set([4, 5, 6])));
287290
ok(load(NS, 'set/is-subset-of')(new Set([1, 2, 3]), new Set([1, 2, 3, 4])));
288291
ok(load(NS, 'set/is-superset-of')(new Set([1, 2, 3, 4]), new Set([1, 2, 3])));
289292
ok(load(NS, 'set/symmetric-difference')(new Set([1, 2, 3]), new Set([3, 4, 5])).size === 4);
290293
ok(load(NS, 'set/union')(new Set([1, 2, 3]), new Set([3, 4, 5])).size === 5);
291-
const Promise = load(NS, 'promise');
294+
const Promise = load(NS, 'promise/constructor');
292295
ok('then' in Promise.prototype);
296+
ok(load(NS, 'promise/catch')(new Promise(resolve => resolve), it => it) instanceof Promise);
297+
ok(load(NS, 'promise/finally')(new Promise(resolve => resolve), it => it) instanceof Promise);
298+
ok(load(NS, 'promise/all')([1, 2, 3]) instanceof Promise);
293299
ok(load(NS, 'promise/all-settled')([1, 2, 3]) instanceof Promise);
294300
ok(load(NS, 'promise/any')([1, 2, 3]) instanceof Promise);
295-
ok(load(NS, 'promise/finally')(new Promise(resolve => resolve), it => it) instanceof Promise);
301+
ok(load(NS, 'promise/race')([1, 2, 3]) instanceof Promise);
302+
// eslint-disable-next-line unicorn/prefer-top-level-await, promise/prefer-await-to-callbacks, promise/prefer-await-to-then -- testing
303+
ok(load(NS, 'promise/reject')(42).then(null, error => error) instanceof Promise);
304+
ok(load(NS, 'promise/resolve')(42) instanceof Promise);
296305
ok(load(NS, 'promise/try')(() => 42) instanceof Promise);
297306
ok(load(NS, 'promise/with-resolvers')().promise instanceof load(NS, 'promise'));
307+
ok(load(NS, 'map') === Map);
308+
ok(load(NS, 'set') === Set);
309+
ok(load(NS, 'weak-map') === WeakMap);
310+
ok(load(NS, 'weak-set') === WeakSet);
311+
ok(load(NS, 'promise') === Promise);
298312
ok(load(NS, 'is-iterable')([]));
299313
ok(typeof load(NS, 'get-iterator-method')([]) == 'function');
300314
ok('next' in load(NS, 'get-iterator')([]));
301315
ok('Map' in load(NS));
302-
ok(typeof load(NS, 'iterator') == 'function');
316+
ok(typeof load(NS, 'iterator/constructor') == 'function');
303317
ok(typeof load(NS, 'iterator/drop') == 'function');
304318
ok(typeof load(NS, 'iterator/every') == 'function');
305319
ok(typeof load(NS, 'iterator/filter') == 'function');
@@ -312,9 +326,11 @@ for (PATH of ['@core-js/pure', 'core-js']) {
312326
ok(typeof load(NS, 'iterator/some') == 'function');
313327
ok(typeof load(NS, 'iterator/take') == 'function');
314328
ok(typeof load(NS, 'iterator/to-array') == 'function');
329+
ok(typeof load(NS, 'iterator') == 'function');
330+
ok(new (load(NS, 'suppressed-error/constructor'))(1, 2).suppressed === 2);
315331
ok(new (load(NS, 'suppressed-error'))(1, 2).suppressed === 2);
316-
ok(typeof load(NS, 'disposable-stack') == 'function');
317332
ok(typeof load(NS, 'disposable-stack/constructor') == 'function');
333+
ok(typeof load(NS, 'disposable-stack') == 'function');
318334
ok(load(NS, 'symbol/async-dispose'));
319335
ok(load(NS, 'symbol/dispose'));
320336
load(NS, 'async-iterator');
@@ -615,10 +631,12 @@ for (PATH of ['@core-js/pure', 'core-js']) {
615631
ok(load(NS, 'structured-clone')(42) === 42);
616632
ok(typeof load(NS, 'clear-immediate') == 'function');
617633
ok(typeof load(NS, 'queue-microtask') == 'function');
618-
ok(typeof load(NS, 'url') == 'function');
634+
ok(typeof load(NS, 'url/constructor') == 'function');
619635
ok(load(NS, 'url/can-parse')('a:b') === true);
620636
ok(load(NS, 'url/parse')('a:b').href === 'a:b');
621637
load(NS, 'url/to-json');
638+
ok(typeof load(NS, 'url') == 'function');
639+
ok(typeof load(NS, 'url-search-params/constructor') == 'function');
622640
ok(typeof load(NS, 'url-search-params') == 'function');
623641

624642
const instanceForEach = load(NS, 'instance/for-each');
@@ -803,9 +821,10 @@ for (const NS of ['es', 'stable', 'actual', 'full']) {
803821
load(NS, 'array-buffer/detached');
804822
load(NS, 'array-buffer/transfer');
805823
load(NS, 'array-buffer/transfer-to-fixed-length');
806-
ok(typeof load(NS, 'data-view') == 'function');
824+
ok(typeof load(NS, 'data-view/constructor') == 'function');
807825
load(NS, 'data-view/get-float16');
808826
load(NS, 'data-view/set-float16');
827+
ok(typeof load(NS, 'data-view') == 'function');
809828
ok(typeof load(NS, 'typed-array/int8-array') == 'function');
810829
ok(typeof load(NS, 'typed-array/uint8-array') == 'function');
811830
ok(typeof load(NS, 'typed-array/uint8-clamped-array') == 'function');

0 commit comments

Comments
 (0)