Add test for invalid mixed cal

This commit is contained in:
Sarah GHP 2021-11-16 20:12:46 +01:00 committed by Rick Waldron
parent 9c6ecf5326
commit abf437c338
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainyearmonth.prototype.since
description: Mixed calendars throw as invalid
features: [Temporal]
---*/
class customCal extends Temporal.Calendar {
constructor () {
super('iso8601');
}
toString() {
return "I am a secret cal.";
}
}
const ym1 = new Temporal.PlainYearMonth(2000, 1);
const ym2 = new Temporal.PlainYearMonth(2000, 1, new customCal());
assert.throws(RangeError, () => ym1.since(ym2), 'since throws with different calendars');