-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split to different files and test throwing Error
- Loading branch information
1 parent
b5a4033
commit 6cc2d81
Showing
28 changed files
with
404 additions
and
68 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
test/built-ins/Temporal/Calendar/prototype/day/date-time.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.day | ||
description: Temporal.Calendar.prototype.day will take PlainDateTime and return | ||
the value of the day. | ||
info: | | ||
5. Return ! ISODay(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let dateTime = new Temporal.PlainDateTime(1997, 8, 23, 5, 30, 13) | ||
assert.sameValue(23, cal.day(dateTime)); |
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,15 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.day | ||
description: Temporal.Calendar.prototype.day will take PlainDate and return | ||
the value of the day. | ||
info: | | ||
5. Return ! ISODay(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let date = new Temporal.PlainDate(2021, 7, 15); | ||
assert.sameValue(15, cal.day(date)); |
19 changes: 19 additions & 0 deletions
19
test/built-ins/Temporal/Calendar/prototype/day/month-day.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.day | ||
description: Temporal.Calendar.prototype.day will take PlainMonthDay and return | ||
the value of the day. | ||
info: | | ||
4. If Type(temporalDateLike) is not Object or temporalDateLike does not have | ||
an [[InitializedTemporalDate]] or [[InitializedTemporalYearMonth]] internal | ||
slot, then | ||
a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). | ||
5. Return ! ISODay(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let monthDay = new Temporal.PlainMonthDay(7, 15); | ||
assert.sameValue(15, cal.day(monthDay)); |
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,18 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.day | ||
description: Temporal.Calendar.prototype.day will take ISO8601 string and return | ||
the value of the day. | ||
info: | | ||
4. If Type(temporalDateLike) is not Object or temporalDateLike does not have | ||
an [[InitializedTemporalDate]] or [[InitializedTemporalYearMonth]] internal | ||
slot, then | ||
a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). | ||
5. Return ! ISODay(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
assert.sameValue(15, cal.day("2019-03-15")); |
18 changes: 18 additions & 0 deletions
18
test/built-ins/Temporal/Calendar/prototype/day/throw-range-error-ToTemporalDate.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.day | ||
description: Temporal.Calendar.prototype.day throws RangeError on | ||
ToTemporalDate when temporalDateLike is invalid string. | ||
info: | | ||
4. If Type(temporalDateLike) is not Object or temporalDateLike | ||
does not have an [[InitializedTemporalDate]] or | ||
[[InitializedTemporalYearMonth]] internal slot, then | ||
a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
assert.throws(RangeError, () => cal.day("invalid string"), | ||
"Throw RangeError if temporalDateLike is invalid"); |
15 changes: 15 additions & 0 deletions
15
test/built-ins/Temporal/Calendar/prototype/day/throw-type-error-RequireInternalSlot.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.day | ||
description: Temporal.Calendar.prototype.day throws TypeError on RequireInternalSlot if object has no internal slot. | ||
info: | | ||
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let badCal = { day: cal.day } | ||
assert.throws(TypeError, () => badCal.day("2021-03-04"), | ||
"Throw TypeError if there are no internal slot"); |
19 changes: 19 additions & 0 deletions
19
test/built-ins/Temporal/Calendar/prototype/month/date-time.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.month | ||
description: Temporal.Calendar.prototype.month will take PlainDateTime and return | ||
the value of the month. | ||
info: | | ||
5. If Type(temporalDateLike) is not Object or temporalDateLike does not have | ||
an [[InitializedTemporalDate]] or [[InitializedTemporalYearMonth]] | ||
internal slot, then | ||
a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). | ||
6. Return ! ISOMonth(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let dateTime = new Temporal.PlainDateTime(1997, 8, 23, 5, 30, 13) | ||
assert.sameValue(8, cal.month(dateTime)); |
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
19 changes: 19 additions & 0 deletions
19
test/built-ins/Temporal/Calendar/prototype/month/month-day-throw-type-error.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.month | ||
description: Temporal.Calendar.prototype.month throws TypeError if temporalDateLike | ||
is a PlainMonthDay object. | ||
ToTemporalDate when temporalDateLike is invalid string. | ||
info: | | ||
4. If Type(temporalDateLike) is Object and temporalDateLike has an | ||
[[InitializedTemporalMonthDay]] internal slot, then | ||
a. Throw a TypeError exception. | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let monthDay = new Temporal.PlainMonthDay(12, 25); | ||
assert.throws(TypeError, () => cal.month(monthDay), | ||
"Throw TypeError if temporalDateLike is a PlainMonthDay"); |
24 changes: 0 additions & 24 deletions
24
test/built-ins/Temporal/Calendar/prototype/month/simple.js
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
test/built-ins/Temporal/Calendar/prototype/month/string.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.month | ||
description: Temporal.Calendar.prototype.month will take ISO8601 string and return | ||
the value of the month. | ||
info: | | ||
5. If Type(temporalDateLike) is not Object or temporalDateLike does not have | ||
an [[InitializedTemporalDate]] or [[InitializedTemporalYearMonth]] internal | ||
slot, then | ||
a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). | ||
6. Return ! ISOMonth(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
assert.sameValue(3, cal.month("2019-03-15")); |
18 changes: 18 additions & 0 deletions
18
test/built-ins/Temporal/Calendar/prototype/month/throw-range-error-ToTemporalDate.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.month | ||
description: Temporal.Calendar.prototype.month throws RangeError on | ||
ToTemporalDate when temporalDateLike is invalid string. | ||
info: | | ||
5. If Type(temporalDateLike) is not Object or temporalDateLike | ||
does not have an [[InitializedTemporalDate]] or | ||
[[InitializedTemporalYearMonth]] internal slot, then | ||
a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
assert.throws(RangeError, () => cal.month("invalid string"), | ||
"Throw RangeError if temporalDateLike is invalid"); |
15 changes: 15 additions & 0 deletions
15
test/built-ins/Temporal/Calendar/prototype/month/throw-type-error-RequireInternalSlot.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.month | ||
description: Temporal.Calendar.prototype.month throws TypeError on RequireInternalSlot if object has no internal slot. | ||
info: | | ||
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let badCal = { month: cal.month } | ||
assert.throws(TypeError, () => badCal.month("2021-03-04"), | ||
"Throw TypeError if there are no internal slot"); |
15 changes: 15 additions & 0 deletions
15
test/built-ins/Temporal/Calendar/prototype/month/year-month.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.month | ||
description: Temporal.Calendar.prototype.month will take PlainYearMonth and return | ||
the value of the month. | ||
info: | | ||
6. Return ! ISOMonth(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let yearMonth = new Temporal.PlainYearMonth(1999, 6); | ||
assert.sameValue(6, cal.month(yearMonth)); |
15 changes: 15 additions & 0 deletions
15
test/built-ins/Temporal/Calendar/prototype/monthCode/date-time.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.monthCode | ||
description: Temporal.Calendar.prototype.month will take PlainDateTime and return | ||
the value of the monthCode. | ||
info: | | ||
6. Return ! ISOMonthCode(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let dateTime = new Temporal.PlainDateTime(1997, 8, 23, 5, 30, 13) | ||
assert.sameValue("M08", cal.monthCode(dateTime)); |
15 changes: 15 additions & 0 deletions
15
test/built-ins/Temporal/Calendar/prototype/monthCode/date.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.monthCode | ||
description: Temporal.Calendar.prototype.monthCode will take PlainDate and return | ||
the value of the monthCode. | ||
info: | | ||
5. Return ! ISOMonthCode(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let date = new Temporal.PlainDate(2021, 7, 15); | ||
assert.sameValue("M07", cal.monthCode(date)); |
12 changes: 12 additions & 0 deletions
12
test/built-ins/Temporal/Calendar/prototype/monthCode/month-day.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.monthCode | ||
6. Return ! ISOMonthCode(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let monthDay = new Temporal.PlainMonthDay(12, 25); | ||
assert.sameValue("M12", cal.monthCode(monthDay)); |
23 changes: 0 additions & 23 deletions
23
test/built-ins/Temporal/Calendar/prototype/monthCode/simple.js
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
test/built-ins/Temporal/Calendar/prototype/monthCode/string.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.monthCode | ||
description: Temporal.Calendar.prototype.monthCode will take ISO8601 string and return | ||
the value of the monthCode. | ||
info: | | ||
5. If Type(temporalDateLike) is not Object or temporalDateLike does not have | ||
an [[InitializedTemporalDate]] or [[InitializedTemporalYearMonth]] internal | ||
slot, then | ||
a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). | ||
6. Return ! ISOYear(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
assert.sameValue("M03", cal.monthCode("2019-03-15")); |
18 changes: 18 additions & 0 deletions
18
test/built-ins/Temporal/Calendar/prototype/monthCode/throw-range-error-ToTemporalDate.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.monthCode | ||
description: Temporal.Calendar.prototype.monthCode throws RangeError on | ||
ToTemporalDate when temporalDateLike is invalid string. | ||
info: | | ||
4. If Type(temporalDateLike) is not Object or temporalDateLike | ||
does not have an [[InitializedTemporalDate]] or | ||
[[InitializedTemporalYearMonth]] internal slot, then | ||
a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
assert.throws(RangeError, () => cal.monthCode("invalid string"), | ||
"Throw RangeError if temporalDateLike is invalid"); |
15 changes: 15 additions & 0 deletions
15
test/built-ins/Temporal/Calendar/prototype/monthCode/throw-type-error-RequireInternalSlot.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.monthCode | ||
description: Temporal.Calendar.prototype.monthCode throws TypeError on RequireInternalSlot if object has no internal slot. | ||
info: | | ||
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). | ||
features: [Temporal] | ||
---*/ | ||
let cal = new Temporal.Calendar("iso8601"); | ||
|
||
let badCal = { monthCode: cal.monthCode} | ||
assert.throws(TypeError, () => badCal.monthCode("2021-03-04"), | ||
"Throw TypeError if there are no internal slot"); |
Oops, something went wrong.