зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1784092 - Part 4: Update test262. r=mgaudet
Update test262 after enabling the features from part 2. Depends on D154269 Differential Revision: https://phabricator.services.mozilla.com/D154270
This commit is contained in:
Родитель
9dc71a7f29
Коммит
690bcb5e95
|
@ -1,13 +1,5 @@
|
||||||
commit e623dd7a1183b04d862baea22a4b133b1635cb95
|
commit adba7dfd9c04a33a7369cf008863d3667a0ba57f
|
||||||
Author: Mathias Bynens <mathias@qiwi.be>
|
Author: Kevin Gibbons <bakkot@gmail.com>
|
||||||
Date: Tue Jul 26 19:42:06 2022 +0200
|
Date: Sun Aug 7 20:11:29 2022 -0700
|
||||||
|
|
||||||
Add manually written tests for RegExp `v` flag proposal (#3614)
|
fix order
|
||||||
|
|
||||||
https://github.com/tc39/proposal-regexp-v-flag
|
|
||||||
|
|
||||||
Issue: #3496, https://github.com/tc39/proposal-regexp-v-flag/issues/52
|
|
||||||
|
|
||||||
Add more tests for the new RegExp `v` flag
|
|
||||||
|
|
||||||
Add test for combination of `u` and `v` flag
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// |reftest| skip -- array-grouping is not supported
|
// |reftest| shell-option(--enable-array-grouping) skip-if(!Array.prototype.group||!xulRuntime.shell) -- array-grouping is not enabled unconditionally, requires shell-options
|
||||||
// Copyright (C) 2022 Chengzhong Wu. All rights reserved.
|
// Copyright (C) 2022 Chengzhong Wu. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
|
@ -9,8 +9,8 @@ info: |
|
||||||
22.1.3.32 Array.prototype [ @@unscopables ]
|
22.1.3.32 Array.prototype [ @@unscopables ]
|
||||||
|
|
||||||
...
|
...
|
||||||
10. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupBy", true).
|
10. Perform ! CreateDataPropertyOrThrow(unscopableList, "group", true).
|
||||||
11. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupByToMap", true).
|
11. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupToMap", true).
|
||||||
...
|
...
|
||||||
|
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
|
@ -21,14 +21,14 @@ var unscopables = Array.prototype[Symbol.unscopables];
|
||||||
|
|
||||||
assert.sameValue(Object.getPrototypeOf(unscopables), null);
|
assert.sameValue(Object.getPrototypeOf(unscopables), null);
|
||||||
|
|
||||||
assert.sameValue(unscopables.groupBy, true, '`groupBy` property value');
|
assert.sameValue(unscopables.group, true, '`group` property value');
|
||||||
verifyEnumerable(unscopables, 'groupBy');
|
verifyEnumerable(unscopables, 'group');
|
||||||
verifyWritable(unscopables, 'groupBy');
|
verifyWritable(unscopables, 'group');
|
||||||
verifyConfigurable(unscopables, 'groupBy');
|
verifyConfigurable(unscopables, 'group');
|
||||||
|
|
||||||
assert.sameValue(unscopables.groupByToMap, true, '`groupByToMap` property value');
|
assert.sameValue(unscopables.groupToMap, true, '`groupToMap` property value');
|
||||||
verifyEnumerable(unscopables, 'groupByToMap');
|
verifyEnumerable(unscopables, 'groupToMap');
|
||||||
verifyWritable(unscopables, 'groupByToMap');
|
verifyWritable(unscopables, 'groupToMap');
|
||||||
verifyConfigurable(unscopables, 'groupByToMap');
|
verifyConfigurable(unscopables, 'groupToMap');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright (C) 2022 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: BigInt constructor only coerces its input once
|
||||||
|
esid: sec-bigint-constructor-number-value
|
||||||
|
info: |
|
||||||
|
BigInt ( value )
|
||||||
|
1. If NewTarget is not undefined, throw a TypeError exception.
|
||||||
|
2. Let prim be ? ToPrimitive(value, number).
|
||||||
|
3. If Type(prim) is Number, return ? NumberToBigInt(prim).
|
||||||
|
4. Otherwise, return ? ToBigInt(prim).
|
||||||
|
features: [BigInt]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var first = true;
|
||||||
|
var v = {
|
||||||
|
[Symbol.toPrimitive]: function() {
|
||||||
|
if (first) {
|
||||||
|
first = false;
|
||||||
|
return "42";
|
||||||
|
}
|
||||||
|
throw new Test262Error("Symbol.toPrimitive should only be invoked once");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.sameValue(BigInt(v), 42n, "BigInt constructor should use the post-ToPrimitive value as the argument to ToBigInt");
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,27 @@
|
||||||
|
// |reftest| skip -- regexp-duplicate-named-groups is not supported
|
||||||
|
// Copyright 2022 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: Enumeration order of the groups object with duplicate named capture groups
|
||||||
|
esid: prod-GroupSpecifier
|
||||||
|
features: [regexp-duplicate-named-groups]
|
||||||
|
includes: [compareArray.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
let regexp = /(?<y>a)(?<x>a)|(?<x>b)(?<y>b)/;
|
||||||
|
|
||||||
|
assert.compareArray(
|
||||||
|
Object.keys(regexp.exec("aa").groups),
|
||||||
|
["y", "x"],
|
||||||
|
"property enumeration order of the groups object is based on source order, not match order"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.compareArray(
|
||||||
|
Object.keys(regexp.exec("bb").groups),
|
||||||
|
["y", "x"],
|
||||||
|
"property enumeration order of the groups object is based on source order, not match order"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,18 @@
|
||||||
|
// |reftest| skip -- regexp-duplicate-named-groups is not supported
|
||||||
|
// Copyright 2022 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: match indices with duplicate named capture groups
|
||||||
|
esid: sec-makematchindicesindexpairarray
|
||||||
|
features: [regexp-duplicate-named-groups, regexp-match-indices]
|
||||||
|
includes: [compareArray.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let indices = "..ab".match(/(?<x>a)|(?<x>b)/d).indices;
|
||||||
|
assert.compareArray(indices.groups.x, [2, 3]);
|
||||||
|
|
||||||
|
indices = "..ba".match(/(?<x>a)|(?<x>b)/d).indices;
|
||||||
|
assert.compareArray(indices.groups.x, [2, 3]);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,20 @@
|
||||||
|
// |reftest| skip -- regexp-duplicate-named-groups is not supported
|
||||||
|
// Copyright 2022 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: String.prototype.replace behavior with duplicate named capture groups
|
||||||
|
esid: prod-GroupSpecifier
|
||||||
|
features: [regexp-duplicate-named-groups]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue("ab".replace(/(?<x>a)|(?<x>b)/, "[$<x>]"), "[a]b");
|
||||||
|
assert.sameValue("ba".replace(/(?<x>a)|(?<x>b)/, "[$<x>]"), "[b]a");
|
||||||
|
|
||||||
|
assert.sameValue("ab".replace(/(?<x>a)|(?<x>b)/, "[$<x>][$1][$2]"), "[a][a][]b");
|
||||||
|
assert.sameValue("ba".replace(/(?<x>a)|(?<x>b)/, "[$<x>][$1][$2]"), "[b][][b]a");
|
||||||
|
|
||||||
|
assert.sameValue("ab".replace(/(?<x>a)|(?<x>b)/g, "[$<x>]"), "[a][b]");
|
||||||
|
assert.sameValue("ba".replace(/(?<x>a)|(?<x>b)/g, "[$<x>]"), "[b][a]");
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,25 @@
|
||||||
|
// |reftest| skip -- regexp-duplicate-named-groups is not supported
|
||||||
|
// Copyright 2022 Kevin Gibbons. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: Matching behavior with duplicate named capture groups
|
||||||
|
esid: prod-GroupSpecifier
|
||||||
|
features: [regexp-duplicate-named-groups]
|
||||||
|
includes: [compareArray.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.compareArray(["b", "b"], "bab".match(/(?<x>a)|(?<x>b)/));
|
||||||
|
assert.compareArray(["b", "b"], "bab".match(/(?<x>b)|(?<x>a)/));
|
||||||
|
|
||||||
|
assert.compareArray(["aa", "aa", undefined], "aa".match(/(?:(?<x>a)|(?<x>b))\k<x>/));
|
||||||
|
assert.compareArray(["bb", undefined, "bb"], "bb".match(/(?:(?<x>a)|(?<x>b))\k<x>/));
|
||||||
|
|
||||||
|
let matchResult = "aabb".match(/(?:(?:(?<x>a)|(?<x>b))\k<x>){2}/);
|
||||||
|
assert.compareArray(["aabb", undefined, "bb"], matchResult);
|
||||||
|
assert.sameValue(matchResult.groups.x, "bb");
|
||||||
|
|
||||||
|
let notMatched = "abab".match(/(?:(?:(?<x>a)|(?<x>b))\k<x>){2}/);
|
||||||
|
assert.sameValue(notMatched, null);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
45
js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/flags-tostring-error.js
поставляемый
Normal file
45
js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/flags-tostring-error.js
поставляемый
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
// Copyright (C) 2022 Richard Gibson. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Errors thrown by converting `flags` to string are forwarded to the runtime
|
||||||
|
esid: sec-regexp.prototype-@@match
|
||||||
|
info: |
|
||||||
|
1. Let _rx_ be the *this* value.
|
||||||
|
2. If Type(_rx_) is not Object, throw a *TypeError* exception.
|
||||||
|
3. Let _S_ be ? ToString(_string_).
|
||||||
|
4. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
|
||||||
|
features: [Symbol.match]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function CustomError() {}
|
||||||
|
var toStringThrows = {
|
||||||
|
[Symbol.toPrimitive](hint) {
|
||||||
|
if (hint === 'string') {
|
||||||
|
throw new CustomError();
|
||||||
|
}
|
||||||
|
throw new Test262Error('@@toPrimitive should be called with hint "string"');
|
||||||
|
},
|
||||||
|
get toString() { throw new Test262Error('toString property should not be read'); },
|
||||||
|
get valueOf() { throw new Test262Error('valueOf property should not be read'); }
|
||||||
|
};
|
||||||
|
|
||||||
|
var re = /./;
|
||||||
|
Object.defineProperties(re, {
|
||||||
|
flags: {
|
||||||
|
get() { return toStringThrows; }
|
||||||
|
},
|
||||||
|
global: {
|
||||||
|
get() { throw new Test262Error('global property should not be read'); }
|
||||||
|
},
|
||||||
|
unicode: {
|
||||||
|
get() { throw new Test262Error('unicode property should not be read'); }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(CustomError, function() {
|
||||||
|
re[Symbol.match]('');
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -23,7 +23,7 @@ info: |
|
||||||
features: [Symbol.match]
|
features: [Symbol.match]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var r = { global: true };
|
var r = { flags: 'g', global: true };
|
||||||
Object.defineProperty(r, 'exec', {
|
Object.defineProperty(r, 'exec', {
|
||||||
get: function() {
|
get: function() {
|
||||||
throw new Test262Error();
|
throw new Test262Error();
|
||||||
|
|
34
js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/get-flags-err.js
поставляемый
Normal file
34
js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/get-flags-err.js
поставляемый
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
// Copyright (C) 2022 Richard Gibson. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Errors thrown by `flags` accessor are forwarded to the runtime
|
||||||
|
esid: sec-regexp.prototype-@@match
|
||||||
|
info: |
|
||||||
|
1. Let _rx_ be the *this* value.
|
||||||
|
2. If Type(_rx_) is not Object, throw a *TypeError* exception.
|
||||||
|
3. Let _S_ be ? ToString(_string_).
|
||||||
|
4. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
|
||||||
|
features: [Symbol.match]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function CustomError() {}
|
||||||
|
|
||||||
|
var obj = {
|
||||||
|
get flags() {
|
||||||
|
throw new CustomError();
|
||||||
|
},
|
||||||
|
get global() {
|
||||||
|
throw new Test262Error('global property should not be read');
|
||||||
|
},
|
||||||
|
get unicode() {
|
||||||
|
throw new Test262Error('unicode property should not be read');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(CustomError, function() {
|
||||||
|
RegExp.prototype[Symbol.match].call(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -4,21 +4,27 @@
|
||||||
/*---
|
/*---
|
||||||
description: >
|
description: >
|
||||||
Behavior when error is thrown during retrieval of `global` property
|
Behavior when error is thrown during retrieval of `global` property
|
||||||
es6id: 21.2.5.6
|
esid: sec-regexp.prototype-@@match
|
||||||
info: |
|
info: |
|
||||||
5. Let global be ToBoolean(Get(rx, "global")).
|
1. Let _rx_ be the *this* value.
|
||||||
6. ReturnIfAbrupt(global).
|
2. If Type(_rx_) is not Object, throw a *TypeError* exception.
|
||||||
|
3. Let _S_ be ? ToString(_string_).
|
||||||
|
4. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
|
||||||
|
|
||||||
|
sec-get-regexp.prototype.flags get RegExp.prototype.flags
|
||||||
|
6. Let _global_ be ToBoolean(? Get(_R_, *"global"*)).
|
||||||
features: [Symbol.match]
|
features: [Symbol.match]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var obj = {
|
var re = /./;
|
||||||
get global() {
|
Object.defineProperty(re, 'global', {
|
||||||
|
get() {
|
||||||
throw new Test262Error();
|
throw new Test262Error();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
assert.throws(Test262Error, function() {
|
||||||
RegExp.prototype[Symbol.match].call(obj);
|
RegExp.prototype[Symbol.match].call(re);
|
||||||
});
|
});
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -3,15 +3,16 @@
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
description: >
|
description: >
|
||||||
Errors thrown by `unicode` accessor are forwarded to the runtime for global patterns
|
Errors thrown by `unicode` accessor are forwarded to the runtime
|
||||||
es6id: 21.2.5.6
|
esid: sec-regexp.prototype-@@match
|
||||||
info: |
|
info: |
|
||||||
21.2.5.6 RegExp.prototype [ @@match ] ( string )
|
1. Let _rx_ be the *this* value.
|
||||||
|
2. If Type(_rx_) is not Object, throw a *TypeError* exception.
|
||||||
|
3. Let _S_ be ? ToString(_string_).
|
||||||
|
4. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
|
||||||
|
|
||||||
[...]
|
sec-get-regexp.prototype.flags get RegExp.prototype.flags
|
||||||
8. Else global is true,
|
14. Let _unicode_ be ToBoolean(? Get(_R_, *"unicode"*)).
|
||||||
a. Let fullUnicode be ToBoolean(Get(rx, "unicode")).
|
|
||||||
b. ReturnIfAbrupt(fullUnicode).
|
|
||||||
features: [Symbol.match]
|
features: [Symbol.match]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
@ -27,7 +28,9 @@ Object.defineProperty(globalRe, 'unicode', {
|
||||||
get: accessor
|
get: accessor
|
||||||
});
|
});
|
||||||
|
|
||||||
nonGlobalRe[Symbol.match]('');
|
assert.throws(Test262Error, function() {
|
||||||
|
nonGlobalRe[Symbol.match]('');
|
||||||
|
});
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
assert.throws(Test262Error, function() {
|
||||||
globalRe[Symbol.match]('');
|
globalRe[Symbol.match]('');
|
||||||
|
|
49
js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/flags-tostring-error.js
поставляемый
Normal file
49
js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/flags-tostring-error.js
поставляемый
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
// Copyright (C) 2022 Richard Gibson. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Errors thrown by converting `flags` to string are forwarded to the runtime
|
||||||
|
esid: sec-regexp.prototype-@@replace
|
||||||
|
info: |
|
||||||
|
1. Let _rx_ be the *this* value.
|
||||||
|
2. If Type(_rx_) is not Object, throw a *TypeError* exception.
|
||||||
|
3. Let _S_ be ? ToString(_string_).
|
||||||
|
4. Let _lengthS_ be the number of code unit elements in _S_.
|
||||||
|
5. Let _functionalReplace_ be IsCallable(_replaceValue_).
|
||||||
|
6. If _functionalReplace_ is *false*, then
|
||||||
|
a. Set _replaceValue_ to ? ToString(_replaceValue_).
|
||||||
|
i. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
|
||||||
|
features: [Symbol.replace]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function CustomError() {}
|
||||||
|
var toStringThrows = {
|
||||||
|
[Symbol.toPrimitive](hint) {
|
||||||
|
if (hint === 'string') {
|
||||||
|
throw new CustomError();
|
||||||
|
}
|
||||||
|
throw new Test262Error('@@toPrimitive should be called with hint "string"');
|
||||||
|
},
|
||||||
|
get toString() { throw new Test262Error('toString property should not be read'); },
|
||||||
|
get valueOf() { throw new Test262Error('valueOf property should not be read'); }
|
||||||
|
};
|
||||||
|
|
||||||
|
var re = /./g;
|
||||||
|
Object.defineProperties(re, {
|
||||||
|
flags: {
|
||||||
|
get() { return toStringThrows; }
|
||||||
|
},
|
||||||
|
global: {
|
||||||
|
get() { throw new Test262Error('global property should not be read'); }
|
||||||
|
},
|
||||||
|
unicode: {
|
||||||
|
get() { throw new Test262Error('unicode property should not be read'); }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(CustomError, function() {
|
||||||
|
re[Symbol.replace]('');
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -19,7 +19,7 @@ info: |
|
||||||
features: [Symbol.replace]
|
features: [Symbol.replace]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var r = { global: true };
|
var r = { flags: 'g', global: true };
|
||||||
Object.defineProperty(r, 'exec', {
|
Object.defineProperty(r, 'exec', {
|
||||||
get: function() {
|
get: function() {
|
||||||
throw new Test262Error();
|
throw new Test262Error();
|
||||||
|
|
38
js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/get-flags-err.js
поставляемый
Normal file
38
js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/get-flags-err.js
поставляемый
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright (C) 2022 Richard Gibson. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Errors thrown by `flags` accessor are forwarded to the runtime
|
||||||
|
esid: sec-regexp.prototype-@@replace
|
||||||
|
info: |
|
||||||
|
1. Let _rx_ be the *this* value.
|
||||||
|
2. If Type(_rx_) is not Object, throw a *TypeError* exception.
|
||||||
|
3. Let _S_ be ? ToString(_string_).
|
||||||
|
4. Let _lengthS_ be the number of code unit elements in _S_.
|
||||||
|
5. Let _functionalReplace_ be IsCallable(_replaceValue_).
|
||||||
|
6. If _functionalReplace_ is *false*, then
|
||||||
|
a. Set _replaceValue_ to ? ToString(_replaceValue_).
|
||||||
|
i. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
|
||||||
|
features: [Symbol.replace]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function CustomError() {}
|
||||||
|
|
||||||
|
var obj = {
|
||||||
|
get flags() {
|
||||||
|
throw new CustomError();
|
||||||
|
},
|
||||||
|
get global() {
|
||||||
|
throw new Test262Error('global property should not be read');
|
||||||
|
},
|
||||||
|
get unicode() {
|
||||||
|
throw new Test262Error('unicode property should not be read');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(CustomError, function() {
|
||||||
|
RegExp.prototype[Symbol.replace].call(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -4,22 +4,31 @@
|
||||||
/*---
|
/*---
|
||||||
description: >
|
description: >
|
||||||
Behavior when error is thrown during retrieval of `global` property
|
Behavior when error is thrown during retrieval of `global` property
|
||||||
es6id: 21.2.5.8
|
esid: sec-regexp.prototype-@@replace
|
||||||
info: |
|
info: |
|
||||||
[...]
|
1. Let _rx_ be the *this* value.
|
||||||
8. Let global be ToBoolean(Get(rx, "global")).
|
2. If Type(_rx_) is not Object, throw a *TypeError* exception.
|
||||||
9. ReturnIfAbrupt(global).
|
3. Let _S_ be ? ToString(_string_).
|
||||||
|
4. Let _lengthS_ be the number of code unit elements in _S_.
|
||||||
|
5. Let _functionalReplace_ be IsCallable(_replaceValue_).
|
||||||
|
6. If _functionalReplace_ is *false*, then
|
||||||
|
a. Set _replaceValue_ to ? ToString(_replaceValue_).
|
||||||
|
i. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
|
||||||
|
|
||||||
|
sec-get-regexp.prototype.flags get RegExp.prototype.flags
|
||||||
|
6. Let _global_ be ToBoolean(? Get(_R_, *"global"*)).
|
||||||
features: [Symbol.replace]
|
features: [Symbol.replace]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var obj = {
|
var re = /./;
|
||||||
get global() {
|
Object.defineProperty(re, 'global', {
|
||||||
|
get() {
|
||||||
throw new Test262Error();
|
throw new Test262Error();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
assert.throws(Test262Error, function() {
|
||||||
RegExp.prototype[Symbol.replace].call(obj);
|
RegExp.prototype[Symbol.replace].call(re);
|
||||||
});
|
});
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -3,15 +3,20 @@
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
description: >
|
description: >
|
||||||
Errors thrown by `unicode` accessor are forwarded to the runtime for global patterns
|
Errors thrown by `unicode` accessor are forwarded to the runtime
|
||||||
es6id: 21.2.5.8
|
esid: sec-regexp.prototype-@@replace
|
||||||
info: |
|
info: |
|
||||||
21.2.5.8 RegExp.prototype [ @@replace ] ( string, replaceValue )
|
1. Let _rx_ be the *this* value.
|
||||||
|
2. If Type(_rx_) is not Object, throw a *TypeError* exception.
|
||||||
|
3. Let _S_ be ? ToString(_string_).
|
||||||
|
4. Let _lengthS_ be the number of code unit elements in _S_.
|
||||||
|
5. Let _functionalReplace_ be IsCallable(_replaceValue_).
|
||||||
|
6. If _functionalReplace_ is *false*, then
|
||||||
|
a. Set _replaceValue_ to ? ToString(_replaceValue_).
|
||||||
|
i. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
|
||||||
|
|
||||||
[...]
|
sec-get-regexp.prototype.flags get RegExp.prototype.flags
|
||||||
10. If global is true, then
|
14. Let _unicode_ be ToBoolean(? Get(_R_, *"unicode"*)).
|
||||||
a. Let fullUnicode be ToBoolean(Get(rx, "unicode")).
|
|
||||||
b. ReturnIfAbrupt(fullUnicode).
|
|
||||||
features: [Symbol.replace]
|
features: [Symbol.replace]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
@ -27,7 +32,9 @@ Object.defineProperty(globalRe, 'unicode', {
|
||||||
get: accessor
|
get: accessor
|
||||||
});
|
});
|
||||||
|
|
||||||
nonGlobalRe[Symbol.replace]('', '');
|
assert.throws(Test262Error, function() {
|
||||||
|
nonGlobalRe[Symbol.replace]('', '');
|
||||||
|
});
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
assert.throws(Test262Error, function() {
|
||||||
globalRe[Symbol.replace]('', '');
|
globalRe[Symbol.replace]('', '');
|
||||||
|
|
|
@ -29,4 +29,8 @@ assert.throws(TypeError, function() {
|
||||||
dotAll.call(arguments);
|
dotAll.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
dotAll.call(() => {});
|
||||||
|
}, 'function object');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -39,4 +39,8 @@ assert.throws(TypeError, function() {
|
||||||
dotAll.call(4);
|
dotAll.call(4);
|
||||||
}, "number");
|
}, "number");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
dotAll.call(4n);
|
||||||
|
}, "bigint");
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -36,4 +36,8 @@ assert.throws(TypeError, function() {
|
||||||
get.call(Symbol());
|
get.call(Symbol());
|
||||||
}, 'symbol');
|
}, 'symbol');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(4n);
|
||||||
|
}, 'bigint');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -25,4 +25,8 @@ assert.throws(TypeError, function() {
|
||||||
get.call(arguments);
|
get.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(() => {});
|
||||||
|
}, 'function object');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -36,4 +36,8 @@ assert.throws(TypeError, function() {
|
||||||
get.call(symbol);
|
get.call(symbol);
|
||||||
}, 'symbol');
|
}, 'symbol');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(4n);
|
||||||
|
}, 'bigint');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -29,4 +29,8 @@ assert.throws(TypeError, function() {
|
||||||
hasIndices.call(arguments);
|
hasIndices.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
hasIndices.call(() => {});
|
||||||
|
}, 'function object');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -39,4 +39,8 @@ assert.throws(TypeError, function() {
|
||||||
hasIndices.call(4);
|
hasIndices.call(4);
|
||||||
}, "number");
|
}, "number");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
hasIndices.call(4n);
|
||||||
|
}, "bigint");
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -25,4 +25,8 @@ assert.throws(TypeError, function() {
|
||||||
get.call(arguments);
|
get.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(() => {});
|
||||||
|
}, 'function object');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -36,4 +36,8 @@ assert.throws(TypeError, function() {
|
||||||
get.call(symbol);
|
get.call(symbol);
|
||||||
}, 'symbol');
|
}, 'symbol');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(4n);
|
||||||
|
}, 'bigint');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -25,4 +25,8 @@ assert.throws(TypeError, function() {
|
||||||
get.call(arguments);
|
get.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(() => {});
|
||||||
|
}, 'function object');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -36,4 +36,8 @@ assert.throws(TypeError, function() {
|
||||||
get.call(symbol);
|
get.call(symbol);
|
||||||
}, 'symbol');
|
}, 'symbol');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(4n);
|
||||||
|
}, 'bigint');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -25,4 +25,8 @@ assert.throws(TypeError, function() {
|
||||||
get.call(arguments);
|
get.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(() => {});
|
||||||
|
}, 'function object');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -36,4 +36,8 @@ assert.throws(TypeError, function() {
|
||||||
get.call(symbol);
|
get.call(symbol);
|
||||||
}, 'symbol');
|
}, 'symbol');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(4n);
|
||||||
|
}, 'bigint');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -27,4 +27,8 @@ assert.throws(TypeError, function() {
|
||||||
sticky.call(arguments);
|
sticky.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
sticky.call(() => {});
|
||||||
|
}, 'function object');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -39,4 +39,8 @@ assert.throws(TypeError, function() {
|
||||||
sticky.call(4);
|
sticky.call(4);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
sticky.call(4n);
|
||||||
|
}, 'bigint');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -27,4 +27,8 @@ assert.throws(TypeError, function() {
|
||||||
unicode.call(arguments);
|
unicode.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
unicode.call(() => {});
|
||||||
|
}, 'function object');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -39,4 +39,8 @@ assert.throws(TypeError, function() {
|
||||||
unicode.call(4);
|
unicode.call(4);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
unicode.call(4n);
|
||||||
|
}, 'bigint');
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
|
@ -36,7 +36,7 @@ assert.sameValue(
|
||||||
|
|
||||||
const r = new ShadowRealm();
|
const r = new ShadowRealm();
|
||||||
|
|
||||||
const properties = [
|
let properties = [
|
||||||
'globalThis',
|
'globalThis',
|
||||||
'Infinity',
|
'Infinity',
|
||||||
'NaN',
|
'NaN',
|
||||||
|
@ -96,6 +96,14 @@ const properties = [
|
||||||
'Reflect',
|
'Reflect',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// The intention of this test is to ensure that all built-in properties of the
|
||||||
|
// global object are also exposed on the ShadowRealm's global object, without
|
||||||
|
// penalizing implementations that don't have all of them implemented. Notably,
|
||||||
|
// SharedArrayBuffer may still not be (re-)enabled in all circumstances.
|
||||||
|
properties = properties.filter(name => {
|
||||||
|
return name in globalThis;
|
||||||
|
});
|
||||||
|
|
||||||
const available = properties.filter(name => {
|
const available = properties.filter(name => {
|
||||||
// This test is intentionally not using wrapped functions.
|
// This test is intentionally not using wrapped functions.
|
||||||
// This test should not depend on wrapped functions.
|
// This test should not depend on wrapped functions.
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.from
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const arg = "iso8601";
|
||||||
|
|
||||||
|
const result = Temporal.Calendar.from(arg);
|
||||||
|
assert.sameValue(result.id, "iso8601", `Calendar created from string "${arg}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
20
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-string.js
поставляемый
Normal file
20
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dateadd
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.dateAdd(arg, new Temporal.Duration());
|
||||||
|
TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateAdd/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateAdd/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dateadd
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const result1 = instance.dateAdd(new Temporal.PlainDate(1976, 11, 18), new Temporal.Duration(1), {});
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
result1, 1977, 11, "M11", 18,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.dateAdd(new Temporal.PlainDate(1976, 11, 18), new Temporal.Duration(1), () => {});
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
result2, 1977, 11, "M11", 18,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateFromFields/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateFromFields/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.datefromfields
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const result1 = instance.dateFromFields({ year: 1976, month: 11, day: 18 }, {});
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
result1, 1976, 11, "M11", 18,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.dateFromFields({ year: 1976, month: 11, day: 18 }, () => {});
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
result2, 1976, 11, "M11", 18,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
24
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-string.js
поставляемый
Normal file
24
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dateuntil
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
|
||||||
|
const result1 = instance.dateUntil(arg, new Temporal.PlainDate(1976, 11, 18));
|
||||||
|
TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${arg} (first argument)"`);
|
||||||
|
|
||||||
|
const result2 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 18), arg);
|
||||||
|
TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${arg} (second argument)"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateUntil/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateUntil/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dateuntil
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const result1 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 18), new Temporal.PlainDate(1984, 5, 31), {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result1, 0, 0, 0, 2751, 0, 0, 0, 0, 0, 0,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 18), new Temporal.PlainDate(1984, 5, 31), () => {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result2, 0, 0, 0, 2751, 0, 0, 0, 0, 0, 0,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.day
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.day(arg);
|
||||||
|
assert.sameValue(result, 18, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dayofweek
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.dayOfWeek(arg);
|
||||||
|
assert.sameValue(result, 4, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dayofyear
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.dayOfYear(arg);
|
||||||
|
assert.sameValue(result, 323, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.daysinmonth
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.daysInMonth(arg);
|
||||||
|
assert.sameValue(result, 30, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.daysinweek
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.daysInWeek(arg);
|
||||||
|
assert.sameValue(result, 7, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.daysinyear
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.daysInYear(arg);
|
||||||
|
assert.sameValue(result, 366, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.inleapyear
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.inLeapYear(arg);
|
||||||
|
assert.sameValue(result, true, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.month
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.month(arg);
|
||||||
|
assert.sameValue(result, 11, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.monthcode
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.monthCode(arg);
|
||||||
|
assert.sameValue(result, "M11", `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/monthDayFromFields/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/monthDayFromFields/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.monthdayfromfields
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const result1 = instance.monthDayFromFields({ monthCode: "M12", day: 15 }, {});
|
||||||
|
TemporalHelpers.assertPlainMonthDay(
|
||||||
|
result1, "M12", 15,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.monthDayFromFields({ monthCode: "M12", day: 15 }, () => {});
|
||||||
|
TemporalHelpers.assertPlainMonthDay(
|
||||||
|
result2, "M12", 15,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.monthsinyear
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.monthsInYear(arg);
|
||||||
|
assert.sameValue(result, 12, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.weekofyear
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.weekOfYear(arg);
|
||||||
|
assert.sameValue(result, 47, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.year
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.year(arg);
|
||||||
|
assert.sameValue(result, 1976, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.yearmonthfromfields
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
|
||||||
|
const result1 = instance.yearMonthFromFields({ year: 2000, monthCode: "M05" }, {});
|
||||||
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
|
result1, 2000, 5, "M05",
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.yearMonthFromFields({ year: 2000, monthCode: "M05" }, () => {});
|
||||||
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
|
result2, 2000, 5, "M05",
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,21 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.compare
|
||||||
|
description: Empty object may be used as options
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
Temporal.Duration.compare({ hours: 1 }, { minutes: 60 }, {}), 0,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
Temporal.Duration.compare({ hours: 1 }, { minutes:60 }, () => {}), 0,
|
||||||
|
"options may be an empty function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.compare
|
||||||
|
description: relativeTo property bag with offset property is rejected if offset is in the wrong format
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("UTC");
|
||||||
|
const d1 = new Temporal.Duration(0, 1, 0, 280);
|
||||||
|
const d2 = new Temporal.Duration(0, 1, 0, 281);
|
||||||
|
|
||||||
|
const badOffsets = [
|
||||||
|
"00:00", // missing sign
|
||||||
|
"+0", // too short
|
||||||
|
"-000:00", // too long
|
||||||
|
0, // converts to a string that is invalid
|
||||||
|
];
|
||||||
|
badOffsets.forEach((offset) => {
|
||||||
|
const relativeTo = { year: 2021, month: 10, day: 28, offset, timeZone };
|
||||||
|
assert.throws(RangeError, () => Temporal.Duration.compare(d1, d2, { relativeTo }), `"${offset} is not a valid offset string`);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,17 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.compare
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/Duration/prototype/add/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/Duration/prototype/add/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.add
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Duration(0, 0, 0, 0, 1);
|
||||||
|
|
||||||
|
const result1 = instance.add({ hours: 1 }, {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.add({ hours: 1 }, () => {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
25
js/src/tests/test262/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-invalid-offset-string.js
поставляемый
Normal file
25
js/src/tests/test262/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-invalid-offset-string.js
поставляемый
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.add
|
||||||
|
description: relativeTo property bag with offset property is rejected if offset is in the wrong format
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("UTC");
|
||||||
|
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||||
|
|
||||||
|
const badOffsets = [
|
||||||
|
"00:00", // missing sign
|
||||||
|
"+0", // too short
|
||||||
|
"-000:00", // too long
|
||||||
|
0, // converts to a string that is invalid
|
||||||
|
];
|
||||||
|
badOffsets.forEach((offset) => {
|
||||||
|
const relativeTo = { year: 2021, month: 10, day: 28, offset, timeZone };
|
||||||
|
assert.throws(RangeError, () => instance.add(new Temporal.Duration(0, 0, 0, 0, -24), { relativeTo }), `"${offset} is not a valid offset string`);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Duration/prototype/add/timezone-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Duration/prototype/add/timezone-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.add
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Duration(1);
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
25
js/src/tests/test262/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-invalid-offset-string.js
поставляемый
Normal file
25
js/src/tests/test262/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-invalid-offset-string.js
поставляемый
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.round
|
||||||
|
description: relativeTo property bag with offset property is rejected if offset is in the wrong format
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("UTC");
|
||||||
|
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||||
|
|
||||||
|
const badOffsets = [
|
||||||
|
"00:00", // missing sign
|
||||||
|
"+0", // too short
|
||||||
|
"-000:00", // too long
|
||||||
|
0, // converts to a string that is invalid
|
||||||
|
];
|
||||||
|
badOffsets.forEach((offset) => {
|
||||||
|
const relativeTo = { year: 2021, month: 10, day: 28, offset, timeZone };
|
||||||
|
assert.throws(RangeError, () => instance.round({ largestUnit: "years", relativeTo }), `"${offset} is not a valid offset string`);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Duration/prototype/round/timezone-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Duration/prototype/round/timezone-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.round
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Duration(1);
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/Duration/prototype/subtract/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/Duration/prototype/subtract/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.subtract
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Duration(0, 0, 0, 0, 1);
|
||||||
|
|
||||||
|
const result1 = instance.subtract({ hours: 1 }, {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.subtract({ hours: 1 }, () => {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,25 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.subtract
|
||||||
|
description: relativeTo property bag with offset property is rejected if offset is in the wrong format
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("UTC");
|
||||||
|
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||||
|
|
||||||
|
const badOffsets = [
|
||||||
|
"00:00", // missing sign
|
||||||
|
"+0", // too short
|
||||||
|
"-000:00", // too long
|
||||||
|
0, // converts to a string that is invalid
|
||||||
|
];
|
||||||
|
badOffsets.forEach((offset) => {
|
||||||
|
const relativeTo = { year: 2021, month: 10, day: 28, offset, timeZone };
|
||||||
|
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(0, 0, 0, 0, 24), { relativeTo }), `"${offset} is not a valid offset string`);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Duration/prototype/subtract/timezone-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Duration/prototype/subtract/timezone-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.subtract
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Duration(1);
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -17,7 +17,13 @@ features: [Temporal]
|
||||||
|
|
||||||
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 650, 0);
|
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 650, 0);
|
||||||
|
|
||||||
const string = duration.toString({ fractionalSecondDigits: 2.5 });
|
let string = duration.toString({ fractionalSecondDigits: 2.5 });
|
||||||
assert.sameValue(string, "P1Y2M3W4DT5H6M7.98S", "fractionalSecondDigits 2.5 floors to 2");
|
assert.sameValue(string, "P1Y2M3W4DT5H6M7.98S", "fractionalSecondDigits 2.5 truncates to 2");
|
||||||
|
|
||||||
|
string = duration.toString({ fractionalSecondDigits: 9.7 });
|
||||||
|
assert.sameValue(string, "P1Y2M3W4DT5H6M7.987650000S", "fractionalSecondDigits 9.7 truncates to 9 and is not out of range");
|
||||||
|
|
||||||
|
string = duration.toString({ fractionalSecondDigits: -0.6 });
|
||||||
|
assert.sameValue(string, "P1Y2M3W4DT5H6M7S", "fractionalSecondDigits -0.6 truncates to 0 and is not out of range");
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
25
js/src/tests/test262/built-ins/Temporal/Duration/prototype/toString/options-object.js
поставляемый
Normal file
25
js/src/tests/test262/built-ins/Temporal/Duration/prototype/toString/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.tostring
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Duration(0, 0, 0, 0, 1);
|
||||||
|
|
||||||
|
const result1 = instance.toString({});
|
||||||
|
assert.sameValue(
|
||||||
|
result1, "PT1H",
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.toString(() => {});
|
||||||
|
assert.sameValue(
|
||||||
|
result2, "PT1H",
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
25
js/src/tests/test262/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-invalid-offset-string.js
поставляемый
Normal file
25
js/src/tests/test262/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-invalid-offset-string.js
поставляемый
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.total
|
||||||
|
description: relativeTo property bag with offset property is rejected if offset is in the wrong format
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const timeZone = new Temporal.TimeZone("UTC");
|
||||||
|
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||||
|
|
||||||
|
const badOffsets = [
|
||||||
|
"00:00", // missing sign
|
||||||
|
"+0", // too short
|
||||||
|
"-000:00", // too long
|
||||||
|
0, // converts to a string that is invalid
|
||||||
|
];
|
||||||
|
badOffsets.forEach((offset) => {
|
||||||
|
const relativeTo = { year: 2021, month: 10, day: 28, offset, timeZone };
|
||||||
|
assert.throws(RangeError, () => instance.total({ unit: "days", relativeTo }), `"${offset} is not a valid offset string`);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Duration/prototype/total/timezone-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Duration/prototype/total/timezone-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.total
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Duration(1);
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
15
js/src/tests/test262/built-ins/Temporal/Duration/prototype/total/total-value-infinity.js
поставляемый
Normal file
15
js/src/tests/test262/built-ins/Temporal/Duration/prototype/total/total-value-infinity.js
поставляемый
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.total
|
||||||
|
description: Returns ±∞ when total is not representable as a Number value.
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Duration(0, 0, 0, 0, 0, 0, 0, 0, Number.MAX_VALUE, 0);
|
||||||
|
|
||||||
|
assert.sameValue(instance.total('nanoseconds'), Infinity);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
63
js/src/tests/test262/built-ins/Temporal/Instant/prototype/add/minimum-maximum-instant.js
поставляемый
Normal file
63
js/src/tests/test262/built-ins/Temporal/Instant/prototype/add/minimum-maximum-instant.js
поставляемый
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.instant.prototype.add
|
||||||
|
description: >
|
||||||
|
Instant is minimum/maximum instant.
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let min = new Temporal.Instant(-86_40000_00000_00000_00000n);
|
||||||
|
let max = new Temporal.Instant(86_40000_00000_00000_00000n);
|
||||||
|
|
||||||
|
let zero = Temporal.Duration.from({nanoseconds: 0});
|
||||||
|
let one = Temporal.Duration.from({nanoseconds: 1});
|
||||||
|
let minusOne = Temporal.Duration.from({nanoseconds: -1});
|
||||||
|
|
||||||
|
assert.sameValue(min.add(zero).epochNanoseconds, min.epochNanoseconds,
|
||||||
|
"Adding zero to the minimum instant");
|
||||||
|
|
||||||
|
assert.sameValue(max.add(zero).epochNanoseconds, max.epochNanoseconds,
|
||||||
|
"Adding zero to the maximum instant");
|
||||||
|
|
||||||
|
assert.throws(RangeError, () => min.add(minusOne),
|
||||||
|
"Subtracting one from the minimum instant");
|
||||||
|
|
||||||
|
assert.throws(RangeError, () => max.add(one),
|
||||||
|
"Adding one to the maximum instant");
|
||||||
|
|
||||||
|
assert.sameValue(min.add(one).epochNanoseconds, min.epochNanoseconds + 1n,
|
||||||
|
"Adding one to the minimum instant");
|
||||||
|
|
||||||
|
assert.sameValue(max.add(minusOne).epochNanoseconds, max.epochNanoseconds - 1n,
|
||||||
|
"Subtracting one from the maximum instant");
|
||||||
|
|
||||||
|
// From minimum to maximum instant.
|
||||||
|
assert.sameValue(min.add({nanoseconds: 86_40000_00000_00000_00000 * 2}).epochNanoseconds, max.epochNanoseconds,
|
||||||
|
"Minimum to maximum instant by adding nanoseconds");
|
||||||
|
|
||||||
|
assert.sameValue(min.add({microseconds: 8640_00000_00000_00000 * 2}).epochNanoseconds, max.epochNanoseconds,
|
||||||
|
"Minimum to maximum instant by adding microseconds");
|
||||||
|
|
||||||
|
assert.sameValue(min.add({milliseconds: 8_64000_00000_00000 * 2}).epochNanoseconds, max.epochNanoseconds,
|
||||||
|
"Minimum to maximum instant by adding milliseconds");
|
||||||
|
|
||||||
|
assert.sameValue(min.add({seconds: 864_00000_00000 * 2}).epochNanoseconds, max.epochNanoseconds,
|
||||||
|
"Minimum to maximum instant by adding seconds");
|
||||||
|
|
||||||
|
// From maximum to minimum instant.
|
||||||
|
assert.sameValue(max.add({nanoseconds: -86_40000_00000_00000_00000 * 2}).epochNanoseconds, min.epochNanoseconds,
|
||||||
|
"Maximum to minimum instant by adding nanoseconds");
|
||||||
|
|
||||||
|
assert.sameValue(max.add({microseconds: -8640_00000_00000_00000 * 2}).epochNanoseconds, min.epochNanoseconds,
|
||||||
|
"Maximum to minimum instant by adding microseconds");
|
||||||
|
|
||||||
|
assert.sameValue(max.add({milliseconds: -8_64000_00000_00000 * 2}).epochNanoseconds, min.epochNanoseconds,
|
||||||
|
"Maximum to minimum instant by adding milliseconds");
|
||||||
|
|
||||||
|
assert.sameValue(max.add({seconds: -864_00000_00000 * 2}).epochNanoseconds, min.epochNanoseconds,
|
||||||
|
"Maximum to minimum instant by adding seconds");
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/Instant/prototype/since/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/Instant/prototype/since/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.instant.prototype.since
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Instant(0n);
|
||||||
|
|
||||||
|
const result1 = instance.since(new Temporal.Instant(3600_000_000_000n), {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result1, 0, 0, 0, 0, 0, 0, -3600, 0, 0, 0,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.since(new Temporal.Instant(3600_000_000_000n), () => {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result2, 0, 0, 0, 0, 0, 0, -3600, 0, 0, 0,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
55
js/src/tests/test262/built-ins/Temporal/Instant/prototype/subtract/minimum-maximum-instant.js
поставляемый
Normal file
55
js/src/tests/test262/built-ins/Temporal/Instant/prototype/subtract/minimum-maximum-instant.js
поставляемый
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.instant.prototype.subtract
|
||||||
|
description: >
|
||||||
|
Instant is minimum/maximum instant.
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let min = new Temporal.Instant(-86_40000_00000_00000_00000n);
|
||||||
|
let max = new Temporal.Instant(86_40000_00000_00000_00000n);
|
||||||
|
|
||||||
|
let zero = Temporal.Duration.from({nanoseconds: 0});
|
||||||
|
let one = Temporal.Duration.from({nanoseconds: 1});
|
||||||
|
let minusOne = Temporal.Duration.from({nanoseconds: -1});
|
||||||
|
|
||||||
|
// Adding zero to the minimum instant.
|
||||||
|
assert.sameValue(min.subtract(zero).epochNanoseconds, min.epochNanoseconds);
|
||||||
|
|
||||||
|
// Adding zero to the maximum instant.
|
||||||
|
assert.sameValue(max.subtract(zero).epochNanoseconds, max.epochNanoseconds);
|
||||||
|
|
||||||
|
// Subtracting one from the minimum instant.
|
||||||
|
assert.throws(RangeError, () => min.subtract(one));
|
||||||
|
|
||||||
|
// Adding one to the maximum instant.
|
||||||
|
assert.throws(RangeError, () => max.subtract(minusOne));
|
||||||
|
|
||||||
|
// Adding one to the minimum instant.
|
||||||
|
assert.sameValue(min.subtract(minusOne).epochNanoseconds, min.epochNanoseconds + 1n);
|
||||||
|
|
||||||
|
// Subtracting one from the maximum instant.
|
||||||
|
assert.sameValue(max.subtract(one).epochNanoseconds, max.epochNanoseconds - 1n);
|
||||||
|
|
||||||
|
// From minimum to maximum instant.
|
||||||
|
assert.sameValue(min.subtract({nanoseconds: -86_40000_00000_00000_00000 * 2}).epochNanoseconds, max.epochNanoseconds);
|
||||||
|
|
||||||
|
assert.sameValue(min.subtract({microseconds: -8640_00000_00000_00000 * 2}).epochNanoseconds, max.epochNanoseconds);
|
||||||
|
|
||||||
|
assert.sameValue(min.subtract({milliseconds: -8_64000_00000_00000 * 2}).epochNanoseconds, max.epochNanoseconds);
|
||||||
|
|
||||||
|
assert.sameValue(min.subtract({seconds: -864_00000_00000 * 2}).epochNanoseconds, max.epochNanoseconds);
|
||||||
|
|
||||||
|
// From maximum to minimum instant.
|
||||||
|
assert.sameValue(max.subtract({nanoseconds: 86_40000_00000_00000_00000 * 2}).epochNanoseconds, min.epochNanoseconds);
|
||||||
|
|
||||||
|
assert.sameValue(max.subtract({microseconds: 8640_00000_00000_00000 * 2}).epochNanoseconds, min.epochNanoseconds);
|
||||||
|
|
||||||
|
assert.sameValue(max.subtract({milliseconds: 8_64000_00000_00000 * 2}).epochNanoseconds, min.epochNanoseconds);
|
||||||
|
|
||||||
|
assert.sameValue(max.subtract({seconds: 864_00000_00000 * 2}).epochNanoseconds, min.epochNanoseconds);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -17,7 +17,13 @@ features: [Temporal]
|
||||||
|
|
||||||
const instant = new Temporal.Instant(1_000_000_000_987_650_000n);
|
const instant = new Temporal.Instant(1_000_000_000_987_650_000n);
|
||||||
|
|
||||||
const string = instant.toString({ fractionalSecondDigits: 2.5 });
|
let string = instant.toString({ fractionalSecondDigits: 2.5 });
|
||||||
assert.sameValue(string, "2001-09-09T01:46:40.98Z", "fractionalSecondDigits 2.5 floors to 2");
|
assert.sameValue(string, "2001-09-09T01:46:40.98Z", "fractionalSecondDigits 2.5 truncates to 2");
|
||||||
|
|
||||||
|
string = instant.toString({ fractionalSecondDigits: 9.7 });
|
||||||
|
assert.sameValue(string, "2001-09-09T01:46:40.987650000Z", "fractionalSecondDigits 9.7 truncates to 9 and is not out of range");
|
||||||
|
|
||||||
|
string = instant.toString({ fractionalSecondDigits: -0.6 });
|
||||||
|
assert.sameValue(string, "2001-09-09T01:46:40Z", "fractionalSecondDigits -0.6 truncates to 0 and is not out of range");
|
||||||
|
|
||||||
reportCompare(0, 0);
|
reportCompare(0, 0);
|
||||||
|
|
25
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toString/options-object.js
поставляемый
Normal file
25
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toString/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.instant.prototype.tostring
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Instant(0n);
|
||||||
|
|
||||||
|
const result1 = instance.toString({});
|
||||||
|
assert.sameValue(
|
||||||
|
result1, "1970-01-01T00:00:00Z",
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.toString(() => {});
|
||||||
|
assert.sameValue(
|
||||||
|
result2, "1970-01-01T00:00:00Z",
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toString/timezone-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toString/timezone-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.instant.prototype.tostring
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Instant(0n);
|
||||||
|
|
||||||
|
const result1 = instance.toString({ timeZone: "UTC" });
|
||||||
|
assert.sameValue(result1.substr(-6), "+00:00", "Time zone created from string 'UTC'");
|
||||||
|
|
||||||
|
const result2 = instance.toString({ timeZone: "-01:30" });
|
||||||
|
assert.sameValue(result2.substr(-6), "-01:30", "Time zone created from string '-01:30'");
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
18
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js
поставляемый
Normal file
18
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.instant.prototype.tozoneddatetime
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Instant(1_000_000_000_000_000_000n);
|
||||||
|
|
||||||
|
const arg = "iso8601";
|
||||||
|
|
||||||
|
const result = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" });
|
||||||
|
assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
18
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string.js
поставляемый
Normal file
18
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string.js
поставляемый
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.instant.prototype.tozoneddatetime
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Instant(0n);
|
||||||
|
|
||||||
|
["UTC", "+01:30"].forEach((timeZone) => {
|
||||||
|
const result = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
||||||
|
assert.sameValue(result.timeZone.id, timeZone, `Time zone created from string "${timeZone}"`);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
18
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string.js
поставляемый
Normal file
18
js/src/tests/test262/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string.js
поставляемый
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.instant.prototype.tozoneddatetimeiso
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Instant(0n);
|
||||||
|
|
||||||
|
["UTC", "+01:30"].forEach((timeZone) => {
|
||||||
|
const result = instance.toZonedDateTimeISO(timeZone);
|
||||||
|
assert.sameValue(result.timeZone.id, timeZone, `Time zone created from string "${timeZone}"`);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/Instant/prototype/until/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/Instant/prototype/until/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.instant.prototype.until
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.Instant(0n);
|
||||||
|
|
||||||
|
const result1 = instance.until(new Temporal.Instant(3600_000_000_000n), {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result1, 0, 0, 0, 0, 0, 0, 3600, 0, 0, 0,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.until(new Temporal.Instant(3600_000_000_000n), () => {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result2, 0, 0, 0, 0, 0, 0, 3600, 0, 0, 0,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,16 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.plaindate
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const arg = "iso8601";
|
||||||
|
|
||||||
|
const result = Temporal.Now.plainDate(arg);
|
||||||
|
assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,17 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.plaindate
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
Temporal.Now.plainDate("iso8601", timeZone);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,17 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.plaindateiso
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
Temporal.Now.plainDateISO(timeZone);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,16 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.plaindatetime
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const arg = "iso8601";
|
||||||
|
|
||||||
|
const result = Temporal.Now.plainDateTime(arg);
|
||||||
|
assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,17 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.plaindatetime
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
Temporal.Now.plainDateTime("iso8601", timeZone);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,17 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.plaindatetimeiso
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
Temporal.Now.plainDateTimeISO(timeZone);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,17 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.plaintimeiso
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// The following are all valid strings so should not throw:
|
||||||
|
|
||||||
|
["UTC", "+01:00"].forEach((timeZone) => {
|
||||||
|
Temporal.Now.plainTimeISO(timeZone);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,16 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.zoneddatetime
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const arg = "iso8601";
|
||||||
|
|
||||||
|
const result = Temporal.Now.zonedDateTime(arg);
|
||||||
|
assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,16 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.zoneddatetime
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
["UTC", "+01:30"].forEach((timeZone) => {
|
||||||
|
const result = Temporal.Now.zonedDateTime("iso8601", timeZone);
|
||||||
|
assert.sameValue(result.timeZone.id, timeZone, `Time zone created from string "${timeZone}"`);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,16 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.now.zoneddatetimeiso
|
||||||
|
description: Time zone IDs are valid input for a time zone
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
["UTC", "+01:30"].forEach((timeZone) => {
|
||||||
|
const result = Temporal.Now.zonedDateTimeISO(timeZone);
|
||||||
|
assert.sameValue(result.timeZone.id, timeZone, `Time zone created from string "${timeZone}"`);
|
||||||
|
});
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,16 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.constructor
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const arg = "iso8601";
|
||||||
|
|
||||||
|
const result = new Temporal.PlainDate(2000, 5, 2, arg);
|
||||||
|
assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,21 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.compare
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
|
||||||
|
const result1 = Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18));
|
||||||
|
assert.sameValue(result1, 0, `Calendar created from string "${arg}" (first argument)`);
|
||||||
|
|
||||||
|
const result2 = Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg);
|
||||||
|
assert.sameValue(result2, 0, `Calendar created from string "${arg}" (second argument)`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,18 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.from
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = Temporal.PlainDate.from(arg);
|
||||||
|
TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
|
@ -0,0 +1,22 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.prototype.from
|
||||||
|
description: Empty object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
Temporal.PlainDate.from({ year: 1976, month: 11, day: 18 }, {}), 1976, 11, "M11", 18,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
Temporal.PlainDate.from({ year: 1976, month: 11, day: 18 }, () => {}), 1976, 11, "M11", 18,
|
||||||
|
"options may be an empty function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/add/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/add/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.prototype.add
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||||
|
|
||||||
|
const result1 = instance.add({ months: 1 }, {});
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
result1, 2000, 6, "M06", 2,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.add({ months: 1 }, () => {});
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
result2, 2000, 6, "M06", 2,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
19
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-string.js
поставляемый
Normal file
19
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.prototype.equals
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.PlainDate(1976, 11, 18);
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.equals(arg);
|
||||||
|
assert.sameValue(result, true, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
20
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-string.js
поставляемый
Normal file
20
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-string.js
поставляемый
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.prototype.since
|
||||||
|
description: A calendar ID is valid input for Calendar
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.PlainDate(1976, 11, 18);
|
||||||
|
|
||||||
|
const calendar = "iso8601";
|
||||||
|
|
||||||
|
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
|
||||||
|
const result = instance.since(arg);
|
||||||
|
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/since/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/since/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.prototype.since
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||||
|
|
||||||
|
const result1 = instance.since(new Temporal.PlainDate(1976, 11, 18), {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result1, 0, 0, 0, 8566, 0, 0, 0, 0, 0, 0,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.since(new Temporal.PlainDate(1976, 11, 18), () => {});
|
||||||
|
TemporalHelpers.assertDuration(
|
||||||
|
result2, 0, 0, 0, 8566, 0, 0, 0, 0, 0, 0,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
26
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/subtract/options-object.js
поставляемый
Normal file
26
js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/subtract/options-object.js
поставляемый
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// |reftest| skip -- Temporal is not supported
|
||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.prototype.subtract
|
||||||
|
description: Empty or a function object may be used as options
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||||
|
|
||||||
|
const result1 = instance.subtract({ months: 1 }, {});
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
result1, 2000, 4, "M04", 2,
|
||||||
|
"options may be an empty plain object"
|
||||||
|
);
|
||||||
|
|
||||||
|
const result2 = instance.subtract({ months: 1 }, () => {});
|
||||||
|
TemporalHelpers.assertPlainDate(
|
||||||
|
result2, 2000, 4, "M04", 2,
|
||||||
|
"options may be a function object"
|
||||||
|
);
|
||||||
|
|
||||||
|
reportCompare(0, 0);
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче