-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add branding and prop-desc tests for Date.
- Loading branch information
Showing
43 changed files
with
692 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.day | ||
---*/ | ||
|
||
const day = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "day").get; | ||
|
||
assert.sameValue(typeof day, "function"); | ||
|
||
assert.throws(TypeError, () => day.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => day.call(null), "null"); | ||
assert.throws(TypeError, () => day.call(true), "true"); | ||
assert.throws(TypeError, () => day.call(""), "empty string"); | ||
assert.throws(TypeError, () => day.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => day.call(1), "1"); | ||
assert.throws(TypeError, () => day.call({}), "plain object"); | ||
assert.throws(TypeError, () => day.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => day.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.day | ||
---*/ | ||
|
||
const descriptor = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "day"); | ||
assert.sameValue(typeof descriptor.get, "function"); | ||
assert.sameValue(descriptor.set, undefined); | ||
assert.sameValue(descriptor.enumerable, false); | ||
assert.sameValue(descriptor.configurable, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.dayofweek | ||
---*/ | ||
|
||
const dayOfWeek = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "dayOfWeek").get; | ||
|
||
assert.sameValue(typeof dayOfWeek, "function"); | ||
|
||
assert.throws(TypeError, () => dayOfWeek.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => dayOfWeek.call(null), "null"); | ||
assert.throws(TypeError, () => dayOfWeek.call(true), "true"); | ||
assert.throws(TypeError, () => dayOfWeek.call(""), "empty string"); | ||
assert.throws(TypeError, () => dayOfWeek.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => dayOfWeek.call(1), "1"); | ||
assert.throws(TypeError, () => dayOfWeek.call({}), "plain object"); | ||
assert.throws(TypeError, () => dayOfWeek.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => dayOfWeek.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.dayofweek | ||
---*/ | ||
|
||
const descriptor = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "dayOfWeek"); | ||
assert.sameValue(typeof descriptor.get, "function"); | ||
assert.sameValue(descriptor.set, undefined); | ||
assert.sameValue(descriptor.enumerable, false); | ||
assert.sameValue(descriptor.configurable, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.dayofyear | ||
---*/ | ||
|
||
const dayOfYear = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "dayOfYear").get; | ||
|
||
assert.sameValue(typeof dayOfYear, "function"); | ||
|
||
assert.throws(TypeError, () => dayOfYear.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => dayOfYear.call(null), "null"); | ||
assert.throws(TypeError, () => dayOfYear.call(true), "true"); | ||
assert.throws(TypeError, () => dayOfYear.call(""), "empty string"); | ||
assert.throws(TypeError, () => dayOfYear.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => dayOfYear.call(1), "1"); | ||
assert.throws(TypeError, () => dayOfYear.call({}), "plain object"); | ||
assert.throws(TypeError, () => dayOfYear.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => dayOfYear.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.dayofyear | ||
---*/ | ||
|
||
const descriptor = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "dayOfYear"); | ||
assert.sameValue(typeof descriptor.get, "function"); | ||
assert.sameValue(descriptor.set, undefined); | ||
assert.sameValue(descriptor.enumerable, false); | ||
assert.sameValue(descriptor.configurable, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.daysinmonth | ||
---*/ | ||
|
||
const daysInMonth = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "daysInMonth").get; | ||
|
||
assert.sameValue(typeof daysInMonth, "function"); | ||
|
||
assert.throws(TypeError, () => daysInMonth.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => daysInMonth.call(null), "null"); | ||
assert.throws(TypeError, () => daysInMonth.call(true), "true"); | ||
assert.throws(TypeError, () => daysInMonth.call(""), "empty string"); | ||
assert.throws(TypeError, () => daysInMonth.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => daysInMonth.call(1), "1"); | ||
assert.throws(TypeError, () => daysInMonth.call({}), "plain object"); | ||
assert.throws(TypeError, () => daysInMonth.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => daysInMonth.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.daysinmonth | ||
---*/ | ||
|
||
const descriptor = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "daysInMonth"); | ||
assert.sameValue(typeof descriptor.get, "function"); | ||
assert.sameValue(descriptor.set, undefined); | ||
assert.sameValue(descriptor.enumerable, false); | ||
assert.sameValue(descriptor.configurable, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.daysinyear | ||
---*/ | ||
|
||
const daysInYear = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "daysInYear").get; | ||
|
||
assert.sameValue(typeof daysInYear, "function"); | ||
|
||
assert.throws(TypeError, () => daysInYear.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => daysInYear.call(null), "null"); | ||
assert.throws(TypeError, () => daysInYear.call(true), "true"); | ||
assert.throws(TypeError, () => daysInYear.call(""), "empty string"); | ||
assert.throws(TypeError, () => daysInYear.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => daysInYear.call(1), "1"); | ||
assert.throws(TypeError, () => daysInYear.call({}), "plain object"); | ||
assert.throws(TypeError, () => daysInYear.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => daysInYear.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.daysinyear | ||
---*/ | ||
|
||
const descriptor = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "daysInYear"); | ||
assert.sameValue(typeof descriptor.get, "function"); | ||
assert.sameValue(descriptor.set, undefined); | ||
assert.sameValue(descriptor.enumerable, false); | ||
assert.sameValue(descriptor.configurable, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.date.prototype.difference | ||
---*/ | ||
|
||
const difference = Temporal.Date.prototype.difference; | ||
|
||
assert.sameValue(typeof difference, "function"); | ||
|
||
assert.throws(TypeError, () => difference.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => difference.call(null), "null"); | ||
assert.throws(TypeError, () => difference.call(true), "true"); | ||
assert.throws(TypeError, () => difference.call(""), "empty string"); | ||
assert.throws(TypeError, () => difference.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => difference.call(1), "1"); | ||
assert.throws(TypeError, () => difference.call({}), "plain object"); | ||
assert.throws(TypeError, () => difference.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => difference.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.date.prototype.difference | ||
includes: [propertyHelper.js] | ||
---*/ | ||
|
||
assert.sameValue( | ||
typeof Temporal.Date.prototype.difference, | ||
"function", | ||
"`typeof Date.prototype.difference` is `function`" | ||
); | ||
|
||
verifyProperty(Temporal.Date.prototype, "difference", { | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
polyfill/test/Date/prototype/getISOCalendarFields/branding.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.isleapyear | ||
---*/ | ||
|
||
const isLeapYear = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "isLeapYear").get; | ||
|
||
assert.sameValue(typeof isLeapYear, "function"); | ||
|
||
assert.throws(TypeError, () => isLeapYear.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => isLeapYear.call(null), "null"); | ||
assert.throws(TypeError, () => isLeapYear.call(true), "true"); | ||
assert.throws(TypeError, () => isLeapYear.call(""), "empty string"); | ||
assert.throws(TypeError, () => isLeapYear.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => isLeapYear.call(1), "1"); | ||
assert.throws(TypeError, () => isLeapYear.call({}), "plain object"); | ||
assert.throws(TypeError, () => isLeapYear.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => isLeapYear.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.isleapyear | ||
---*/ | ||
|
||
const descriptor = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "isLeapYear"); | ||
assert.sameValue(typeof descriptor.get, "function"); | ||
assert.sameValue(descriptor.set, undefined); | ||
assert.sameValue(descriptor.enumerable, false); | ||
assert.sameValue(descriptor.configurable, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.date.prototype.minus | ||
---*/ | ||
|
||
const minus = Temporal.Date.prototype.minus; | ||
|
||
assert.sameValue(typeof minus, "function"); | ||
|
||
assert.throws(TypeError, () => minus.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => minus.call(null), "null"); | ||
assert.throws(TypeError, () => minus.call(true), "true"); | ||
assert.throws(TypeError, () => minus.call(""), "empty string"); | ||
assert.throws(TypeError, () => minus.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => minus.call(1), "1"); | ||
assert.throws(TypeError, () => minus.call({}), "plain object"); | ||
assert.throws(TypeError, () => minus.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => minus.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.date.prototype.minus | ||
includes: [propertyHelper.js] | ||
---*/ | ||
|
||
assert.sameValue( | ||
typeof Temporal.Date.prototype.minus, | ||
"function", | ||
"`typeof Date.prototype.minus` is `function`" | ||
); | ||
|
||
verifyProperty(Temporal.Date.prototype, "minus", { | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.month | ||
---*/ | ||
|
||
const month = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "month").get; | ||
|
||
assert.sameValue(typeof month, "function"); | ||
|
||
assert.throws(TypeError, () => month.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => month.call(null), "null"); | ||
assert.throws(TypeError, () => month.call(true), "true"); | ||
assert.throws(TypeError, () => month.call(""), "empty string"); | ||
assert.throws(TypeError, () => month.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => month.call(1), "1"); | ||
assert.throws(TypeError, () => month.call({}), "plain object"); | ||
assert.throws(TypeError, () => month.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => month.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-get-temporal.date.prototype.month | ||
---*/ | ||
|
||
const descriptor = Object.getOwnPropertyDescriptor(Temporal.Date.prototype, "month"); | ||
assert.sameValue(typeof descriptor.get, "function"); | ||
assert.sameValue(descriptor.set, undefined); | ||
assert.sameValue(descriptor.enumerable, false); | ||
assert.sameValue(descriptor.configurable, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.date.prototype.plus | ||
---*/ | ||
|
||
const plus = Temporal.Date.prototype.plus; | ||
|
||
assert.sameValue(typeof plus, "function"); | ||
|
||
assert.throws(TypeError, () => plus.call(undefined), "undefined"); | ||
assert.throws(TypeError, () => plus.call(null), "null"); | ||
assert.throws(TypeError, () => plus.call(true), "true"); | ||
assert.throws(TypeError, () => plus.call(""), "empty string"); | ||
assert.throws(TypeError, () => plus.call(Symbol()), "symbol"); | ||
assert.throws(TypeError, () => plus.call(1), "1"); | ||
assert.throws(TypeError, () => plus.call({}), "plain object"); | ||
assert.throws(TypeError, () => plus.call(Temporal.Date), "Temporal.Date"); | ||
assert.throws(TypeError, () => plus.call(Temporal.Date.prototype), "Temporal.Date.prototype"); |
Oops, something went wrong.