mirror of
https://github.com/biobulkbende/biobulkbende.org.git
synced 2025-10-12 07:34:58 +00:00
structure, layout and automation
This commit is contained in:
206
node_modules/es-abstract/test/GetIntrinsic.js
generated
vendored
Normal file
206
node_modules/es-abstract/test/GetIntrinsic.js
generated
vendored
Normal file
@ -0,0 +1,206 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('../GetIntrinsic');
|
||||
|
||||
var test = require('tape');
|
||||
var forEach = require('foreach');
|
||||
var debug = require('object-inspect');
|
||||
var generatorFns = require('make-generator-function')();
|
||||
var asyncFns = require('make-async-function').list();
|
||||
var asyncGenFns = require('make-async-generator-function')();
|
||||
|
||||
var callBound = require('../helpers/callBound');
|
||||
var v = require('./helpers/values');
|
||||
var $gOPD = require('../helpers/getOwnPropertyDescriptor');
|
||||
|
||||
var $isProto = callBound('%Object.prototype.isPrototypeOf%');
|
||||
|
||||
test('export', function (t) {
|
||||
t.equal(typeof GetIntrinsic, 'function', 'it is a function');
|
||||
t.equal(GetIntrinsic.length, 2, 'function has length of 2');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('throws', function (t) {
|
||||
t['throws'](
|
||||
function () { GetIntrinsic('not an intrinsic'); },
|
||||
SyntaxError,
|
||||
'nonexistent intrinsic throws a syntax error'
|
||||
);
|
||||
|
||||
t['throws'](
|
||||
function () { GetIntrinsic(''); },
|
||||
TypeError,
|
||||
'empty string intrinsic throws a type error'
|
||||
);
|
||||
|
||||
t['throws'](
|
||||
function () { GetIntrinsic('.'); },
|
||||
SyntaxError,
|
||||
'"just a dot" intrinsic throws a syntax error'
|
||||
);
|
||||
|
||||
forEach(v.nonStrings, function (nonString) {
|
||||
t['throws'](
|
||||
function () { GetIntrinsic(nonString); },
|
||||
TypeError,
|
||||
debug(nonString) + ' is not a String'
|
||||
);
|
||||
});
|
||||
|
||||
forEach(v.nonBooleans, function (nonBoolean) {
|
||||
t['throws'](
|
||||
function () { GetIntrinsic('%', nonBoolean); },
|
||||
TypeError,
|
||||
debug(nonBoolean) + ' is not a Boolean'
|
||||
);
|
||||
});
|
||||
|
||||
forEach([
|
||||
'toString',
|
||||
'propertyIsEnumerable',
|
||||
'hasOwnProperty'
|
||||
], function (objectProtoMember) {
|
||||
t['throws'](
|
||||
function () { GetIntrinsic(objectProtoMember); },
|
||||
SyntaxError,
|
||||
debug(objectProtoMember) + ' is not an intrinsic'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('base intrinsics', function (t) {
|
||||
t.equal(GetIntrinsic('%Object%'), Object, '%Object% yields Object');
|
||||
t.equal(GetIntrinsic('Object'), Object, 'Object yields Object');
|
||||
t.equal(GetIntrinsic('%Array%'), Array, '%Array% yields Array');
|
||||
t.equal(GetIntrinsic('Array'), Array, 'Array yields Array');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('dotted paths', function (t) {
|
||||
t.equal(GetIntrinsic('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% yields Object.prototype.toString');
|
||||
t.equal(GetIntrinsic('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString yields Object.prototype.toString');
|
||||
t.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push, '%Array.prototype.push% yields Array.prototype.push');
|
||||
t.equal(GetIntrinsic('Array.prototype.push'), Array.prototype.push, 'Array.prototype.push yields Array.prototype.push');
|
||||
|
||||
test('underscore paths are aliases for dotted paths', function (st) {
|
||||
var original = GetIntrinsic('%ObjProto_toString%');
|
||||
|
||||
forEach([
|
||||
'%Object.prototype.toString%',
|
||||
'Object.prototype.toString',
|
||||
'%ObjectPrototype.toString%',
|
||||
'ObjectPrototype.toString',
|
||||
'%ObjProto_toString%',
|
||||
'ObjProto_toString'
|
||||
], function (name) {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Object.prototype.toString = function toString() {
|
||||
return original.apply(this, arguments);
|
||||
};
|
||||
st.equal(GetIntrinsic(name), original, name + ' yields original Object.prototype.toString');
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Object.prototype.toString = original;
|
||||
st.end();
|
||||
});
|
||||
|
||||
test('dotted paths cache', function (st) {
|
||||
var original = GetIntrinsic('%Object.prototype.propertyIsEnumerable%');
|
||||
|
||||
forEach([
|
||||
'%Object.prototype.propertyIsEnumerable%',
|
||||
'Object.prototype.propertyIsEnumerable',
|
||||
'%ObjectPrototype.propertyIsEnumerable%',
|
||||
'ObjectPrototype.propertyIsEnumerable'
|
||||
], function (name) {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Object.prototype.propertyIsEnumerable = function propertyIsEnumerable() {
|
||||
return original.apply(this, arguments);
|
||||
};
|
||||
st.equal(GetIntrinsic(name), original, name + ' yields cached Object.prototype.propertyIsEnumerable');
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Object.prototype.propertyIsEnumerable = original;
|
||||
st.end();
|
||||
});
|
||||
|
||||
test('dotted path reports correct error', function (st) {
|
||||
st['throws'](function () {
|
||||
GetIntrinsic('%NonExistentIntrinsic.prototype.property%');
|
||||
}, /%NonExistentIntrinsic%/, 'The base intrinsic of %NonExistentIntrinsic.prototype.property% is %NonExistentIntrinsic%');
|
||||
|
||||
st['throws'](function () {
|
||||
GetIntrinsic('%NonExistentIntrinsicPrototype.property%');
|
||||
}, /%NonExistentIntrinsicPrototype%/, 'The base intrinsic of %NonExistentIntrinsicPrototype.property% is %NonExistentIntrinsicPrototype%');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('accessors', { skip: !$gOPD || typeof Map !== 'function' }, function (t) {
|
||||
var actual = $gOPD(Map.prototype, 'size');
|
||||
t.ok(actual, 'Map.prototype.size has a descriptor');
|
||||
t.equal(typeof actual.get, 'function', 'Map.prototype.size has a getter function');
|
||||
t.equal(GetIntrinsic('%Map.prototype.size%'), actual.get, '%Map.prototype.size% yields the getter for it');
|
||||
t.equal(GetIntrinsic('Map.prototype.size'), actual.get, 'Map.prototype.size yields the getter for it');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('generator functions', { skip: !generatorFns.length }, function (t) {
|
||||
var $GeneratorFunction = GetIntrinsic('%GeneratorFunction%');
|
||||
var $GeneratorFunctionPrototype = GetIntrinsic('%Generator%');
|
||||
var $GeneratorPrototype = GetIntrinsic('%GeneratorPrototype%');
|
||||
|
||||
forEach(generatorFns, function (genFn) {
|
||||
var fnName = genFn.name;
|
||||
fnName = fnName ? "'" + fnName + "'" : 'genFn';
|
||||
|
||||
t.ok(genFn instanceof $GeneratorFunction, fnName + ' instanceof %GeneratorFunction%');
|
||||
t.ok($isProto($GeneratorFunctionPrototype, genFn), '%Generator% is prototype of ' + fnName);
|
||||
t.ok($isProto($GeneratorPrototype, genFn.prototype), '%GeneratorPrototype% is prototype of ' + fnName + '.prototype');
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('async functions', { skip: !asyncFns.length }, function (t) {
|
||||
var $AsyncFunction = GetIntrinsic('%AsyncFunction%');
|
||||
var $AsyncFunctionPrototype = GetIntrinsic('%AsyncFunctionPrototype%');
|
||||
|
||||
forEach(asyncFns, function (asyncFn) {
|
||||
var fnName = asyncFn.name;
|
||||
fnName = fnName ? "'" + fnName + "'" : 'asyncFn';
|
||||
|
||||
t.ok(asyncFn instanceof $AsyncFunction, fnName + ' instanceof %AsyncFunction%');
|
||||
t.ok($isProto($AsyncFunctionPrototype, asyncFn), '%AsyncFunctionPrototype% is prototype of ' + fnName);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('async generator functions', { skip: !asyncGenFns.length }, function (t) {
|
||||
var $AsyncGeneratorFunction = GetIntrinsic('%AsyncGeneratorFunction%');
|
||||
var $AsyncGeneratorFunctionPrototype = GetIntrinsic('%AsyncGenerator%');
|
||||
var $AsyncGeneratorPrototype = GetIntrinsic('%AsyncGeneratorPrototype%');
|
||||
|
||||
forEach(asyncGenFns, function (asyncGenFn) {
|
||||
var fnName = asyncGenFn.name;
|
||||
fnName = fnName ? "'" + fnName + "'" : 'asyncGenFn';
|
||||
|
||||
t.ok(asyncGenFn instanceof $AsyncGeneratorFunction, fnName + ' instanceof %AsyncGeneratorFunction%');
|
||||
t.ok($isProto($AsyncGeneratorFunctionPrototype, asyncGenFn), '%AsyncGenerator% is prototype of ' + fnName);
|
||||
t.ok($isProto($AsyncGeneratorPrototype, asyncGenFn.prototype), '%AsyncGeneratorPrototype% is prototype of ' + fnName + '.prototype');
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
27
node_modules/es-abstract/test/diffOps.js
generated
vendored
Normal file
27
node_modules/es-abstract/test/diffOps.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var keys = require('object-keys');
|
||||
var forEach = require('foreach');
|
||||
var indexOf = require('array.prototype.indexof');
|
||||
|
||||
module.exports = function diffOperations(actual, expected, expectedMissing) {
|
||||
var actualKeys = keys(actual);
|
||||
var expectedKeys = keys(expected);
|
||||
|
||||
var extra = [];
|
||||
var missing = [];
|
||||
forEach(actualKeys, function (op) {
|
||||
if (!(op in expected)) {
|
||||
extra.push(op);
|
||||
} else if (indexOf(expectedMissing, op) !== -1) {
|
||||
extra.push(op);
|
||||
}
|
||||
});
|
||||
forEach(expectedKeys, function (op) {
|
||||
if (typeof actual[op] !== 'function' && indexOf(expectedMissing, op) === -1) {
|
||||
missing.push(op);
|
||||
}
|
||||
});
|
||||
|
||||
return { missing: missing, extra: extra };
|
||||
};
|
146
node_modules/es-abstract/test/es2015.js
generated
vendored
Normal file
146
node_modules/es-abstract/test/es2015.js
generated
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
'use strict';
|
||||
|
||||
var ES = require('../').ES2015;
|
||||
var boundES = require('./helpers/createBoundESNamespace')(ES);
|
||||
|
||||
var ops = require('../operations/2015');
|
||||
|
||||
var expectedMissing = [
|
||||
'AddRestrictedFunctionProperties',
|
||||
'AllocateArrayBuffer',
|
||||
'AllocateTypedArray',
|
||||
'BoundFunctionCreate',
|
||||
'Canonicalize',
|
||||
'CharacterRange',
|
||||
'CharacterSetMatcher',
|
||||
'CloneArrayBuffer',
|
||||
'Completion',
|
||||
'Construct',
|
||||
'CopyDataBlockBytes',
|
||||
'CreateArrayFromList',
|
||||
'CreateBuiltinFunction',
|
||||
'CreateByteDataBlock',
|
||||
'CreateDynamicFunction',
|
||||
'CreateIntrinsics',
|
||||
'CreateListIterator',
|
||||
'CreateMapIterator',
|
||||
'CreateMappedArgumentsObject',
|
||||
'CreatePerIterationEnvironment',
|
||||
'CreateRealm',
|
||||
'CreateSetIterator',
|
||||
'CreateUnmappedArgumentsObject',
|
||||
'Decode',
|
||||
'DetachArrayBuffer',
|
||||
'Encode',
|
||||
'EnqueueJob',
|
||||
'EscapeRegExpPattern',
|
||||
'EvalDeclarationInstantiation',
|
||||
'EvaluateCall',
|
||||
'EvaluateDirectCall',
|
||||
'EvaluateNew',
|
||||
'ForBodyEvaluation',
|
||||
'ForIn/OfBodyEvaluation',
|
||||
'ForIn/OfHeadEvaluation',
|
||||
'FulfillPromise',
|
||||
'FunctionAllocate',
|
||||
'FunctionCreate',
|
||||
'FunctionInitialize',
|
||||
'GeneratorFunctionCreate',
|
||||
'GeneratorResume',
|
||||
'GeneratorResumeAbrupt',
|
||||
'GeneratorStart',
|
||||
'GeneratorValidate',
|
||||
'GeneratorYield',
|
||||
'GetBase',
|
||||
'GetFunctionRealm',
|
||||
'GetGlobalObject',
|
||||
'GetIdentifierReference',
|
||||
'GetModuleNamespace',
|
||||
'GetNewTarget',
|
||||
'GetReferencedName',
|
||||
'GetSuperConstructor',
|
||||
'GetTemplateObject',
|
||||
'GetThisEnvironment',
|
||||
'GetThisValue',
|
||||
'GetValue',
|
||||
'GetValueFromBuffer',
|
||||
'GetViewValue',
|
||||
'HasPrimitiveBase',
|
||||
'HostResolveImportedModule',
|
||||
'ImportedLocalNames',
|
||||
'InitializeHostDefinedRealm',
|
||||
'InitializeReferencedBinding',
|
||||
'IntegerIndexedElementGet',
|
||||
'IntegerIndexedElementSet',
|
||||
'IntegerIndexedObjectCreate',
|
||||
'InternalizeJSONProperty',
|
||||
'IsAnonymousFunctionDefinition',
|
||||
'IsCompatiblePropertyDescriptor',
|
||||
'IsDetachedBuffer',
|
||||
'IsInTailPosition',
|
||||
'IsLabelledFunction',
|
||||
'IsPropertyReference',
|
||||
'IsStrictReference',
|
||||
'IsSuperReference',
|
||||
'IsUnresolvableReference',
|
||||
'IsWordChar',
|
||||
'LocalTime',
|
||||
'LoopContinues',
|
||||
'MakeArgGetter',
|
||||
'MakeArgSetter',
|
||||
'MakeClassConstructor',
|
||||
'MakeConstructor',
|
||||
'MakeMethod',
|
||||
'MakeSuperPropertyReference',
|
||||
'max',
|
||||
'min',
|
||||
'ModuleNamespaceCreate',
|
||||
'msPerDay',
|
||||
'NewDeclarativeEnvironment',
|
||||
'NewFunctionEnvironment',
|
||||
'NewGlobalEnvironment',
|
||||
'NewModuleEnvironment',
|
||||
'NewObjectEnvironment',
|
||||
'NewPromiseCapability',
|
||||
'NormalCompletion',
|
||||
'ObjectDefineProperties',
|
||||
'OrdinaryCallBindThis',
|
||||
'OrdinaryCallEvaluateBody',
|
||||
'ParseModule',
|
||||
'PerformEval',
|
||||
'PerformPromiseAll',
|
||||
'PerformPromiseRace',
|
||||
'PerformPromiseThen',
|
||||
'PrepareForOrdinaryCall',
|
||||
'PrepareForTailCall',
|
||||
'ProxyCreate',
|
||||
'PutValue',
|
||||
'RegExpAlloc',
|
||||
'RegExpBuiltinExec',
|
||||
'RegExpCreate',
|
||||
'RegExpInitialize',
|
||||
'RejectPromise',
|
||||
'RepeatMatcher',
|
||||
'ResolveBinding',
|
||||
'ResolveThisBinding',
|
||||
'SerializeJSONArray',
|
||||
'SerializeJSONObject',
|
||||
'SerializeJSONProperty',
|
||||
'SetDefaultGlobalBindings',
|
||||
'SetRealmGlobalObject',
|
||||
'SetValueInBuffer',
|
||||
'SetViewValue',
|
||||
'sign',
|
||||
'SortCompare',
|
||||
'SplitMatch',
|
||||
'StringCreate',
|
||||
'StringGetIndexProperty',
|
||||
'TriggerPromiseReactions',
|
||||
'TypedArrayFrom',
|
||||
'UpdateEmpty',
|
||||
'UTC'
|
||||
];
|
||||
|
||||
require('./tests').es2015(boundES, ops, expectedMissing);
|
||||
|
||||
require('./helpers/runManifestTest')(require('tape'), ES, 2015);
|
168
node_modules/es-abstract/test/es2016.js
generated
vendored
Normal file
168
node_modules/es-abstract/test/es2016.js
generated
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
'use strict';
|
||||
|
||||
var ES = require('../').ES2016;
|
||||
var boundES = require('./helpers/createBoundESNamespace')(ES);
|
||||
|
||||
var ops = require('../operations/2016');
|
||||
|
||||
var expectedMissing = [
|
||||
'AddRestrictedFunctionProperties',
|
||||
'AllocateArrayBuffer',
|
||||
'AllocateTypedArray',
|
||||
'AllocateTypedArrayBuffer',
|
||||
'BlockDeclarationInstantiation',
|
||||
'BoundFunctionCreate',
|
||||
'Canonicalize',
|
||||
'CharacterRange',
|
||||
'CharacterRangeOrUnion',
|
||||
'CharacterSetMatcher',
|
||||
'CloneArrayBuffer',
|
||||
'Completion',
|
||||
'Construct',
|
||||
'CopyDataBlockBytes',
|
||||
'CreateArrayFromList',
|
||||
'CreateArrayIterator',
|
||||
'CreateBuiltinFunction',
|
||||
'CreateByteDataBlock',
|
||||
'CreateDynamicFunction',
|
||||
'CreateIntrinsics',
|
||||
'CreateListIterator',
|
||||
'CreateMapIterator',
|
||||
'CreateMappedArgumentsObject',
|
||||
'CreatePerIterationEnvironment',
|
||||
'CreateRealm',
|
||||
'CreateResolvingFunctions',
|
||||
'CreateSetIterator',
|
||||
'CreateStringIterator',
|
||||
'CreateUnmappedArgumentsObject',
|
||||
'Decode',
|
||||
'DetachArrayBuffer',
|
||||
'Encode',
|
||||
'EnqueueJob',
|
||||
'EnumerateObjectProperties',
|
||||
'EscapeRegExpPattern',
|
||||
'EvalDeclarationInstantiation',
|
||||
'EvaluateCall',
|
||||
'EvaluateDirectCall',
|
||||
'EvaluateNew',
|
||||
'ForBodyEvaluation',
|
||||
'ForIn/OfBodyEvaluation',
|
||||
'ForIn/OfHeadEvaluation',
|
||||
'FulfillPromise',
|
||||
'FunctionAllocate',
|
||||
'FunctionCreate',
|
||||
'FunctionDeclarationInstantiation',
|
||||
'FunctionInitialize',
|
||||
'GeneratorFunctionCreate',
|
||||
'GeneratorResume',
|
||||
'GeneratorResumeAbrupt',
|
||||
'GeneratorStart',
|
||||
'GeneratorValidate',
|
||||
'GeneratorYield',
|
||||
'GetActiveScriptOrModule',
|
||||
'GetFunctionRealm',
|
||||
'GetGlobalObject',
|
||||
'GetIdentifierReference',
|
||||
'GetModuleNamespace',
|
||||
'GetNewTarget',
|
||||
'GetSuperConstructor',
|
||||
'GetTemplateObject',
|
||||
'GetThisEnvironment',
|
||||
'GetThisValue',
|
||||
'GetValue',
|
||||
'GetValueFromBuffer',
|
||||
'GetViewValue',
|
||||
'GlobalDeclarationInstantiation',
|
||||
'HostPromiseRejectionTracker',
|
||||
'HostReportErrors',
|
||||
'HostResolveImportedModule',
|
||||
'IfAbruptRejectPromise',
|
||||
'ImportedLocalNames',
|
||||
'InitializeBoundName',
|
||||
'InitializeHostDefinedRealm',
|
||||
'InitializeReferencedBinding',
|
||||
'IntegerIndexedElementGet',
|
||||
'IntegerIndexedElementSet',
|
||||
'IntegerIndexedObjectCreate',
|
||||
'InternalizeJSONProperty',
|
||||
'IsAnonymousFunctionDefinition',
|
||||
'IsCompatiblePropertyDescriptor',
|
||||
'IsDetachedBuffer',
|
||||
'IsInTailPosition',
|
||||
'IsLabelledFunction',
|
||||
'IsWordChar',
|
||||
'LocalTime',
|
||||
'LoopContinues',
|
||||
'MakeArgGetter',
|
||||
'MakeArgSetter',
|
||||
'MakeClassConstructor',
|
||||
'MakeConstructor',
|
||||
'MakeMethod',
|
||||
'MakeSuperPropertyReference',
|
||||
'max',
|
||||
'min',
|
||||
'ModuleNamespaceCreate',
|
||||
'NewDeclarativeEnvironment',
|
||||
'NewFunctionEnvironment',
|
||||
'NewGlobalEnvironment',
|
||||
'NewModuleEnvironment',
|
||||
'NewObjectEnvironment',
|
||||
'NewPromiseCapability',
|
||||
'NextJob',
|
||||
'NormalCompletion',
|
||||
'ObjectDefineProperties',
|
||||
'OrdinaryCallBindThis',
|
||||
'OrdinaryCallEvaluateBody',
|
||||
'OrdinaryDelete',
|
||||
'OrdinaryGet',
|
||||
'OrdinaryIsExtensible',
|
||||
'OrdinaryOwnPropertyKeys',
|
||||
'OrdinaryPreventExtensions',
|
||||
'OrdinarySet',
|
||||
'ParseModule',
|
||||
'ParseScript',
|
||||
'PerformEval',
|
||||
'PerformPromiseAll',
|
||||
'PerformPromiseRace',
|
||||
'PerformPromiseThen',
|
||||
'PrepareForOrdinaryCall',
|
||||
'PrepareForTailCall',
|
||||
'PromiseReactionJob',
|
||||
'PromiseResolveThenableJob',
|
||||
'ProxyCreate',
|
||||
'PutValue',
|
||||
'RegExpAlloc',
|
||||
'RegExpBuiltinExec',
|
||||
'RegExpCreate',
|
||||
'RegExpInitialize',
|
||||
'RejectPromise',
|
||||
'RepeatMatcher',
|
||||
'ResolveBinding',
|
||||
'ResolveThisBinding',
|
||||
'ReturnIfAbrupt',
|
||||
'ScriptEvaluation',
|
||||
'ScriptEvaluationJob',
|
||||
'SerializeJSONArray',
|
||||
'SerializeJSONObject',
|
||||
'SerializeJSONProperty',
|
||||
'SetDefaultGlobalBindings',
|
||||
'SetRealmGlobalObject',
|
||||
'SetValueInBuffer',
|
||||
'SetViewValue',
|
||||
'SortCompare',
|
||||
'SplitMatch',
|
||||
'StringCreate',
|
||||
'TopLevelModuleEvaluationJob',
|
||||
'ToString Applied to the Number Type',
|
||||
'TriggerPromiseReactions',
|
||||
'TypedArrayCreate',
|
||||
'TypedArraySpeciesCreate',
|
||||
'UpdateEmpty',
|
||||
'UTC', // depends on LocalTZA
|
||||
'UTF16Decode',
|
||||
'ValidateTypedArray'
|
||||
];
|
||||
|
||||
require('./tests').es2016(boundES, ops, expectedMissing);
|
||||
|
||||
require('./helpers/runManifestTest')(require('tape'), ES, 2016);
|
214
node_modules/es-abstract/test/es2017.js
generated
vendored
Normal file
214
node_modules/es-abstract/test/es2017.js
generated
vendored
Normal file
@ -0,0 +1,214 @@
|
||||
'use strict';
|
||||
|
||||
var ES = require('../').ES2017;
|
||||
var boundES = require('./helpers/createBoundESNamespace')(ES);
|
||||
|
||||
var ops = require('../operations/2017');
|
||||
|
||||
var expectedMissing = [
|
||||
'AddWaiter',
|
||||
'agent-order',
|
||||
'AgentCanSuspend',
|
||||
'AgentSignifier',
|
||||
'AllocateArrayBuffer',
|
||||
'AllocateSharedArrayBuffer',
|
||||
'AllocateTypedArray',
|
||||
'AllocateTypedArrayBuffer',
|
||||
'AsyncFunctionAwait',
|
||||
'AsyncFunctionCreate',
|
||||
'AsyncFunctionStart',
|
||||
'AtomicLoad',
|
||||
'AtomicReadModifyWrite',
|
||||
'BlockDeclarationInstantiation',
|
||||
'BoundFunctionCreate',
|
||||
'Canonicalize',
|
||||
'CharacterRange',
|
||||
'CharacterRangeOrUnion',
|
||||
'CharacterSetMatcher',
|
||||
'CloneArrayBuffer',
|
||||
'Completion',
|
||||
'ComposeWriteEventBytes',
|
||||
'Construct',
|
||||
'CopyDataBlockBytes',
|
||||
'CreateArrayFromList',
|
||||
'CreateArrayIterator',
|
||||
'CreateBuiltinFunction',
|
||||
'CreateByteDataBlock',
|
||||
'CreateDynamicFunction',
|
||||
'CreateIntrinsics',
|
||||
'CreateListIterator',
|
||||
'CreateMapIterator',
|
||||
'CreateMappedArgumentsObject',
|
||||
'CreatePerIterationEnvironment',
|
||||
'CreateRealm',
|
||||
'CreateResolvingFunctions',
|
||||
'CreateSetIterator',
|
||||
'CreateSharedByteDataBlock',
|
||||
'CreateStringIterator',
|
||||
'CreateUnmappedArgumentsObject',
|
||||
'Decode',
|
||||
'DetachArrayBuffer',
|
||||
'Encode',
|
||||
'EnqueueJob',
|
||||
'EnterCriticalSection',
|
||||
'EnumerateObjectProperties',
|
||||
'EscapeRegExpPattern',
|
||||
'EvalDeclarationInstantiation',
|
||||
'EvaluateCall',
|
||||
'EvaluateDirectCall',
|
||||
'EvaluateNew',
|
||||
'EventSet',
|
||||
'ForBodyEvaluation',
|
||||
'ForIn/OfBodyEvaluation',
|
||||
'ForIn/OfHeadEvaluation',
|
||||
'FulfillPromise',
|
||||
'FunctionAllocate',
|
||||
'FunctionCreate',
|
||||
'FunctionDeclarationInstantiation',
|
||||
'FunctionInitialize',
|
||||
'GeneratorFunctionCreate',
|
||||
'GeneratorResume',
|
||||
'GeneratorResumeAbrupt',
|
||||
'GeneratorStart',
|
||||
'GeneratorValidate',
|
||||
'GeneratorYield',
|
||||
'GetActiveScriptOrModule',
|
||||
'GetBase',
|
||||
'GetFunctionRealm',
|
||||
'GetGlobalObject',
|
||||
'GetIdentifierReference',
|
||||
'GetModifySetValueInBuffer',
|
||||
'GetModuleNamespace',
|
||||
'GetNewTarget',
|
||||
'GetReferencedName',
|
||||
'GetSuperConstructor',
|
||||
'GetTemplateObject',
|
||||
'GetThisEnvironment',
|
||||
'GetThisValue',
|
||||
'GetValue',
|
||||
'GetValueFromBuffer',
|
||||
'GetViewValue',
|
||||
'GetWaiterList',
|
||||
'GlobalDeclarationInstantiation',
|
||||
'happens-before',
|
||||
'HasPrimitiveBase',
|
||||
'host-synchronizes-with',
|
||||
'HostEnsureCanCompileStrings',
|
||||
'HostEventSet',
|
||||
'HostPromiseRejectionTracker',
|
||||
'HostReportErrors',
|
||||
'HostResolveImportedModule',
|
||||
'IfAbruptRejectPromise',
|
||||
'ImportedLocalNames',
|
||||
'InitializeBoundName',
|
||||
'InitializeHostDefinedRealm',
|
||||
'InitializeReferencedBinding',
|
||||
'IntegerIndexedElementGet',
|
||||
'IntegerIndexedElementSet',
|
||||
'IntegerIndexedObjectCreate',
|
||||
'InternalizeJSONProperty',
|
||||
'IsAnonymousFunctionDefinition',
|
||||
'IsCompatiblePropertyDescriptor',
|
||||
'IsDetachedBuffer',
|
||||
'IsInTailPosition',
|
||||
'IsLabelledFunction',
|
||||
'IsPropertyReference',
|
||||
'IsSharedArrayBuffer',
|
||||
'IsStrictReference',
|
||||
'IsSuperReference',
|
||||
'IsUnresolvableReference',
|
||||
'IsWordChar',
|
||||
'LeaveCriticalSection',
|
||||
'LocalTime',
|
||||
'LoopContinues',
|
||||
'MakeArgGetter',
|
||||
'MakeArgSetter',
|
||||
'MakeClassConstructor',
|
||||
'MakeConstructor',
|
||||
'MakeMethod',
|
||||
'MakeSuperPropertyReference',
|
||||
'max',
|
||||
'memory-order',
|
||||
'min',
|
||||
'ModuleNamespaceCreate',
|
||||
'NewDeclarativeEnvironment',
|
||||
'NewFunctionEnvironment',
|
||||
'NewGlobalEnvironment',
|
||||
'NewModuleEnvironment',
|
||||
'NewObjectEnvironment',
|
||||
'NewPromiseCapability',
|
||||
'NormalCompletion',
|
||||
'NumberToRawBytes',
|
||||
'ObjectDefineProperties',
|
||||
'OrdinaryCallBindThis',
|
||||
'OrdinaryCallEvaluateBody',
|
||||
'OrdinaryDelete',
|
||||
'OrdinaryGet',
|
||||
'OrdinaryIsExtensible',
|
||||
'OrdinaryOwnPropertyKeys',
|
||||
'OrdinaryPreventExtensions',
|
||||
'OrdinarySet',
|
||||
'OrdinaryToPrimitive',
|
||||
'ParseModule',
|
||||
'ParseScript',
|
||||
'PerformEval',
|
||||
'PerformPromiseAll',
|
||||
'PerformPromiseRace',
|
||||
'PerformPromiseThen',
|
||||
'PrepareForOrdinaryCall',
|
||||
'PrepareForTailCall',
|
||||
'PromiseReactionJob',
|
||||
'PromiseResolveThenableJob',
|
||||
'ProxyCreate',
|
||||
'PutValue',
|
||||
'RawBytesToNumber',
|
||||
'reads-bytes-from',
|
||||
'reads-from',
|
||||
'RegExpAlloc',
|
||||
'RegExpBuiltinExec',
|
||||
'RegExpCreate',
|
||||
'RegExpInitialize',
|
||||
'RejectPromise',
|
||||
'RemoveWaiter',
|
||||
'RemoveWaiters',
|
||||
'RepeatMatcher',
|
||||
'ResolveBinding',
|
||||
'ResolveThisBinding',
|
||||
'ReturnIfAbrupt',
|
||||
'RunJobs',
|
||||
'ScriptEvaluation',
|
||||
'ScriptEvaluationJob',
|
||||
'SerializeJSONArray',
|
||||
'SerializeJSONObject',
|
||||
'SerializeJSONProperty',
|
||||
'SetDefaultGlobalBindings',
|
||||
'SetImmutablePrototype',
|
||||
'SetRealmGlobalObject',
|
||||
'SetValueInBuffer',
|
||||
'SetViewValue',
|
||||
'SharedDataBlockEventSet',
|
||||
'SortCompare',
|
||||
'SplitMatch',
|
||||
'StringCreate',
|
||||
'Suspend',
|
||||
'TopLevelModuleEvaluationJob',
|
||||
'ToString Applied to the Number Type',
|
||||
'TriggerPromiseReactions',
|
||||
'TypedArrayCreate',
|
||||
'TypedArraySpeciesCreate',
|
||||
'UpdateEmpty',
|
||||
'UTC', // depends on LocalTZA'UTC',
|
||||
'UTF16Decode',
|
||||
'ValidateAtomicAccess',
|
||||
'ValidateSharedIntegerTypedArray',
|
||||
'ValidateTypedArray',
|
||||
'ValueOfReadEvent',
|
||||
'WakeWaiter',
|
||||
'WordCharacters', // depends on Canonicalize
|
||||
'AddRestrictedFunctionProperties',
|
||||
'synchronizes-with'
|
||||
];
|
||||
|
||||
require('./tests').es2017(boundES, ops, expectedMissing);
|
||||
|
||||
require('./helpers/runManifestTest')(require('tape'), ES, 2017);
|
233
node_modules/es-abstract/test/es2018.js
generated
vendored
Normal file
233
node_modules/es-abstract/test/es2018.js
generated
vendored
Normal file
@ -0,0 +1,233 @@
|
||||
'use strict';
|
||||
|
||||
var ES = require('../').ES2018;
|
||||
var boundES = require('./helpers/createBoundESNamespace')(ES);
|
||||
|
||||
var ops = require('../operations/2018');
|
||||
|
||||
var expectedMissing = [
|
||||
'AddRestrictedFunctionProperties',
|
||||
'AddWaiter',
|
||||
'agent-order',
|
||||
'AgentCanSuspend',
|
||||
'AgentSignifier',
|
||||
'AllocateArrayBuffer',
|
||||
'AllocateSharedArrayBuffer',
|
||||
'AllocateTypedArray',
|
||||
'AllocateTypedArrayBuffer',
|
||||
'AsyncFunctionCreate',
|
||||
'AsyncFunctionStart',
|
||||
'AsyncGeneratorEnqueue',
|
||||
'AsyncGeneratorFunctionCreate',
|
||||
'AsyncGeneratorReject',
|
||||
'AsyncGeneratorResolve',
|
||||
'AsyncGeneratorResumeNext',
|
||||
'AsyncGeneratorStart',
|
||||
'AsyncGeneratorYield',
|
||||
'AsyncIteratorClose',
|
||||
'AtomicLoad',
|
||||
'AtomicReadModifyWrite',
|
||||
'Await',
|
||||
'BackreferenceMatcher',
|
||||
'BlockDeclarationInstantiation',
|
||||
'BoundFunctionCreate',
|
||||
'Canonicalize',
|
||||
'CaseClauseIsSelected',
|
||||
'CharacterRange',
|
||||
'CharacterRangeOrUnion',
|
||||
'CharacterSetMatcher',
|
||||
'CloneArrayBuffer',
|
||||
'Completion',
|
||||
'ComposeWriteEventBytes',
|
||||
'Construct',
|
||||
'CopyDataBlockBytes',
|
||||
'CreateArrayFromList',
|
||||
'CreateArrayIterator',
|
||||
'CreateAsyncFromSyncIterator',
|
||||
'CreateBuiltinFunction',
|
||||
'CreateByteDataBlock',
|
||||
'CreateDynamicFunction',
|
||||
'CreateIntrinsics',
|
||||
'CreateListIteratorRecord',
|
||||
'CreateMapIterator',
|
||||
'CreateMappedArgumentsObject',
|
||||
'CreatePerIterationEnvironment',
|
||||
'CreateRealm',
|
||||
'CreateResolvingFunctions',
|
||||
'CreateSetIterator',
|
||||
'CreateSharedByteDataBlock',
|
||||
'CreateStringIterator',
|
||||
'CreateUnmappedArgumentsObject',
|
||||
'Decode',
|
||||
'DetachArrayBuffer',
|
||||
'Encode',
|
||||
'EnqueueJob',
|
||||
'EnterCriticalSection',
|
||||
'EnumerateObjectProperties',
|
||||
'EscapeRegExpPattern',
|
||||
'EvalDeclarationInstantiation',
|
||||
'EvaluateCall',
|
||||
'EvaluateNew',
|
||||
'EventSet',
|
||||
'ForBodyEvaluation',
|
||||
'ForIn/OfBodyEvaluation',
|
||||
'ForIn/OfHeadEvaluation',
|
||||
'FulfillPromise',
|
||||
'FunctionAllocate',
|
||||
'FunctionCreate',
|
||||
'FunctionDeclarationInstantiation',
|
||||
'FunctionInitialize',
|
||||
'GeneratorFunctionCreate',
|
||||
'GeneratorResume',
|
||||
'GeneratorResumeAbrupt',
|
||||
'GeneratorStart',
|
||||
'GeneratorValidate',
|
||||
'GeneratorYield',
|
||||
'GetActiveScriptOrModule',
|
||||
'GetBase',
|
||||
'GetFunctionRealm',
|
||||
'GetGeneratorKind',
|
||||
'GetGlobalObject',
|
||||
'GetIdentifierReference',
|
||||
'GetModifySetValueInBuffer',
|
||||
'GetModuleNamespace',
|
||||
'GetNewTarget',
|
||||
'GetReferencedName',
|
||||
'GetSuperConstructor',
|
||||
'GetTemplateObject',
|
||||
'GetThisEnvironment',
|
||||
'GetThisValue',
|
||||
'GetValue',
|
||||
'GetValueFromBuffer',
|
||||
'GetViewValue',
|
||||
'GetWaiterList',
|
||||
'GlobalDeclarationInstantiation',
|
||||
'happens-before',
|
||||
'HasPrimitiveBase',
|
||||
'host-synchronizes-with',
|
||||
'HostEnsureCanCompileStrings',
|
||||
'HostEventSet',
|
||||
'HostPromiseRejectionTracker',
|
||||
'HostReportErrors',
|
||||
'HostResolveImportedModule',
|
||||
'IfAbruptRejectPromise',
|
||||
'ImportedLocalNames',
|
||||
'InitializeBoundName',
|
||||
'InitializeHostDefinedRealm',
|
||||
'InitializeReferencedBinding',
|
||||
'InnerModuleEvaluation',
|
||||
'InnerModuleInstantiation',
|
||||
'IntegerIndexedElementGet',
|
||||
'IntegerIndexedElementSet',
|
||||
'IntegerIndexedObjectCreate',
|
||||
'InternalizeJSONProperty',
|
||||
'IsAnonymousFunctionDefinition',
|
||||
'IsCompatiblePropertyDescriptor',
|
||||
'IsDetachedBuffer',
|
||||
'IsInTailPosition',
|
||||
'IsLabelledFunction',
|
||||
'IsPropertyReference',
|
||||
'IsSharedArrayBuffer',
|
||||
'IsStrictReference',
|
||||
'IsSuperReference',
|
||||
'IsUnresolvableReference',
|
||||
'IsWordChar',
|
||||
'LeaveCriticalSection',
|
||||
'LocalTime',
|
||||
'LoopContinues',
|
||||
'MakeArgGetter',
|
||||
'MakeArgSetter',
|
||||
'MakeClassConstructor',
|
||||
'MakeConstructor',
|
||||
'MakeMethod',
|
||||
'MakeSuperPropertyReference',
|
||||
'max',
|
||||
'memory-order',
|
||||
'min',
|
||||
'ModuleDeclarationEnvironmentSetup',
|
||||
'ModuleExecution',
|
||||
'ModuleNamespaceCreate',
|
||||
'NewDeclarativeEnvironment',
|
||||
'NewFunctionEnvironment',
|
||||
'NewGlobalEnvironment',
|
||||
'NewModuleEnvironment',
|
||||
'NewObjectEnvironment',
|
||||
'NewPromiseCapability',
|
||||
'NormalCompletion',
|
||||
'NumberToRawBytes',
|
||||
'ObjectDefineProperties',
|
||||
'OrdinaryCallBindThis',
|
||||
'OrdinaryCallEvaluateBody',
|
||||
'OrdinaryDelete',
|
||||
'OrdinaryGet',
|
||||
'OrdinaryIsExtensible',
|
||||
'OrdinaryOwnPropertyKeys',
|
||||
'OrdinaryPreventExtensions',
|
||||
'OrdinarySet',
|
||||
'OrdinarySetWithOwnDescriptor',
|
||||
'OrdinaryToPrimitive',
|
||||
'ParseModule',
|
||||
'ParseScript',
|
||||
'PerformEval',
|
||||
'PerformPromiseAll',
|
||||
'PerformPromiseRace',
|
||||
'PerformPromiseThen',
|
||||
'PrepareForOrdinaryCall',
|
||||
'PrepareForTailCall',
|
||||
'PromiseReactionJob',
|
||||
'PromiseResolveThenableJob',
|
||||
'ProxyCreate',
|
||||
'PutValue',
|
||||
'RawBytesToNumber',
|
||||
'reads-bytes-from',
|
||||
'reads-from',
|
||||
'RegExpAlloc',
|
||||
'RegExpBuiltinExec',
|
||||
'RegExpCreate',
|
||||
'RegExpInitialize',
|
||||
'RejectPromise',
|
||||
'RemoveWaiter',
|
||||
'RemoveWaiters',
|
||||
'RepeatMatcher',
|
||||
'ResolveBinding',
|
||||
'ResolveThisBinding',
|
||||
'ReturnIfAbrupt',
|
||||
'RunJobs',
|
||||
'ScriptEvaluation',
|
||||
'ScriptEvaluationJob',
|
||||
'SerializeJSONArray',
|
||||
'SerializeJSONObject',
|
||||
'SerializeJSONProperty',
|
||||
'SetDefaultGlobalBindings',
|
||||
'SetImmutablePrototype',
|
||||
'SetRealmGlobalObject',
|
||||
'SetValueInBuffer',
|
||||
'SetViewValue',
|
||||
'SharedDataBlockEventSet',
|
||||
'SortCompare',
|
||||
'SplitMatch',
|
||||
'StringCreate',
|
||||
'Suspend',
|
||||
'synchronizes-with',
|
||||
'ThrowCompletion',
|
||||
'TimeZoneString',
|
||||
'TopLevelModuleEvaluationJob',
|
||||
'TriggerPromiseReactions',
|
||||
'TypedArrayCreate',
|
||||
'TypedArraySpeciesCreate',
|
||||
'UnicodeMatchProperty',
|
||||
'UnicodeMatchPropertyValue',
|
||||
'UpdateEmpty',
|
||||
'UTC', // depends on LocalTZA'UTC',
|
||||
'UTF16Decode',
|
||||
'ValidateAtomicAccess',
|
||||
'ValidateSharedIntegerTypedArray',
|
||||
'ValidateTypedArray',
|
||||
'ValueOfReadEvent',
|
||||
'WakeWaiter',
|
||||
'WordCharacters' // depends on Canonicalize
|
||||
];
|
||||
|
||||
require('./tests').es2018(boundES, ops, expectedMissing);
|
||||
|
||||
require('./helpers/runManifestTest')(require('tape'), ES, 2018);
|
238
node_modules/es-abstract/test/es2019.js
generated
vendored
Normal file
238
node_modules/es-abstract/test/es2019.js
generated
vendored
Normal file
@ -0,0 +1,238 @@
|
||||
'use strict';
|
||||
|
||||
var ES = require('../').ES2019;
|
||||
var boundES = require('./helpers/createBoundESNamespace')(ES);
|
||||
|
||||
var ops = require('../operations/2019');
|
||||
|
||||
var expectedMissing = [
|
||||
'AddRestrictedFunctionProperties',
|
||||
'AddWaiter',
|
||||
'agent-order',
|
||||
'AgentCanSuspend',
|
||||
'AgentSignifier',
|
||||
'AllocateArrayBuffer',
|
||||
'AllocateSharedArrayBuffer',
|
||||
'AllocateTypedArray',
|
||||
'AllocateTypedArrayBuffer',
|
||||
'AsyncFromSyncIteratorContinuation',
|
||||
'AsyncFunctionCreate',
|
||||
'AsyncFunctionStart',
|
||||
'AsyncGeneratorEnqueue',
|
||||
'AsyncGeneratorFunctionCreate',
|
||||
'AsyncGeneratorReject',
|
||||
'AsyncGeneratorResolve',
|
||||
'AsyncGeneratorResumeNext',
|
||||
'AsyncGeneratorStart',
|
||||
'AsyncGeneratorYield',
|
||||
'AsyncIteratorClose',
|
||||
'AtomicLoad',
|
||||
'AtomicReadModifyWrite',
|
||||
'Await',
|
||||
'BackreferenceMatcher',
|
||||
'BlockDeclarationInstantiation',
|
||||
'BoundFunctionCreate',
|
||||
'Canonicalize',
|
||||
'CaseClauseIsSelected',
|
||||
'CharacterRange',
|
||||
'CharacterRangeOrUnion',
|
||||
'CharacterSetMatcher',
|
||||
'CloneArrayBuffer',
|
||||
'Completion',
|
||||
'ComposeWriteEventBytes',
|
||||
'Construct',
|
||||
'CopyDataBlockBytes',
|
||||
'CreateArrayFromList',
|
||||
'CreateArrayIterator',
|
||||
'CreateAsyncFromSyncIterator',
|
||||
'CreateBuiltinFunction',
|
||||
'CreateByteDataBlock',
|
||||
'CreateDynamicFunction',
|
||||
'CreateIntrinsics',
|
||||
'CreateListIteratorRecord',
|
||||
'CreateMapIterator',
|
||||
'CreateMappedArgumentsObject',
|
||||
'CreatePerIterationEnvironment',
|
||||
'CreateRealm',
|
||||
'CreateResolvingFunctions',
|
||||
'CreateSetIterator',
|
||||
'CreateSharedByteDataBlock',
|
||||
'CreateStringIterator',
|
||||
'CreateUnmappedArgumentsObject',
|
||||
'Decode',
|
||||
'DetachArrayBuffer',
|
||||
'Encode',
|
||||
'EnqueueJob',
|
||||
'EnterCriticalSection',
|
||||
'EnumerateObjectProperties',
|
||||
'EscapeRegExpPattern',
|
||||
'EvalDeclarationInstantiation',
|
||||
'EvaluateCall',
|
||||
'EvaluateNew',
|
||||
'EventSet',
|
||||
'ExecuteModule',
|
||||
'ForBodyEvaluation',
|
||||
'ForIn/OfBodyEvaluation',
|
||||
'ForIn/OfHeadEvaluation',
|
||||
'FulfillPromise',
|
||||
'FunctionAllocate',
|
||||
'FunctionCreate',
|
||||
'FunctionDeclarationInstantiation',
|
||||
'FunctionInitialize',
|
||||
'GeneratorFunctionCreate',
|
||||
'GeneratorResume',
|
||||
'GeneratorResumeAbrupt',
|
||||
'GeneratorStart',
|
||||
'GeneratorValidate',
|
||||
'GeneratorYield',
|
||||
'GetActiveScriptOrModule',
|
||||
'GetBase',
|
||||
'GetFunctionRealm',
|
||||
'GetGeneratorKind',
|
||||
'GetGlobalObject',
|
||||
'GetIdentifierReference',
|
||||
'GetModifySetValueInBuffer',
|
||||
'GetModuleNamespace',
|
||||
'GetNewTarget',
|
||||
'GetReferencedName',
|
||||
'GetSuperConstructor',
|
||||
'GetTemplateObject',
|
||||
'GetThisEnvironment',
|
||||
'GetThisValue',
|
||||
'GetValue',
|
||||
'GetValueFromBuffer',
|
||||
'GetViewValue',
|
||||
'GetWaiterList',
|
||||
'GlobalDeclarationInstantiation',
|
||||
'happens-before',
|
||||
'HasPrimitiveBase',
|
||||
'host-synchronizes-with',
|
||||
'HostEnsureCanCompileStrings',
|
||||
'HostEventSet',
|
||||
'HostPromiseRejectionTracker',
|
||||
'HostReportErrors',
|
||||
'HostResolveImportedModule',
|
||||
'IfAbruptRejectPromise',
|
||||
'ImportedLocalNames',
|
||||
'InitializeBoundName',
|
||||
'InitializeEnvironment',
|
||||
'InitializeHostDefinedRealm',
|
||||
'InitializeReferencedBinding',
|
||||
'InnerModuleEvaluation',
|
||||
'InnerModuleInstantiation',
|
||||
'IntegerIndexedElementGet',
|
||||
'IntegerIndexedElementSet',
|
||||
'IntegerIndexedObjectCreate',
|
||||
'InternalizeJSONProperty',
|
||||
'IsAnonymousFunctionDefinition',
|
||||
'IsCompatiblePropertyDescriptor',
|
||||
'IsDetachedBuffer',
|
||||
'IsInTailPosition',
|
||||
'IsLabelledFunction',
|
||||
'IsPropertyReference',
|
||||
'IsSharedArrayBuffer',
|
||||
'IsStrictReference',
|
||||
'IsSuperReference',
|
||||
'IsUnresolvableReference',
|
||||
'IsWordChar',
|
||||
'LeaveCriticalSection',
|
||||
'LocalTime',
|
||||
'LoopContinues',
|
||||
'MakeArgGetter',
|
||||
'MakeArgSetter',
|
||||
'MakeClassConstructor',
|
||||
'MakeConstructor',
|
||||
'MakeMethod',
|
||||
'MakeSuperPropertyReference',
|
||||
'max',
|
||||
'memory-order',
|
||||
'min',
|
||||
'ModuleDeclarationEnvironmentSetup',
|
||||
'ModuleExecution',
|
||||
'ModuleNamespaceCreate',
|
||||
'NewDeclarativeEnvironment',
|
||||
'NewFunctionEnvironment',
|
||||
'NewGlobalEnvironment',
|
||||
'NewModuleEnvironment',
|
||||
'NewObjectEnvironment',
|
||||
'NewPromiseCapability',
|
||||
'NormalCompletion',
|
||||
'NotifyWaiter',
|
||||
'NumberToRawBytes',
|
||||
'ObjectDefineProperties',
|
||||
'OrdinaryCallBindThis',
|
||||
'OrdinaryCallEvaluateBody',
|
||||
'OrdinaryDelete',
|
||||
'OrdinaryGet',
|
||||
'OrdinaryIsExtensible',
|
||||
'OrdinaryOwnPropertyKeys',
|
||||
'OrdinaryPreventExtensions',
|
||||
'OrdinarySet',
|
||||
'OrdinarySetWithOwnDescriptor',
|
||||
'OrdinaryToPrimitive',
|
||||
'ParseModule',
|
||||
'ParseScript',
|
||||
'PerformEval',
|
||||
'PerformPromiseAll',
|
||||
'PerformPromiseRace',
|
||||
'PerformPromiseThen',
|
||||
'PrepareForOrdinaryCall',
|
||||
'PrepareForTailCall',
|
||||
'PromiseReactionJob',
|
||||
'PromiseResolveThenableJob',
|
||||
'ProxyCreate',
|
||||
'PutValue',
|
||||
'RawBytesToNumber',
|
||||
'reads-bytes-from',
|
||||
'reads-from',
|
||||
'RegExpAlloc',
|
||||
'RegExpBuiltinExec',
|
||||
'RegExpCreate',
|
||||
'RegExpInitialize',
|
||||
'RejectPromise',
|
||||
'RemoveWaiter',
|
||||
'RemoveWaiters',
|
||||
'RepeatMatcher',
|
||||
'ResolveBinding',
|
||||
'ResolveThisBinding',
|
||||
'ReturnIfAbrupt',
|
||||
'RunJobs',
|
||||
'ScriptEvaluation',
|
||||
'ScriptEvaluationJob',
|
||||
'SerializeJSONArray',
|
||||
'SerializeJSONObject',
|
||||
'SerializeJSONProperty',
|
||||
'SetDefaultGlobalBindings',
|
||||
'SetImmutablePrototype',
|
||||
'SetRealmGlobalObject',
|
||||
'SetValueInBuffer',
|
||||
'SetViewValue',
|
||||
'SharedDataBlockEventSet',
|
||||
'SortCompare',
|
||||
'SplitMatch',
|
||||
'StringCreate',
|
||||
'Suspend',
|
||||
'SynchronizeEventSet',
|
||||
'synchronizes-with',
|
||||
'ThrowCompletion',
|
||||
'TimeZoneString',
|
||||
'TopLevelModuleEvaluationJob',
|
||||
'TriggerPromiseReactions',
|
||||
'TypedArrayCreate',
|
||||
'TypedArraySpeciesCreate',
|
||||
'UnicodeMatchProperty',
|
||||
'UnicodeMatchPropertyValue',
|
||||
'UpdateEmpty',
|
||||
'UTC', // depends on LocalTZA'UTC',
|
||||
'UTF16Decode',
|
||||
'ValidateAtomicAccess',
|
||||
'ValidateSharedIntegerTypedArray',
|
||||
'ValidateTypedArray',
|
||||
'ValueOfReadEvent',
|
||||
'WakeWaiter',
|
||||
'WordCharacters' // depends on Canonicalize
|
||||
];
|
||||
|
||||
require('./tests').es2019(boundES, ops, expectedMissing);
|
||||
|
||||
require('./helpers/runManifestTest')(require('tape'), ES, 2019);
|
267
node_modules/es-abstract/test/es2020.js
generated
vendored
Normal file
267
node_modules/es-abstract/test/es2020.js
generated
vendored
Normal file
@ -0,0 +1,267 @@
|
||||
'use strict';
|
||||
|
||||
var ES = require('../').ES2020;
|
||||
var boundES = require('./helpers/createBoundESNamespace')(ES);
|
||||
|
||||
var ops = require('../operations/2020');
|
||||
|
||||
var expectedMissing = [
|
||||
'AddRestrictedFunctionProperties',
|
||||
'AddWaiter',
|
||||
'agent-order',
|
||||
'AgentCanSuspend',
|
||||
'AgentSignifier',
|
||||
'AllocateArrayBuffer',
|
||||
'AllocateSharedArrayBuffer',
|
||||
'AllocateTypedArray',
|
||||
'AllocateTypedArrayBuffer',
|
||||
'AsyncFromSyncIteratorContinuation',
|
||||
'AsyncFunctionCreate',
|
||||
'AsyncFunctionStart',
|
||||
'AsyncGeneratorEnqueue',
|
||||
'AsyncGeneratorFunctionCreate',
|
||||
'AsyncGeneratorReject',
|
||||
'AsyncGeneratorResolve',
|
||||
'AsyncGeneratorResumeNext',
|
||||
'AsyncGeneratorStart',
|
||||
'AsyncGeneratorYield',
|
||||
'AsyncIteratorClose',
|
||||
'AtomicLoad',
|
||||
'AtomicReadModifyWrite',
|
||||
'Await',
|
||||
'BackreferenceMatcher',
|
||||
'BigInt::toString',
|
||||
'BlockDeclarationInstantiation',
|
||||
'BoundFunctionCreate',
|
||||
'Canonicalize',
|
||||
'CaseClauseIsSelected',
|
||||
'CharacterRange',
|
||||
'CharacterRangeOrUnion',
|
||||
'CharacterSetMatcher',
|
||||
'CloneArrayBuffer',
|
||||
'Completion',
|
||||
'ComposeWriteEventBytes',
|
||||
'Construct',
|
||||
'CopyDataBlockBytes',
|
||||
'CreateArrayFromList',
|
||||
'CreateArrayIterator',
|
||||
'CreateAsyncFromSyncIterator',
|
||||
'CreateBuiltinFunction',
|
||||
'CreateByteDataBlock',
|
||||
'CreateDynamicFunction',
|
||||
'CreateForInIterator',
|
||||
'CreateIntrinsics',
|
||||
'CreateListIteratorRecord',
|
||||
'CreateMapIterator',
|
||||
'CreateMappedArgumentsObject',
|
||||
'CreatePerIterationEnvironment',
|
||||
'CreateRealm',
|
||||
'CreateRegExpStringIterator',
|
||||
'CreateResolvingFunctions',
|
||||
'CreateSetIterator',
|
||||
'CreateSharedByteDataBlock',
|
||||
'CreateStringIterator',
|
||||
'CreateUnmappedArgumentsObject',
|
||||
'Decode',
|
||||
'DetachArrayBuffer',
|
||||
'Encode',
|
||||
'EnqueueJob',
|
||||
'EnterCriticalSection',
|
||||
'EnumerateObjectProperties',
|
||||
'EscapeRegExpPattern',
|
||||
'EvalDeclarationInstantiation',
|
||||
'EvaluateCall',
|
||||
'EvaluateNew',
|
||||
'EvaluatePropertyAccessWithExpressionKey',
|
||||
'EvaluatePropertyAccessWithIdentifierKey',
|
||||
'EventSet',
|
||||
'ExecuteModule',
|
||||
'FinishDynamicImport',
|
||||
'ForBodyEvaluation',
|
||||
'ForIn/OfBodyEvaluation',
|
||||
'ForIn/OfHeadEvaluation',
|
||||
'FulfillPromise',
|
||||
'FunctionAllocate',
|
||||
'FunctionCreate',
|
||||
'FunctionDeclarationInstantiation',
|
||||
'FunctionInitialize',
|
||||
'GeneratorFunctionCreate',
|
||||
'GeneratorResume',
|
||||
'GeneratorResumeAbrupt',
|
||||
'GeneratorStart',
|
||||
'GeneratorValidate',
|
||||
'GeneratorYield',
|
||||
'GetActiveScriptOrModule',
|
||||
'GetBase',
|
||||
'GetFunctionRealm',
|
||||
'GetGeneratorKind',
|
||||
'GetGlobalObject',
|
||||
'GetIdentifierReference',
|
||||
'GetModifySetValueInBuffer',
|
||||
'GetModuleNamespace',
|
||||
'GetNewTarget',
|
||||
'GetReferencedName',
|
||||
'GetSuperConstructor',
|
||||
'GetTemplateObject',
|
||||
'GetThisEnvironment',
|
||||
'GetThisValue',
|
||||
'GetValue',
|
||||
'GetValueFromBuffer',
|
||||
'GetViewValue',
|
||||
'GetWaiterList',
|
||||
'GlobalDeclarationInstantiation',
|
||||
'happens-before',
|
||||
'HasPrimitiveBase',
|
||||
'host-synchronizes-with',
|
||||
'HostEnqueuePromiseJob',
|
||||
'HostEnsureCanCompileStrings',
|
||||
'HostEventSet',
|
||||
'HostFinalizeImportMeta',
|
||||
'HostGetImportMetaProperties',
|
||||
'HostImportModuleDynamically',
|
||||
'HostPromiseRejectionTracker',
|
||||
'HostReportErrors',
|
||||
'HostResolveImportedModule',
|
||||
'IfAbruptRejectPromise',
|
||||
'ImportedLocalNames',
|
||||
'InitializeBoundName',
|
||||
'InitializeEnvironment',
|
||||
'InitializeHostDefinedRealm',
|
||||
'InitializeReferencedBinding',
|
||||
'InnerModuleEvaluation',
|
||||
'InnerModuleInstantiation',
|
||||
'InnerModuleLinking',
|
||||
'IntegerIndexedElementGet',
|
||||
'IntegerIndexedElementSet',
|
||||
'IntegerIndexedObjectCreate',
|
||||
'InternalizeJSONProperty',
|
||||
'IsAnonymousFunctionDefinition',
|
||||
'IsCompatiblePropertyDescriptor',
|
||||
'IsDetachedBuffer',
|
||||
'IsInTailPosition',
|
||||
'IsLabelledFunction',
|
||||
'IsPropertyReference',
|
||||
'IsSharedArrayBuffer',
|
||||
'IsStrictReference',
|
||||
'IsSuperReference',
|
||||
'IsUnresolvableReference',
|
||||
'IsValidIntegerIndex',
|
||||
'IsValidRegularExpressionLiteral',
|
||||
'IsWordChar',
|
||||
'LeaveCriticalSection',
|
||||
'LocalTime',
|
||||
'LocalTZA',
|
||||
'LoopContinues',
|
||||
'MakeArgGetter',
|
||||
'MakeArgSetter',
|
||||
'MakeBasicObject',
|
||||
'MakeClassConstructor',
|
||||
'MakeConstructor',
|
||||
'MakeMethod',
|
||||
'MakeSuperPropertyReference',
|
||||
'max',
|
||||
'memory-order',
|
||||
'min',
|
||||
'ModuleDeclarationEnvironmentSetup',
|
||||
'ModuleExecution',
|
||||
'ModuleNamespaceCreate',
|
||||
'NewDeclarativeEnvironment',
|
||||
'NewFunctionEnvironment',
|
||||
'NewGlobalEnvironment',
|
||||
'NewModuleEnvironment',
|
||||
'NewObjectEnvironment',
|
||||
'NewPromiseCapability',
|
||||
'NewPromiseReactionJob',
|
||||
'NewPromiseResolveThenableJob',
|
||||
'NormalCompletion',
|
||||
'NotifyWaiter',
|
||||
'Number::toString',
|
||||
'NumberToBigInt',
|
||||
'NumberToRawBytes',
|
||||
'NumericToRawBytes',
|
||||
'ObjectDefineProperties',
|
||||
'OrdinaryCallBindThis',
|
||||
'OrdinaryCallEvaluateBody',
|
||||
'OrdinaryDelete',
|
||||
'OrdinaryFunctionCreate',
|
||||
'OrdinaryGet',
|
||||
'OrdinaryIsExtensible',
|
||||
'OrdinaryOwnPropertyKeys',
|
||||
'OrdinaryPreventExtensions',
|
||||
'OrdinarySet',
|
||||
'OrdinarySetWithOwnDescriptor',
|
||||
'OrdinaryToPrimitive',
|
||||
'ParseModule',
|
||||
'ParseScript',
|
||||
'PerformEval',
|
||||
'PerformPromiseAll',
|
||||
'PerformPromiseAllSettled',
|
||||
'PerformPromiseRace',
|
||||
'PerformPromiseThen',
|
||||
'PrepareForOrdinaryCall',
|
||||
'PrepareForTailCall',
|
||||
'PromiseReactionJob',
|
||||
'PromiseResolveThenableJob',
|
||||
'ProxyCreate',
|
||||
'PutValue',
|
||||
'RawBytesToNumber',
|
||||
'RawBytesToNumeric',
|
||||
'reads-bytes-from',
|
||||
'reads-from',
|
||||
'RegExpAlloc',
|
||||
'RegExpBuiltinExec',
|
||||
'RegExpCreate',
|
||||
'RegExpInitialize',
|
||||
'RejectPromise',
|
||||
'RemoveWaiter',
|
||||
'RemoveWaiters',
|
||||
'RepeatMatcher',
|
||||
'RequireInternalSlot',
|
||||
'ResolveBinding',
|
||||
'ResolveThisBinding',
|
||||
'ReturnIfAbrupt',
|
||||
'RunJobs',
|
||||
'ScriptEvaluation',
|
||||
'ScriptEvaluationJob',
|
||||
'SerializeJSONArray',
|
||||
'SerializeJSONObject',
|
||||
'SerializeJSONProperty',
|
||||
'SetDefaultGlobalBindings',
|
||||
'SetImmutablePrototype',
|
||||
'SetRealmGlobalObject',
|
||||
'SetValueInBuffer',
|
||||
'SetViewValue',
|
||||
'SharedDataBlockEventSet',
|
||||
'SortCompare',
|
||||
'SplitMatch',
|
||||
'StringCreate',
|
||||
'StringToBigInt',
|
||||
'Suspend',
|
||||
'SynchronizeEventSet',
|
||||
'synchronizes-with',
|
||||
'ThrowCompletion',
|
||||
'TimeZoneString',
|
||||
'ToBigInt',
|
||||
'ToBigInt64',
|
||||
'ToBigUint64',
|
||||
'TopLevelModuleEvaluationJob',
|
||||
'TriggerPromiseReactions',
|
||||
'TypedArrayCreate',
|
||||
'TypedArraySpeciesCreate',
|
||||
'UnicodeMatchProperty',
|
||||
'UnicodeMatchPropertyValue',
|
||||
'UpdateEmpty',
|
||||
'UTC', // depends on LocalTZA
|
||||
'UTF16Decode',
|
||||
'UTF16Encode',
|
||||
'ValidateAtomicAccess',
|
||||
'ValidateSharedIntegerTypedArray',
|
||||
'ValidateTypedArray',
|
||||
'ValueOfReadEvent',
|
||||
'WakeWaiter',
|
||||
'WordCharacters' // depends on Canonicalize
|
||||
];
|
||||
|
||||
require('./tests').es2020(boundES, ops, expectedMissing);
|
||||
|
||||
require('./helpers/runManifestTest')(require('tape'), ES, 2020);
|
786
node_modules/es-abstract/test/es5.js
generated
vendored
Normal file
786
node_modules/es-abstract/test/es5.js
generated
vendored
Normal file
@ -0,0 +1,786 @@
|
||||
'use strict';
|
||||
|
||||
var ES = require('../').ES5;
|
||||
var test = require('tape');
|
||||
|
||||
var forEach = require('foreach');
|
||||
var is = require('object-is');
|
||||
var debug = require('object-inspect');
|
||||
|
||||
var v = require('./helpers/values');
|
||||
|
||||
require('./helpers/runManifestTest')(test, ES, 5);
|
||||
|
||||
ES = require('./helpers/createBoundESNamespace')(ES);
|
||||
|
||||
test('ToPrimitive', function (t) {
|
||||
t.test('primitives', function (st) {
|
||||
var testPrimitive = function (primitive) {
|
||||
st.ok(is(ES.ToPrimitive(primitive), primitive), debug(primitive) + ' is returned correctly');
|
||||
};
|
||||
forEach(v.primitives, testPrimitive);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('objects', function (st) {
|
||||
st.equal(ES.ToPrimitive(v.coercibleObject), v.coercibleObject.valueOf(), 'coercibleObject coerces to valueOf');
|
||||
st.equal(ES.ToPrimitive(v.coercibleObject, Number), v.coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf');
|
||||
st.equal(ES.ToPrimitive(v.coercibleObject, String), v.coercibleObject.toString(), 'coercibleObject with hint String coerces to toString');
|
||||
st.equal(ES.ToPrimitive(v.coercibleFnObject), v.coercibleFnObject.toString(), 'coercibleFnObject coerces to toString');
|
||||
st.equal(ES.ToPrimitive(v.toStringOnlyObject), v.toStringOnlyObject.toString(), 'toStringOnlyObject returns toString');
|
||||
st.equal(ES.ToPrimitive(v.valueOfOnlyObject), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf');
|
||||
st.equal(ES.ToPrimitive({}), '[object Object]', '{} with no hint coerces to Object#toString');
|
||||
st.equal(ES.ToPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString');
|
||||
st.equal(ES.ToPrimitive({}, Number), '[object Object]', '{} with hint Number coerces to Object#toString');
|
||||
st['throws'](function () { return ES.ToPrimitive(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError');
|
||||
st['throws'](function () { return ES.ToPrimitive(v.uncoercibleFnObject); }, TypeError, 'uncoercibleFnObject throws a TypeError');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('ToBoolean', function (t) {
|
||||
t.equal(false, ES.ToBoolean(undefined), 'undefined coerces to false');
|
||||
t.equal(false, ES.ToBoolean(null), 'null coerces to false');
|
||||
t.equal(false, ES.ToBoolean(false), 'false returns false');
|
||||
t.equal(true, ES.ToBoolean(true), 'true returns true');
|
||||
forEach([0, -0, NaN], function (falsyNumber) {
|
||||
t.equal(false, ES.ToBoolean(falsyNumber), 'falsy number ' + falsyNumber + ' coerces to false');
|
||||
});
|
||||
forEach([Infinity, 42, 1, -Infinity], function (truthyNumber) {
|
||||
t.equal(true, ES.ToBoolean(truthyNumber), 'truthy number ' + truthyNumber + ' coerces to true');
|
||||
});
|
||||
t.equal(false, ES.ToBoolean(''), 'empty string coerces to false');
|
||||
t.equal(true, ES.ToBoolean('foo'), 'nonempty string coerces to true');
|
||||
forEach(v.objects, function (obj) {
|
||||
t.equal(true, ES.ToBoolean(obj), 'object coerces to true');
|
||||
});
|
||||
t.equal(true, ES.ToBoolean(v.uncoercibleObject), 'uncoercibleObject coerces to true');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('ToNumber', function (t) {
|
||||
t.ok(is(NaN, ES.ToNumber(undefined)), 'undefined coerces to NaN');
|
||||
t.ok(is(ES.ToNumber(null), 0), 'null coerces to +0');
|
||||
t.ok(is(ES.ToNumber(false), 0), 'false coerces to +0');
|
||||
t.equal(1, ES.ToNumber(true), 'true coerces to 1');
|
||||
t.ok(is(NaN, ES.ToNumber(NaN)), 'NaN returns itself');
|
||||
forEach([0, -0, 42, Infinity, -Infinity], function (num) {
|
||||
t.equal(num, ES.ToNumber(num), num + ' returns itself');
|
||||
});
|
||||
forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) {
|
||||
t.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + Number(numString));
|
||||
});
|
||||
forEach(v.objects, function (object) {
|
||||
t.ok(is(ES.ToNumber(object), ES.ToNumber(ES.ToPrimitive(object))), 'object ' + object + ' coerces to same as ToPrimitive of object does');
|
||||
});
|
||||
t['throws'](function () { return ES.ToNumber(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('ToInteger', function (t) {
|
||||
t.ok(is(0, ES.ToInteger(NaN)), 'NaN coerces to +0');
|
||||
forEach([0, Infinity, 42], function (num) {
|
||||
t.ok(is(num, ES.ToInteger(num)), num + ' returns itself');
|
||||
t.ok(is(-num, ES.ToInteger(-num)), '-' + num + ' returns itself');
|
||||
});
|
||||
t.equal(3, ES.ToInteger(Math.PI), 'pi returns 3');
|
||||
t['throws'](function () { return ES.ToInteger(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('ToInt32', function (t) {
|
||||
t.ok(is(0, ES.ToInt32(NaN)), 'NaN coerces to +0');
|
||||
forEach([0, Infinity], function (num) {
|
||||
t.ok(is(0, ES.ToInt32(num)), num + ' returns +0');
|
||||
t.ok(is(0, ES.ToInt32(-num)), '-' + num + ' returns +0');
|
||||
});
|
||||
t['throws'](function () { return ES.ToInt32(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
|
||||
t.ok(is(ES.ToInt32(0x100000000), 0), '2^32 returns +0');
|
||||
t.ok(is(ES.ToInt32(0x100000000 - 1), -1), '2^32 - 1 returns -1');
|
||||
t.ok(is(ES.ToInt32(0x80000000), -0x80000000), '2^31 returns -2^31');
|
||||
t.ok(is(ES.ToInt32(0x80000000 - 1), 0x80000000 - 1), '2^31 - 1 returns 2^31 - 1');
|
||||
forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) {
|
||||
t.ok(is(ES.ToInt32(num), ES.ToInt32(ES.ToUint32(num))), 'ToInt32(x) === ToInt32(ToUint32(x)) for 0x' + num.toString(16));
|
||||
t.ok(is(ES.ToInt32(-num), ES.ToInt32(ES.ToUint32(-num))), 'ToInt32(x) === ToInt32(ToUint32(x)) for -0x' + num.toString(16));
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('ToUint32', function (t) {
|
||||
t.ok(is(0, ES.ToUint32(NaN)), 'NaN coerces to +0');
|
||||
forEach([0, Infinity], function (num) {
|
||||
t.ok(is(0, ES.ToUint32(num)), num + ' returns +0');
|
||||
t.ok(is(0, ES.ToUint32(-num)), '-' + num + ' returns +0');
|
||||
});
|
||||
t['throws'](function () { return ES.ToUint32(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
|
||||
t.ok(is(ES.ToUint32(0x100000000), 0), '2^32 returns +0');
|
||||
t.ok(is(ES.ToUint32(0x100000000 - 1), 0x100000000 - 1), '2^32 - 1 returns 2^32 - 1');
|
||||
t.ok(is(ES.ToUint32(0x80000000), 0x80000000), '2^31 returns 2^31');
|
||||
t.ok(is(ES.ToUint32(0x80000000 - 1), 0x80000000 - 1), '2^31 - 1 returns 2^31 - 1');
|
||||
forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) {
|
||||
t.ok(is(ES.ToUint32(num), ES.ToUint32(ES.ToInt32(num))), 'ToUint32(x) === ToUint32(ToInt32(x)) for 0x' + num.toString(16));
|
||||
t.ok(is(ES.ToUint32(-num), ES.ToUint32(ES.ToInt32(-num))), 'ToUint32(x) === ToUint32(ToInt32(x)) for -0x' + num.toString(16));
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('ToUint16', function (t) {
|
||||
t.ok(is(0, ES.ToUint16(NaN)), 'NaN coerces to +0');
|
||||
forEach([0, Infinity], function (num) {
|
||||
t.ok(is(0, ES.ToUint16(num)), num + ' returns +0');
|
||||
t.ok(is(0, ES.ToUint16(-num)), '-' + num + ' returns +0');
|
||||
});
|
||||
t['throws'](function () { return ES.ToUint16(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
|
||||
t.ok(is(ES.ToUint16(0x100000000), 0), '2^32 returns +0');
|
||||
t.ok(is(ES.ToUint16(0x100000000 - 1), 0x10000 - 1), '2^32 - 1 returns 2^16 - 1');
|
||||
t.ok(is(ES.ToUint16(0x80000000), 0), '2^31 returns +0');
|
||||
t.ok(is(ES.ToUint16(0x80000000 - 1), 0x10000 - 1), '2^31 - 1 returns 2^16 - 1');
|
||||
t.ok(is(ES.ToUint16(0x10000), 0), '2^16 returns +0');
|
||||
t.ok(is(ES.ToUint16(0x10000 - 1), 0x10000 - 1), '2^16 - 1 returns 2^16 - 1');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('ToString', function (t) {
|
||||
t['throws'](function () { return ES.ToString(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('ToObject', function (t) {
|
||||
t['throws'](function () { return ES.ToObject(undefined); }, TypeError, 'undefined throws');
|
||||
t['throws'](function () { return ES.ToObject(null); }, TypeError, 'null throws');
|
||||
forEach(v.numbers, function (number) {
|
||||
var obj = ES.ToObject(number);
|
||||
t.equal(typeof obj, 'object', 'number ' + number + ' coerces to object');
|
||||
t.equal(true, obj instanceof Number, 'object of ' + number + ' is Number object');
|
||||
t.ok(is(obj.valueOf(), number), 'object of ' + number + ' coerces to ' + number);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('CheckObjectCoercible', function (t) {
|
||||
t['throws'](function () { return ES.CheckObjectCoercible(undefined); }, TypeError, 'undefined throws');
|
||||
t['throws'](function () { return ES.CheckObjectCoercible(null); }, TypeError, 'null throws');
|
||||
var checkCoercible = function (value) {
|
||||
t.doesNotThrow(function () { return ES.CheckObjectCoercible(value); }, debug(value) + ' does not throw');
|
||||
};
|
||||
forEach(v.objects.concat(v.nonNullPrimitives), checkCoercible);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('IsCallable', function (t) {
|
||||
t.equal(true, ES.IsCallable(function () {}), 'function is callable');
|
||||
var nonCallables = [/a/g, {}, Object.prototype, NaN].concat(v.primitives);
|
||||
forEach(nonCallables, function (nonCallable) {
|
||||
t.equal(false, ES.IsCallable(nonCallable), debug(nonCallable) + ' is not callable');
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('SameValue', function (t) {
|
||||
t.equal(true, ES.SameValue(NaN, NaN), 'NaN is SameValue as NaN');
|
||||
t.equal(false, ES.SameValue(0, -0), '+0 is not SameValue as -0');
|
||||
forEach(v.objects.concat(v.primitives), function (val) {
|
||||
t.equal(val === val, ES.SameValue(val, val), debug(val) + ' is SameValue to itself');
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Type', function (t) {
|
||||
t.equal(ES.Type(), 'Undefined', 'Type() is Undefined');
|
||||
t.equal(ES.Type(undefined), 'Undefined', 'Type(undefined) is Undefined');
|
||||
t.equal(ES.Type(null), 'Null', 'Type(null) is Null');
|
||||
t.equal(ES.Type(true), 'Boolean', 'Type(true) is Boolean');
|
||||
t.equal(ES.Type(false), 'Boolean', 'Type(false) is Boolean');
|
||||
t.equal(ES.Type(0), 'Number', 'Type(0) is Number');
|
||||
t.equal(ES.Type(NaN), 'Number', 'Type(NaN) is Number');
|
||||
t.equal(ES.Type('abc'), 'String', 'Type("abc") is String');
|
||||
t.equal(ES.Type(function () {}), 'Object', 'Type(function () {}) is Object');
|
||||
t.equal(ES.Type({}), 'Object', 'Type({}) is Object');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('IsPropertyDescriptor', function (t) {
|
||||
forEach(v.primitives, function (primitive) {
|
||||
t.equal(ES.IsPropertyDescriptor(primitive), false, debug(primitive) + ' is not a Property Descriptor');
|
||||
});
|
||||
|
||||
t.equal(ES.IsPropertyDescriptor({ invalid: true }), false, 'invalid keys not allowed on a Property Descriptor');
|
||||
|
||||
t.equal(ES.IsPropertyDescriptor({}), true, 'empty object is an incomplete Property Descriptor');
|
||||
|
||||
t.equal(ES.IsPropertyDescriptor(v.accessorDescriptor()), true, 'accessor descriptor is a Property Descriptor');
|
||||
t.equal(ES.IsPropertyDescriptor(v.mutatorDescriptor()), true, 'mutator descriptor is a Property Descriptor');
|
||||
t.equal(ES.IsPropertyDescriptor(v.dataDescriptor()), true, 'data descriptor is a Property Descriptor');
|
||||
t.equal(ES.IsPropertyDescriptor(v.genericDescriptor()), true, 'generic descriptor is a Property Descriptor');
|
||||
|
||||
t['throws'](
|
||||
function () { ES.IsPropertyDescriptor(v.bothDescriptor()); },
|
||||
TypeError,
|
||||
'a Property Descriptor can not be both a Data and an Accessor Descriptor'
|
||||
);
|
||||
|
||||
t['throws'](
|
||||
function () { ES.IsPropertyDescriptor(v.bothDescriptorWritable()); },
|
||||
TypeError,
|
||||
'a Property Descriptor can not be both a Data and an Accessor Descriptor'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('IsAccessorDescriptor', function (t) {
|
||||
forEach(v.nonNullPrimitives.concat(null), function (primitive) {
|
||||
t['throws'](function () { ES.IsAccessorDescriptor(primitive); }, TypeError, debug(primitive) + ' is not a Property Descriptor');
|
||||
});
|
||||
|
||||
t.equal(ES.IsAccessorDescriptor(), false, 'no value is not an Accessor Descriptor');
|
||||
t.equal(ES.IsAccessorDescriptor(undefined), false, 'undefined value is not an Accessor Descriptor');
|
||||
|
||||
t.equal(ES.IsAccessorDescriptor(v.accessorDescriptor()), true, 'accessor descriptor is an Accessor Descriptor');
|
||||
t.equal(ES.IsAccessorDescriptor(v.mutatorDescriptor()), true, 'mutator descriptor is an Accessor Descriptor');
|
||||
t.equal(ES.IsAccessorDescriptor(v.dataDescriptor()), false, 'data descriptor is not an Accessor Descriptor');
|
||||
t.equal(ES.IsAccessorDescriptor(v.genericDescriptor()), false, 'generic descriptor is not an Accessor Descriptor');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('IsDataDescriptor', function (t) {
|
||||
forEach(v.nonNullPrimitives.concat(null), function (primitive) {
|
||||
t['throws'](function () { ES.IsDataDescriptor(primitive); }, TypeError, debug(primitive) + ' is not a Property Descriptor');
|
||||
});
|
||||
|
||||
t.equal(ES.IsDataDescriptor(), false, 'no value is not a Data Descriptor');
|
||||
t.equal(ES.IsDataDescriptor(undefined), false, 'undefined value is not a Data Descriptor');
|
||||
|
||||
t.equal(ES.IsDataDescriptor(v.accessorDescriptor()), false, 'accessor descriptor is not a Data Descriptor');
|
||||
t.equal(ES.IsDataDescriptor(v.mutatorDescriptor()), false, 'mutator descriptor is not a Data Descriptor');
|
||||
t.equal(ES.IsDataDescriptor(v.dataDescriptor()), true, 'data descriptor is a Data Descriptor');
|
||||
t.equal(ES.IsDataDescriptor(v.genericDescriptor()), false, 'generic descriptor is not a Data Descriptor');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('IsGenericDescriptor', function (t) {
|
||||
forEach(v.nonNullPrimitives.concat(null), function (primitive) {
|
||||
t['throws'](
|
||||
function () { ES.IsGenericDescriptor(primitive); },
|
||||
TypeError,
|
||||
debug(primitive) + ' is not a Property Descriptor'
|
||||
);
|
||||
});
|
||||
|
||||
t.equal(ES.IsGenericDescriptor(), false, 'no value is not a Data Descriptor');
|
||||
t.equal(ES.IsGenericDescriptor(undefined), false, 'undefined value is not a Data Descriptor');
|
||||
|
||||
t.equal(ES.IsGenericDescriptor(v.accessorDescriptor()), false, 'accessor descriptor is not a generic Descriptor');
|
||||
t.equal(ES.IsGenericDescriptor(v.mutatorDescriptor()), false, 'mutator descriptor is not a generic Descriptor');
|
||||
t.equal(ES.IsGenericDescriptor(v.dataDescriptor()), false, 'data descriptor is not a generic Descriptor');
|
||||
|
||||
t.equal(ES.IsGenericDescriptor(v.genericDescriptor()), true, 'generic descriptor is a generic Descriptor');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('FromPropertyDescriptor', function (t) {
|
||||
t.equal(ES.FromPropertyDescriptor(), undefined, 'no value begets undefined');
|
||||
t.equal(ES.FromPropertyDescriptor(undefined), undefined, 'undefined value begets undefined');
|
||||
|
||||
forEach(v.nonNullPrimitives.concat(null), function (primitive) {
|
||||
t['throws'](
|
||||
function () { ES.FromPropertyDescriptor(primitive); },
|
||||
TypeError,
|
||||
debug(primitive) + ' is not a Property Descriptor'
|
||||
);
|
||||
});
|
||||
|
||||
var accessor = v.accessorDescriptor();
|
||||
t.deepEqual(ES.FromPropertyDescriptor(accessor), {
|
||||
get: accessor['[[Get]]'],
|
||||
set: accessor['[[Set]]'],
|
||||
enumerable: !!accessor['[[Enumerable]]'],
|
||||
configurable: !!accessor['[[Configurable]]']
|
||||
});
|
||||
|
||||
var mutator = v.mutatorDescriptor();
|
||||
t.deepEqual(ES.FromPropertyDescriptor(mutator), {
|
||||
get: mutator['[[Get]]'],
|
||||
set: mutator['[[Set]]'],
|
||||
enumerable: !!mutator['[[Enumerable]]'],
|
||||
configurable: !!mutator['[[Configurable]]']
|
||||
});
|
||||
var data = v.dataDescriptor();
|
||||
t.deepEqual(ES.FromPropertyDescriptor(data), {
|
||||
value: data['[[Value]]'],
|
||||
writable: data['[[Writable]]'],
|
||||
enumerable: !!data['[[Enumerable]]'],
|
||||
configurable: !!data['[[Configurable]]']
|
||||
});
|
||||
|
||||
t['throws'](
|
||||
function () { ES.FromPropertyDescriptor(v.genericDescriptor()); },
|
||||
TypeError,
|
||||
'a complete Property Descriptor is required'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('ToPropertyDescriptor', function (t) {
|
||||
forEach(v.nonNullPrimitives.concat(null), function (primitive) {
|
||||
t['throws'](
|
||||
function () { ES.ToPropertyDescriptor(primitive); },
|
||||
TypeError,
|
||||
debug(primitive) + ' is not an Object'
|
||||
);
|
||||
});
|
||||
|
||||
var accessor = v.accessorDescriptor();
|
||||
t.deepEqual(ES.ToPropertyDescriptor({
|
||||
get: accessor['[[Get]]'],
|
||||
enumerable: !!accessor['[[Enumerable]]'],
|
||||
configurable: !!accessor['[[Configurable]]']
|
||||
}), accessor);
|
||||
|
||||
var mutator = v.mutatorDescriptor();
|
||||
t.deepEqual(ES.ToPropertyDescriptor({
|
||||
set: mutator['[[Set]]'],
|
||||
enumerable: !!mutator['[[Enumerable]]'],
|
||||
configurable: !!mutator['[[Configurable]]']
|
||||
}), mutator);
|
||||
|
||||
var data = v.descriptors.nonConfigurable(v.dataDescriptor());
|
||||
t.deepEqual(ES.ToPropertyDescriptor({
|
||||
value: data['[[Value]]'],
|
||||
writable: data['[[Writable]]'],
|
||||
configurable: !!data['[[Configurable]]']
|
||||
}), data);
|
||||
|
||||
var both = v.bothDescriptor();
|
||||
t['throws'](
|
||||
function () {
|
||||
ES.ToPropertyDescriptor({ get: both['[[Get]]'], value: both['[[Value]]'] });
|
||||
},
|
||||
TypeError,
|
||||
'data and accessor descriptors are mutually exclusive'
|
||||
);
|
||||
|
||||
t['throws'](
|
||||
function () { ES.ToPropertyDescriptor({ get: 'not callable' }); },
|
||||
TypeError,
|
||||
'"get" must be undefined or callable'
|
||||
);
|
||||
|
||||
t['throws'](
|
||||
function () { ES.ToPropertyDescriptor({ set: 'not callable' }); },
|
||||
TypeError,
|
||||
'"set" must be undefined or callable'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Abstract Equality Comparison', function (t) {
|
||||
t.test('same types use ===', function (st) {
|
||||
forEach(v.primitives.concat(v.objects), function (value) {
|
||||
st.equal(ES['Abstract Equality Comparison'](value, value), value === value, debug(value) + ' is abstractly equal to itself');
|
||||
});
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('different types coerce', function (st) {
|
||||
var pairs = [
|
||||
[null, undefined],
|
||||
[3, '3'],
|
||||
[true, '3'],
|
||||
[true, 3],
|
||||
[false, 0],
|
||||
[false, '0'],
|
||||
[3, [3]],
|
||||
['3', [3]],
|
||||
[true, [1]],
|
||||
[false, [0]],
|
||||
[String(v.coercibleObject), v.coercibleObject],
|
||||
[Number(String(v.coercibleObject)), v.coercibleObject],
|
||||
[Number(v.coercibleObject), v.coercibleObject],
|
||||
[String(Number(v.coercibleObject)), v.coercibleObject]
|
||||
];
|
||||
forEach(pairs, function (pair) {
|
||||
var a = pair[0];
|
||||
var b = pair[1];
|
||||
// eslint-disable-next-line eqeqeq
|
||||
st.equal(ES['Abstract Equality Comparison'](a, b), a == b, debug(a) + ' == ' + debug(b));
|
||||
// eslint-disable-next-line eqeqeq
|
||||
st.equal(ES['Abstract Equality Comparison'](b, a), b == a, debug(b) + ' == ' + debug(a));
|
||||
});
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Strict Equality Comparison', function (t) {
|
||||
t.test('same types use ===', function (st) {
|
||||
forEach(v.primitives.concat(v.objects), function (value) {
|
||||
st.equal(ES['Strict Equality Comparison'](value, value), value === value, debug(value) + ' is strictly equal to itself');
|
||||
});
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('different types are not ===', function (st) {
|
||||
var pairs = [
|
||||
[null, undefined],
|
||||
[3, '3'],
|
||||
[true, '3'],
|
||||
[true, 3],
|
||||
[false, 0],
|
||||
[false, '0'],
|
||||
[3, [3]],
|
||||
['3', [3]],
|
||||
[true, [1]],
|
||||
[false, [0]],
|
||||
[String(v.coercibleObject), v.coercibleObject],
|
||||
[Number(String(v.coercibleObject)), v.coercibleObject],
|
||||
[Number(v.coercibleObject), v.coercibleObject],
|
||||
[String(Number(v.coercibleObject)), v.coercibleObject]
|
||||
];
|
||||
forEach(pairs, function (pair) {
|
||||
var a = pair[0];
|
||||
var b = pair[1];
|
||||
st.equal(ES['Strict Equality Comparison'](a, b), a === b, debug(a) + ' === ' + debug(b));
|
||||
st.equal(ES['Strict Equality Comparison'](b, a), b === a, debug(b) + ' === ' + debug(a));
|
||||
});
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Abstract Relational Comparison', function (t) {
|
||||
t.test('at least one operand is NaN', function (st) {
|
||||
st.equal(ES['Abstract Relational Comparison'](NaN, {}, true), undefined, 'LeftFirst: first is NaN, returns undefined');
|
||||
st.equal(ES['Abstract Relational Comparison']({}, NaN, true), undefined, 'LeftFirst: second is NaN, returns undefined');
|
||||
st.equal(ES['Abstract Relational Comparison'](NaN, {}, false), undefined, '!LeftFirst: first is NaN, returns undefined');
|
||||
st.equal(ES['Abstract Relational Comparison']({}, NaN, false), undefined, '!LeftFirst: second is NaN, returns undefined');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.equal(ES['Abstract Relational Comparison'](3, 4, true), true, 'LeftFirst: 3 is less than 4');
|
||||
t.equal(ES['Abstract Relational Comparison'](4, 3, true), false, 'LeftFirst: 3 is not less than 4');
|
||||
t.equal(ES['Abstract Relational Comparison'](3, 4, false), true, '!LeftFirst: 3 is less than 4');
|
||||
t.equal(ES['Abstract Relational Comparison'](4, 3, false), false, '!LeftFirst: 3 is not less than 4');
|
||||
|
||||
t.equal(ES['Abstract Relational Comparison']('3', '4', true), true, 'LeftFirst: "3" is less than "4"');
|
||||
t.equal(ES['Abstract Relational Comparison']('4', '3', true), false, 'LeftFirst: "3" is not less than "4"');
|
||||
t.equal(ES['Abstract Relational Comparison']('3', '4', false), true, '!LeftFirst: "3" is less than "4"');
|
||||
t.equal(ES['Abstract Relational Comparison']('4', '3', false), false, '!LeftFirst: "3" is not less than "4"');
|
||||
|
||||
t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, 42, true), true, 'LeftFirst: coercible object is less than 42');
|
||||
t.equal(ES['Abstract Relational Comparison'](42, v.coercibleObject, true), false, 'LeftFirst: 42 is not less than coercible object');
|
||||
t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, 42, false), true, '!LeftFirst: coercible object is less than 42');
|
||||
t.equal(ES['Abstract Relational Comparison'](42, v.coercibleObject, false), false, '!LeftFirst: 42 is not less than coercible object');
|
||||
|
||||
t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, '3', true), false, 'LeftFirst: coercible object is not less than "3"');
|
||||
t.equal(ES['Abstract Relational Comparison']('3', v.coercibleObject, true), false, 'LeftFirst: "3" is not less than coercible object');
|
||||
t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, '3', false), false, '!LeftFirst: coercible object is not less than "3"');
|
||||
t.equal(ES['Abstract Relational Comparison']('3', v.coercibleObject, false), false, '!LeftFirst: "3" is not less than coercible object');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('FromPropertyDescriptor', function (t) {
|
||||
t.equal(ES.FromPropertyDescriptor(), undefined, 'no value begets undefined');
|
||||
t.equal(ES.FromPropertyDescriptor(undefined), undefined, 'undefined value begets undefined');
|
||||
|
||||
forEach(v.nonUndefinedPrimitives, function (primitive) {
|
||||
t['throws'](
|
||||
function () { ES.FromPropertyDescriptor(primitive); },
|
||||
TypeError,
|
||||
debug(primitive) + ' is not a Property Descriptor'
|
||||
);
|
||||
});
|
||||
|
||||
var accessor = v.accessorDescriptor();
|
||||
t.deepEqual(ES.FromPropertyDescriptor(accessor), {
|
||||
get: accessor['[[Get]]'],
|
||||
set: accessor['[[Set]]'],
|
||||
enumerable: !!accessor['[[Enumerable]]'],
|
||||
configurable: !!accessor['[[Configurable]]']
|
||||
});
|
||||
|
||||
var mutator = v.mutatorDescriptor();
|
||||
t.deepEqual(ES.FromPropertyDescriptor(mutator), {
|
||||
get: mutator['[[Get]]'],
|
||||
set: mutator['[[Set]]'],
|
||||
enumerable: !!mutator['[[Enumerable]]'],
|
||||
configurable: !!mutator['[[Configurable]]']
|
||||
});
|
||||
var data = v.dataDescriptor();
|
||||
t.deepEqual(ES.FromPropertyDescriptor(data), {
|
||||
value: data['[[Value]]'],
|
||||
writable: data['[[Writable]]'],
|
||||
enumerable: !!data['[[Enumerable]]'],
|
||||
configurable: !!data['[[Configurable]]']
|
||||
});
|
||||
|
||||
t['throws'](
|
||||
function () { ES.FromPropertyDescriptor(v.genericDescriptor()); },
|
||||
TypeError,
|
||||
'a complete Property Descriptor is required'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('SecFromTime', function (t) {
|
||||
var now = new Date();
|
||||
t.equal(ES.SecFromTime(now.getTime()), now.getUTCSeconds(), 'second from Date timestamp matches getUTCSeconds');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('MinFromTime', function (t) {
|
||||
var now = new Date();
|
||||
t.equal(ES.MinFromTime(now.getTime()), now.getUTCMinutes(), 'minute from Date timestamp matches getUTCMinutes');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('HourFromTime', function (t) {
|
||||
var now = new Date();
|
||||
t.equal(ES.HourFromTime(now.getTime()), now.getUTCHours(), 'hour from Date timestamp matches getUTCHours');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('msFromTime', function (t) {
|
||||
var now = new Date();
|
||||
t.equal(ES.msFromTime(now.getTime()), now.getUTCMilliseconds(), 'ms from Date timestamp matches getUTCMilliseconds');
|
||||
t.end();
|
||||
});
|
||||
|
||||
var msPerSecond = 1e3;
|
||||
var msPerMinute = 60 * msPerSecond;
|
||||
var msPerHour = 60 * msPerMinute;
|
||||
var msPerDay = 24 * msPerHour;
|
||||
|
||||
test('Day', function (t) {
|
||||
var time = Date.UTC(2019, 8, 10, 2, 3, 4, 5);
|
||||
var add = 2.5;
|
||||
var later = new Date(time + (add * msPerDay));
|
||||
|
||||
t.equal(ES.Day(later.getTime()), ES.Day(time) + Math.floor(add), 'adding 2.5 days worth of ms, gives a Day delta of 2');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('TimeWithinDay', function (t) {
|
||||
var time = Date.UTC(2019, 8, 10, 2, 3, 4, 5);
|
||||
var add = 2.5;
|
||||
var later = new Date(time + (add * msPerDay));
|
||||
|
||||
t.equal(ES.TimeWithinDay(later.getTime()), ES.TimeWithinDay(time) + (0.5 * msPerDay), 'adding 2.5 days worth of ms, gives a TimeWithinDay delta of +0.5');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('DayFromYear', function (t) {
|
||||
t.equal(ES.DayFromYear(2021) - ES.DayFromYear(2020), 366, '2021 is a leap year, has 366 days');
|
||||
t.equal(ES.DayFromYear(2020) - ES.DayFromYear(2019), 365, '2020 is not a leap year, has 365 days');
|
||||
t.equal(ES.DayFromYear(2019) - ES.DayFromYear(2018), 365, '2019 is not a leap year, has 365 days');
|
||||
t.equal(ES.DayFromYear(2018) - ES.DayFromYear(2017), 365, '2018 is not a leap year, has 365 days');
|
||||
t.equal(ES.DayFromYear(2017) - ES.DayFromYear(2016), 366, '2017 is a leap year, has 366 days');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('TimeFromYear', function (t) {
|
||||
for (var i = 1900; i < 2100; i += 1) {
|
||||
t.equal(ES.TimeFromYear(i), Date.UTC(i, 0, 1), 'TimeFromYear matches a Date object’s year: ' + i);
|
||||
}
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('YearFromTime', function (t) {
|
||||
for (var i = 1900; i < 2100; i += 1) {
|
||||
t.equal(ES.YearFromTime(Date.UTC(i, 0, 1)), i, 'YearFromTime matches a Date object’s year on 1/1: ' + i);
|
||||
t.equal(ES.YearFromTime(Date.UTC(i, 10, 1)), i, 'YearFromTime matches a Date object’s year on 10/1: ' + i);
|
||||
}
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('WeekDay', function (t) {
|
||||
var now = new Date();
|
||||
var today = now.getUTCDay();
|
||||
for (var i = 0; i < 7; i += 1) {
|
||||
var weekDay = ES.WeekDay(now.getTime() + (i * msPerDay));
|
||||
t.equal(weekDay, (today + i) % 7, i + ' days after today (' + today + '), WeekDay is ' + weekDay);
|
||||
}
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('DaysInYear', function (t) {
|
||||
t.equal(ES.DaysInYear(2021), 365, '2021 is not a leap year');
|
||||
t.equal(ES.DaysInYear(2020), 366, '2020 is a leap year');
|
||||
t.equal(ES.DaysInYear(2019), 365, '2019 is not a leap year');
|
||||
t.equal(ES.DaysInYear(2018), 365, '2018 is not a leap year');
|
||||
t.equal(ES.DaysInYear(2017), 365, '2017 is not a leap year');
|
||||
t.equal(ES.DaysInYear(2016), 366, '2016 is a leap year');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('InLeapYear', function (t) {
|
||||
t.equal(ES.InLeapYear(Date.UTC(2021, 0, 1)), 0, '2021 is not a leap year');
|
||||
t.equal(ES.InLeapYear(Date.UTC(2020, 0, 1)), 1, '2020 is a leap year');
|
||||
t.equal(ES.InLeapYear(Date.UTC(2019, 0, 1)), 0, '2019 is not a leap year');
|
||||
t.equal(ES.InLeapYear(Date.UTC(2018, 0, 1)), 0, '2018 is not a leap year');
|
||||
t.equal(ES.InLeapYear(Date.UTC(2017, 0, 1)), 0, '2017 is not a leap year');
|
||||
t.equal(ES.InLeapYear(Date.UTC(2016, 0, 1)), 1, '2016 is a leap year');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('DayWithinYear', function (t) {
|
||||
t.equal(ES.DayWithinYear(Date.UTC(2019, 0, 1)), 0, '1/1 is the 1st day');
|
||||
t.equal(ES.DayWithinYear(Date.UTC(2019, 11, 31)), 364, '12/31 is the 365th day in a non leap year');
|
||||
t.equal(ES.DayWithinYear(Date.UTC(2016, 11, 31)), 365, '12/31 is the 366th day in a leap year');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('MonthFromTime', function (t) {
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 0, 1)), 0, 'non-leap: 1/1 gives January');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 0, 31)), 0, 'non-leap: 1/31 gives January');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 1, 1)), 1, 'non-leap: 2/1 gives February');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 1, 28)), 1, 'non-leap: 2/28 gives February');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 1, 29)), 2, 'non-leap: 2/29 gives March');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 2, 1)), 2, 'non-leap: 3/1 gives March');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 2, 31)), 2, 'non-leap: 3/31 gives March');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 3, 1)), 3, 'non-leap: 4/1 gives April');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 3, 30)), 3, 'non-leap: 4/30 gives April');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 4, 1)), 4, 'non-leap: 5/1 gives May');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 4, 31)), 4, 'non-leap: 5/31 gives May');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 5, 1)), 5, 'non-leap: 6/1 gives June');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 5, 30)), 5, 'non-leap: 6/30 gives June');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 6, 1)), 6, 'non-leap: 7/1 gives July');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 6, 31)), 6, 'non-leap: 7/31 gives July');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 7, 1)), 7, 'non-leap: 8/1 gives August');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 7, 30)), 7, 'non-leap: 8/30 gives August');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 8, 1)), 8, 'non-leap: 9/1 gives September');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 8, 30)), 8, 'non-leap: 9/30 gives September');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 9, 1)), 9, 'non-leap: 10/1 gives October');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 9, 31)), 9, 'non-leap: 10/31 gives October');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 10, 1)), 10, 'non-leap: 11/1 gives November');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 10, 30)), 10, 'non-leap: 11/30 gives November');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 11, 1)), 11, 'non-leap: 12/1 gives December');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2019, 11, 31)), 11, 'non-leap: 12/31 gives December');
|
||||
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 0, 1)), 0, 'leap: 1/1 gives January');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 0, 31)), 0, 'leap: 1/31 gives January');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 1, 1)), 1, 'leap: 2/1 gives February');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 1, 28)), 1, 'leap: 2/28 gives February');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 1, 29)), 1, 'leap: 2/29 gives February');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 2, 1)), 2, 'leap: 3/1 gives March');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 2, 31)), 2, 'leap: 3/31 gives March');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 3, 1)), 3, 'leap: 4/1 gives April');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 3, 30)), 3, 'leap: 4/30 gives April');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 4, 1)), 4, 'leap: 5/1 gives May');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 4, 31)), 4, 'leap: 5/31 gives May');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 5, 1)), 5, 'leap: 6/1 gives June');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 5, 30)), 5, 'leap: 6/30 gives June');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 6, 1)), 6, 'leap: 7/1 gives July');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 6, 31)), 6, 'leap: 7/31 gives July');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 7, 1)), 7, 'leap: 8/1 gives August');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 7, 30)), 7, 'leap: 8/30 gives August');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 8, 1)), 8, 'leap: 9/1 gives September');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 8, 30)), 8, 'leap: 9/30 gives September');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 9, 1)), 9, 'leap: 10/1 gives October');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 9, 31)), 9, 'leap: 10/31 gives October');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 10, 1)), 10, 'leap: 11/1 gives November');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 10, 30)), 10, 'leap: 11/30 gives November');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 11, 1)), 11, 'leap: 12/1 gives December');
|
||||
t.equal(ES.MonthFromTime(Date.UTC(2016, 11, 31)), 11, 'leap: 12/31 gives December');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('DateFromTime', function (t) {
|
||||
var i;
|
||||
for (i = 1; i <= 28; i += 1) {
|
||||
t.equal(ES.DateFromTime(Date.UTC(2019, 1, i)), i, '2019.02.' + i + ' is date ' + i);
|
||||
}
|
||||
for (i = 1; i <= 29; i += 1) {
|
||||
t.equal(ES.DateFromTime(Date.UTC(2016, 1, i)), i, '2016.02.' + i + ' is date ' + i);
|
||||
}
|
||||
for (i = 1; i <= 30; i += 1) {
|
||||
t.equal(ES.DateFromTime(Date.UTC(2019, 8, i)), i, '2019.09.' + i + ' is date ' + i);
|
||||
}
|
||||
for (i = 1; i <= 31; i += 1) {
|
||||
t.equal(ES.DateFromTime(Date.UTC(2019, 9, i)), i, '2019.10.' + i + ' is date ' + i);
|
||||
}
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('MakeDay', function (t) {
|
||||
var day2015 = 16687;
|
||||
t.equal(ES.MakeDay(2015, 8, 9), day2015, '2015.09.09 is day 16687');
|
||||
var day2016 = day2015 + 366; // 2016 is a leap year
|
||||
t.equal(ES.MakeDay(2016, 8, 9), day2016, '2015.09.09 is day 17053');
|
||||
var day2017 = day2016 + 365;
|
||||
t.equal(ES.MakeDay(2017, 8, 9), day2017, '2017.09.09 is day 17418');
|
||||
var day2018 = day2017 + 365;
|
||||
t.equal(ES.MakeDay(2018, 8, 9), day2018, '2018.09.09 is day 17783');
|
||||
var day2019 = day2018 + 365;
|
||||
t.equal(ES.MakeDay(2019, 8, 9), day2019, '2019.09.09 is day 18148');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('MakeDate', function (t) {
|
||||
forEach(v.infinities.concat(NaN), function (nonFiniteNumber) {
|
||||
t.ok(is(ES.MakeDate(nonFiniteNumber, 0), NaN), debug(nonFiniteNumber) + ' is not a finite `day`');
|
||||
t.ok(is(ES.MakeDate(0, nonFiniteNumber), NaN), debug(nonFiniteNumber) + ' is not a finite `time`');
|
||||
});
|
||||
t.equal(ES.MakeDate(0, 0), 0, 'zero day and zero time is zero date');
|
||||
t.equal(ES.MakeDate(0, 123), 123, 'zero day and nonzero time is a date of the "time"');
|
||||
t.equal(ES.MakeDate(1, 0), msPerDay, 'day of 1 and zero time is a date of "ms per day"');
|
||||
t.equal(ES.MakeDate(3, 0), 3 * msPerDay, 'day of 3 and zero time is a date of thrice "ms per day"');
|
||||
t.equal(ES.MakeDate(1, 123), msPerDay + 123, 'day of 1 and nonzero time is a date of "ms per day" plus the "time"');
|
||||
t.equal(ES.MakeDate(3, 123), (3 * msPerDay) + 123, 'day of 3 and nonzero time is a date of thrice "ms per day" plus the "time"');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('MakeTime', function (t) {
|
||||
forEach(v.infinities.concat(NaN), function (nonFiniteNumber) {
|
||||
t.ok(is(ES.MakeTime(nonFiniteNumber, 0, 0, 0), NaN), debug(nonFiniteNumber) + ' is not a finite `hour`');
|
||||
t.ok(is(ES.MakeTime(0, nonFiniteNumber, 0, 0), NaN), debug(nonFiniteNumber) + ' is not a finite `min`');
|
||||
t.ok(is(ES.MakeTime(0, 0, nonFiniteNumber, 0), NaN), debug(nonFiniteNumber) + ' is not a finite `sec`');
|
||||
t.ok(is(ES.MakeTime(0, 0, 0, nonFiniteNumber), NaN), debug(nonFiniteNumber) + ' is not a finite `ms`');
|
||||
});
|
||||
|
||||
t.equal(
|
||||
ES.MakeTime(1.2, 2.3, 3.4, 4.5),
|
||||
(1 * msPerHour) + (2 * msPerMinute) + (3 * msPerSecond) + 4,
|
||||
'all numbers are converted to integer, multiplied by the right number of ms, and summed'
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('TimeClip', function (t) {
|
||||
forEach(v.infinities.concat(NaN), function (nonFiniteNumber) {
|
||||
t.ok(is(ES.TimeClip(nonFiniteNumber), NaN), debug(nonFiniteNumber) + ' is not a finite `time`');
|
||||
});
|
||||
t.ok(is(ES.TimeClip(8.64e15 + 1), NaN), '8.64e15 is the largest magnitude considered "finite"');
|
||||
t.ok(is(ES.TimeClip(-8.64e15 - 1), NaN), '-8.64e15 is the largest magnitude considered "finite"');
|
||||
|
||||
forEach(v.zeroes.concat([-10, 10, +new Date()]), function (time) {
|
||||
t.looseEqual(ES.TimeClip(time), time, debug(time) + ' is a time of ' + debug(time));
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('modulo', function (t) {
|
||||
t.equal(3 % 2, 1, '+3 % 2 is +1');
|
||||
t.equal(ES.modulo(3, 2), 1, '+3 mod 2 is +1');
|
||||
|
||||
t.equal(-3 % 2, -1, '-3 % 2 is -1');
|
||||
t.equal(ES.modulo(-3, 2), 1, '-3 mod 2 is +1');
|
||||
t.end();
|
||||
});
|
18
node_modules/es-abstract/test/es6.js
generated
vendored
Normal file
18
node_modules/es-abstract/test/es6.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
|
||||
var ES = require('../');
|
||||
var ES6 = ES.ES6;
|
||||
var ES2015 = ES.ES2015;
|
||||
var ES6entry = require('../es6');
|
||||
|
||||
test('legacy es6 export', function (t) {
|
||||
t.equal(ES6, ES2015, 'main ES6 === main ES2015');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('legacy es6 entry point', function (t) {
|
||||
t.equal(ES6, ES6entry, 'main ES6 === ES6 entry point');
|
||||
t.end();
|
||||
});
|
18
node_modules/es-abstract/test/es7.js
generated
vendored
Normal file
18
node_modules/es-abstract/test/es7.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
|
||||
var ES = require('../');
|
||||
var ES7 = ES.ES7;
|
||||
var ES2016 = ES.ES2016;
|
||||
var ES7entry = require('../es7');
|
||||
|
||||
test('legacy es7 export', function (t) {
|
||||
t.equal(ES7, ES2016, 'main ES7 === main ES2016');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('legacy es7 entry point', function (t) {
|
||||
t.equal(ES7, ES7entry, 'main ES7 === ES7 entry point');
|
||||
t.end();
|
||||
});
|
42
node_modules/es-abstract/test/helpers/OwnPropertyKeys.js
generated
vendored
Normal file
42
node_modules/es-abstract/test/helpers/OwnPropertyKeys.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var hasSymbols = require('has-symbols')();
|
||||
|
||||
var OwnPropertyKeys = require('../../helpers/OwnPropertyKeys');
|
||||
var defineProperty = require('./defineProperty');
|
||||
|
||||
test('OwnPropertyKeys', function (t) {
|
||||
t.deepEqual(OwnPropertyKeys({ a: 1, b: 2 }).sort(), ['a', 'b'].sort(), 'returns own string keys');
|
||||
|
||||
t.test('Symbols', { skip: !hasSymbols }, function (st) {
|
||||
var o = { a: 1 };
|
||||
var sym = Symbol();
|
||||
o[sym] = 2;
|
||||
|
||||
st.deepEqual(OwnPropertyKeys(o), ['a', sym], 'returns own string and symbol keys');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('non-enumerables', { skip: !defineProperty.oDP }, function (st) {
|
||||
var o = { a: 1, b: 42, c: NaN };
|
||||
defineProperty(o, 'b', { enumerable: false, value: 42 });
|
||||
defineProperty(o, 'c', { enumerable: false, get: function () { return NaN; } });
|
||||
|
||||
if (hasSymbols) {
|
||||
defineProperty(o, 'd', { enumerable: false, value: true });
|
||||
defineProperty(o, 'e', { enumerable: false, get: function () { return true; } });
|
||||
}
|
||||
|
||||
st.deepEqual(
|
||||
OwnPropertyKeys(o).sort(),
|
||||
(hasSymbols ? ['a', 'b', 'c', 'd', 'e'] : ['a', 'b', 'c']).sort(),
|
||||
'returns non-enumerable own keys, including accessors and symbols if available'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
60
node_modules/es-abstract/test/helpers/assertRecord.js
generated
vendored
Normal file
60
node_modules/es-abstract/test/helpers/assertRecord.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
|
||||
var forEach = require('foreach');
|
||||
var debug = require('object-inspect');
|
||||
|
||||
var assertRecord = require('../../helpers/assertRecord');
|
||||
var v = require('./values');
|
||||
|
||||
module.exports = function assertRecordTests(ES, test) {
|
||||
test('Property Descriptor', function (t) {
|
||||
var record = 'Property Descriptor';
|
||||
|
||||
forEach(v.nonUndefinedPrimitives, function (primitive) {
|
||||
t['throws'](
|
||||
function () { assertRecord(ES.Type, record, 'arg', primitive); },
|
||||
TypeError,
|
||||
debug(primitive) + ' is not a Property Descriptor'
|
||||
);
|
||||
});
|
||||
|
||||
t['throws'](
|
||||
function () { assertRecord(ES.Type, record, 'arg', { invalid: true }); },
|
||||
TypeError,
|
||||
'invalid keys not allowed on a Property Descriptor'
|
||||
);
|
||||
|
||||
t.doesNotThrow(
|
||||
function () { assertRecord(ES.Type, record, 'arg', {}); },
|
||||
'empty object is an incomplete Property Descriptor'
|
||||
);
|
||||
|
||||
t.doesNotThrow(
|
||||
function () { assertRecord(ES.Type, record, 'arg', v.accessorDescriptor()); },
|
||||
'accessor descriptor is a Property Descriptor'
|
||||
);
|
||||
|
||||
t.doesNotThrow(
|
||||
function () { assertRecord(ES.Type, record, 'arg', v.mutatorDescriptor()); },
|
||||
'mutator descriptor is a Property Descriptor'
|
||||
);
|
||||
|
||||
t.doesNotThrow(
|
||||
function () { assertRecord(ES.Type, record, 'arg', v.dataDescriptor()); },
|
||||
'data descriptor is a Property Descriptor'
|
||||
);
|
||||
|
||||
t.doesNotThrow(
|
||||
function () { assertRecord(ES.Type, record, 'arg', v.genericDescriptor()); },
|
||||
'generic descriptor is a Property Descriptor'
|
||||
);
|
||||
|
||||
t['throws'](
|
||||
function () { assertRecord(ES.Type, record, 'arg', v.bothDescriptor()); },
|
||||
TypeError,
|
||||
'a Property Descriptor can not be both a Data and an Accessor Descriptor'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
};
|
21
node_modules/es-abstract/test/helpers/createBoundESNamespace.js
generated
vendored
Normal file
21
node_modules/es-abstract/test/helpers/createBoundESNamespace.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var bind = require('function-bind');
|
||||
|
||||
var OwnPropertyKeys = require('../../helpers/OwnPropertyKeys');
|
||||
|
||||
module.exports = function createBoundESNamespace(ES) {
|
||||
var keys = OwnPropertyKeys(ES);
|
||||
var result = {};
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var prop = ES[key];
|
||||
if (typeof prop === 'function') {
|
||||
prop = bind.call(prop, undefined);
|
||||
}
|
||||
result[key] = prop;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
22
node_modules/es-abstract/test/helpers/defineProperty.js
generated
vendored
Normal file
22
node_modules/es-abstract/test/helpers/defineProperty.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var oDP = Object.defineProperty;
|
||||
try {
|
||||
oDP({}, 'a', { value: 1 });
|
||||
} catch (e) {
|
||||
// IE 8
|
||||
oDP = null;
|
||||
}
|
||||
|
||||
module.exports = function defineProperty(O, P, Desc) {
|
||||
if (oDP) {
|
||||
return oDP(O, P, Desc);
|
||||
}
|
||||
if ((Desc.enumerable && Desc.configurable && Desc.writable) || !(P in O)) {
|
||||
O[P] = Desc.value; // eslint-disable-line no-param-reassign
|
||||
return O;
|
||||
}
|
||||
|
||||
throw new SyntaxError('helper does not yet support this configuration');
|
||||
};
|
||||
module.exports.oDP = oDP;
|
67
node_modules/es-abstract/test/helpers/getSymbolDescription.js
generated
vendored
Normal file
67
node_modules/es-abstract/test/helpers/getSymbolDescription.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var debug = require('object-inspect');
|
||||
var forEach = require('foreach');
|
||||
var has = require('has');
|
||||
|
||||
var v = require('./values');
|
||||
var getSymbolDescription = require('../../helpers/getSymbolDescription');
|
||||
var getInferredName = require('../../helpers/getInferredName');
|
||||
|
||||
test('getSymbolDescription', function (t) {
|
||||
t.test('no symbols', { skip: v.hasSymbols }, function (st) {
|
||||
st['throws'](
|
||||
getSymbolDescription,
|
||||
SyntaxError,
|
||||
'requires Symbol support'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
forEach(v.nonSymbolPrimitives.concat(v.objects), function (nonSymbol) {
|
||||
t['throws'](
|
||||
function () { getSymbolDescription(nonSymbol); },
|
||||
v.hasSymbols ? TypeError : SyntaxError,
|
||||
debug(nonSymbol) + ' is not a Symbol'
|
||||
);
|
||||
});
|
||||
|
||||
t.test('with symbols', { skip: !v.hasSymbols }, function (st) {
|
||||
forEach(
|
||||
[
|
||||
[Symbol(), undefined],
|
||||
[Symbol(undefined), undefined],
|
||||
[Symbol(null), 'null'],
|
||||
[Symbol.iterator, 'Symbol.iterator'],
|
||||
[Symbol('foo'), 'foo']
|
||||
],
|
||||
function (pair) {
|
||||
var sym = pair[0];
|
||||
var desc = pair[1];
|
||||
st.equal(getSymbolDescription(sym), desc, debug(sym) + ' description is ' + debug(desc));
|
||||
}
|
||||
);
|
||||
|
||||
st.test('only possible when inference or native `Symbol.prototype.description` is supported', {
|
||||
skip: !getInferredName && !has(Symbol.prototype, 'description')
|
||||
}, function (s2t) {
|
||||
s2t.equal(getSymbolDescription(Symbol('')), '', 'Symbol("") description is ""');
|
||||
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('only possible when global symbols are supported', {
|
||||
skip: !has(Symbol, 'for') || !has(Symbol, 'keyFor')
|
||||
}, function (s2t) {
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
s2t.equal(getSymbolDescription(Symbol['for']('')), '', 'Symbol.for("") description is ""');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
27
node_modules/es-abstract/test/helpers/runManifestTest.js
generated
vendored
Normal file
27
node_modules/es-abstract/test/helpers/runManifestTest.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var forEach = require('foreach');
|
||||
var keys = require('object-keys');
|
||||
|
||||
module.exports = function runManifestTest(test, ES, edition) {
|
||||
test('ES' + edition + ' manifest', { skip: !fs.readdirSync }, function (t) {
|
||||
var files = fs.readdirSync(path.join(__dirname, '../../' + edition), 'utf-8');
|
||||
var map = {
|
||||
AbstractEqualityComparison: 'Abstract Equality Comparison',
|
||||
AbstractRelationalComparison: 'Abstract Relational Comparison',
|
||||
StrictEqualityComparison: 'Strict Equality Comparison'
|
||||
};
|
||||
forEach(files, function (file) {
|
||||
var name = path.basename(file, path.extname(file));
|
||||
var actual = ES[map[name] || name];
|
||||
var expected = require(path.join(__dirname, '../../' + edition + '/', file)); // eslint-disable-line global-require
|
||||
t.equal(actual, expected, 'ES["' + name + '"] === ' + file);
|
||||
});
|
||||
var actualCount = keys(ES).length;
|
||||
t.equal(actualCount, files.length, 'expected ' + files.length + ' files, got ' + actualCount);
|
||||
t.end();
|
||||
});
|
||||
};
|
127
node_modules/es-abstract/test/helpers/values.js
generated
vendored
Normal file
127
node_modules/es-abstract/test/helpers/values.js
generated
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('../../helpers/assign');
|
||||
|
||||
var hasSymbols = require('has-symbols')();
|
||||
var hasBigInts = require('has-bigints')();
|
||||
|
||||
var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } };
|
||||
var coercibleFnObject = {
|
||||
valueOf: function () { return function valueOfFn() {}; },
|
||||
toString: function () { return 42; }
|
||||
};
|
||||
var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } };
|
||||
var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } };
|
||||
var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } };
|
||||
var uncoercibleFnObject = {
|
||||
valueOf: function () { return function valueOfFn() {}; },
|
||||
toString: function () { return function toStrFn() {}; }
|
||||
};
|
||||
var objects = [{}, coercibleObject, coercibleFnObject, toStringOnlyObject, valueOfOnlyObject];
|
||||
var nullPrimitives = [undefined, null];
|
||||
var nonIntegerNumbers = [-1.3, 0.2, 1.8, 1 / 3];
|
||||
var integerNumbers = [1, 7, 42, 1e17];
|
||||
var zeroes = [0, -0];
|
||||
var infinities = [Infinity, -Infinity];
|
||||
var numbers = zeroes.concat([42], infinities, nonIntegerNumbers);
|
||||
var strings = ['', 'foo', 'a\uD83D\uDCA9c'];
|
||||
var booleans = [true, false];
|
||||
var symbols = hasSymbols ? [Symbol.iterator, Symbol('foo')] : [];
|
||||
var bigints = hasBigInts ? [BigInt(42), BigInt(0)] : [];
|
||||
var nonSymbolPrimitives = [].concat(nullPrimitives, booleans, strings, numbers, bigints);
|
||||
var nonNumberPrimitives = [].concat(nullPrimitives, booleans, strings, symbols);
|
||||
var nonNullPrimitives = [].concat(booleans, strings, numbers, symbols, bigints);
|
||||
var nonUndefinedPrimitives = [].concat(null, nonNullPrimitives);
|
||||
var nonStrings = [].concat(nullPrimitives, booleans, numbers, symbols, objects, bigints);
|
||||
var primitives = [].concat(nullPrimitives, nonNullPrimitives);
|
||||
var nonPropertyKeys = [].concat(nullPrimitives, booleans, numbers, objects);
|
||||
var propertyKeys = [].concat(strings, symbols);
|
||||
var nonBooleans = [].concat(nullPrimitives, strings, symbols, numbers, objects);
|
||||
var falsies = [].concat(nullPrimitives, false, '', 0, -0, NaN);
|
||||
var truthies = [].concat(true, 'foo', 42, symbols, objects);
|
||||
var timestamps = [].concat(0, 946713600000, 1546329600000);
|
||||
var nonFunctions = [].concat(primitives, objects, [42]);
|
||||
var nonArrays = [].concat(nonFunctions);
|
||||
var nonBigInts = [].concat(nonNumberPrimitives, numbers);
|
||||
|
||||
var descriptors = {
|
||||
configurable: function (descriptor) {
|
||||
return assign(assign({}, descriptor), { '[[Configurable]]': true });
|
||||
},
|
||||
nonConfigurable: function (descriptor) {
|
||||
return assign(assign({}, descriptor), { '[[Configurable]]': false });
|
||||
},
|
||||
enumerable: function (descriptor) {
|
||||
return assign(assign({}, descriptor), { '[[Enumerable]]': true });
|
||||
},
|
||||
nonEnumerable: function (descriptor) {
|
||||
return assign(assign({}, descriptor), { '[[Enumerable]]': false });
|
||||
},
|
||||
writable: function (descriptor) {
|
||||
return assign(assign({}, descriptor), { '[[Writable]]': true });
|
||||
},
|
||||
nonWritable: function (descriptor) {
|
||||
return assign(assign({}, descriptor), { '[[Writable]]': false });
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
booleans: booleans,
|
||||
coercibleFnObject: coercibleFnObject,
|
||||
coercibleObject: coercibleObject,
|
||||
falsies: falsies,
|
||||
hasSymbols: hasSymbols,
|
||||
infinities: infinities,
|
||||
integerNumbers: integerNumbers,
|
||||
nonArrays: nonArrays,
|
||||
nonBigInts: nonBigInts,
|
||||
nonBooleans: nonBooleans,
|
||||
nonFunctions: nonFunctions,
|
||||
nonIntegerNumbers: nonIntegerNumbers,
|
||||
nonNullPrimitives: nonNullPrimitives,
|
||||
nonNumberPrimitives: nonNumberPrimitives,
|
||||
nonNumbers: nonNumberPrimitives.concat(objects),
|
||||
nonPropertyKeys: nonPropertyKeys,
|
||||
nonStrings: nonStrings,
|
||||
nonSymbolPrimitives: nonSymbolPrimitives,
|
||||
nonUndefinedPrimitives: nonUndefinedPrimitives,
|
||||
nullPrimitives: nullPrimitives,
|
||||
numbers: numbers,
|
||||
objects: objects,
|
||||
primitives: primitives,
|
||||
propertyKeys: propertyKeys,
|
||||
strings: strings,
|
||||
symbols: symbols,
|
||||
timestamps: timestamps,
|
||||
toStringOnlyObject: toStringOnlyObject,
|
||||
truthies: truthies,
|
||||
uncoercibleFnObject: uncoercibleFnObject,
|
||||
uncoercibleObject: uncoercibleObject,
|
||||
valueOfOnlyObject: valueOfOnlyObject,
|
||||
zeroes: zeroes,
|
||||
bothDescriptor: function () {
|
||||
return { '[[Get]]': function () {}, '[[Value]]': true };
|
||||
},
|
||||
bothDescriptorWritable: function () {
|
||||
return descriptors.writable({ '[[Get]]': function () {} });
|
||||
},
|
||||
accessorDescriptor: function (value) {
|
||||
return descriptors.enumerable(descriptors.configurable({
|
||||
'[[Get]]': function get() { return value; }
|
||||
}));
|
||||
},
|
||||
mutatorDescriptor: function () {
|
||||
return descriptors.enumerable(descriptors.configurable({
|
||||
'[[Set]]': function () {}
|
||||
}));
|
||||
},
|
||||
dataDescriptor: function (value) {
|
||||
return descriptors.nonWritable({
|
||||
'[[Value]]': arguments.length > 0 ? value : 42
|
||||
});
|
||||
},
|
||||
genericDescriptor: function () {
|
||||
return descriptors.configurable(descriptors.nonEnumerable());
|
||||
},
|
||||
descriptors: descriptors
|
||||
};
|
36
node_modules/es-abstract/test/index.js
generated
vendored
Normal file
36
node_modules/es-abstract/test/index.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
var ES = require('../');
|
||||
var test = require('tape');
|
||||
var keys = require('object-keys');
|
||||
var forEach = require('foreach');
|
||||
|
||||
var ESkeys = keys(ES).sort();
|
||||
var ES6keys = keys(ES.ES6).sort();
|
||||
|
||||
test('exposed properties', function (t) {
|
||||
t.deepEqual(ESkeys, ES6keys.concat(['ES2020', 'ES2019', 'ES2018', 'ES2017', 'ES7', 'ES2016', 'ES6', 'ES2015', 'ES5']).sort(), 'main ES object keys match ES6 keys');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('methods match', function (t) {
|
||||
forEach(ES6keys, function (key) {
|
||||
t.equal(ES.ES6[key], ES[key], 'method ' + key + ' on main ES object is ES6 method');
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
require('./GetIntrinsic');
|
||||
|
||||
require('./helpers/getSymbolDescription');
|
||||
require('./helpers/OwnPropertyKeys');
|
||||
|
||||
require('./es5');
|
||||
require('./es6');
|
||||
require('./es2015');
|
||||
require('./es7');
|
||||
require('./es2016');
|
||||
require('./es2017');
|
||||
require('./es2018');
|
||||
require('./es2019');
|
||||
require('./es2020');
|
4913
node_modules/es-abstract/test/tests.js
generated
vendored
Normal file
4913
node_modules/es-abstract/test/tests.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user