Skip to content

Commit

Permalink
Remove duplicate tests
Browse files Browse the repository at this point in the history
While working on adding the Temporal tests from tc39/proposal-temporal I
noticed that these tests tested the same thing as each of the branding.js
tests in the same directory. This removes the duplicate tests.
  • Loading branch information
ptomato committed Sep 30, 2021
1 parent 10ad4c1 commit d8efd03
Show file tree
Hide file tree
Showing 24 changed files with 132 additions and 298 deletions.
20 changes: 11 additions & 9 deletions test/built-ins/Temporal/Calendar/prototype/dateAdd/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const dateAdd = Temporal.Calendar.prototype.dateAdd;

assert.sameValue(typeof dateAdd, "function");

assert.throws(TypeError, () => dateAdd.call(undefined), "undefined");
assert.throws(TypeError, () => dateAdd.call(null), "null");
assert.throws(TypeError, () => dateAdd.call(true), "true");
assert.throws(TypeError, () => dateAdd.call(""), "empty string");
assert.throws(TypeError, () => dateAdd.call(Symbol()), "symbol");
assert.throws(TypeError, () => dateAdd.call(1), "1");
assert.throws(TypeError, () => dateAdd.call({}), "plain object");
assert.throws(TypeError, () => dateAdd.call(Temporal.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => dateAdd.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");
const args = [new Temporal.PlainDate(2000, 1, 1), new Temporal.Duration(1)];

assert.throws(TypeError, () => dateAdd.apply(undefined, args), "undefined");
assert.throws(TypeError, () => dateAdd.apply(null, args), "null");
assert.throws(TypeError, () => dateAdd.apply(true, args), "true");
assert.throws(TypeError, () => dateAdd.apply("", args), "empty string");
assert.throws(TypeError, () => dateAdd.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => dateAdd.apply(1, args), "1");
assert.throws(TypeError, () => dateAdd.apply({}, args), "plain object");
assert.throws(TypeError, () => dateAdd.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => dateAdd.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const dateFromFields = Temporal.Calendar.prototype.dateFromFields;

assert.sameValue(typeof dateFromFields, "function");

assert.throws(TypeError, () => dateFromFields.call(undefined), "undefined");
assert.throws(TypeError, () => dateFromFields.call(null), "null");
assert.throws(TypeError, () => dateFromFields.call(true), "true");
assert.throws(TypeError, () => dateFromFields.call(""), "empty string");
assert.throws(TypeError, () => dateFromFields.call(Symbol()), "symbol");
assert.throws(TypeError, () => dateFromFields.call(1), "1");
assert.throws(TypeError, () => dateFromFields.call({}), "plain object");
assert.throws(TypeError, () => dateFromFields.call(Temporal.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => dateFromFields.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");
const args = [{ year: 2000, month: 1, day: 1 }];

assert.throws(TypeError, () => dateFromFields.apply(undefined, args), "undefined");
assert.throws(TypeError, () => dateFromFields.apply(null, args), "null");
assert.throws(TypeError, () => dateFromFields.apply(true, args), "true");
assert.throws(TypeError, () => dateFromFields.apply("", args), "empty string");
assert.throws(TypeError, () => dateFromFields.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => dateFromFields.apply(1, args), "1");
assert.throws(TypeError, () => dateFromFields.apply({}, args), "plain object");
assert.throws(TypeError, () => dateFromFields.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => dateFromFields.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");

This file was deleted.

20 changes: 11 additions & 9 deletions test/built-ins/Temporal/Calendar/prototype/dateUntil/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const dateUntil = Temporal.Calendar.prototype.dateUntil;

assert.sameValue(typeof dateUntil, "function");

assert.throws(TypeError, () => dateUntil.call(undefined), "undefined");
assert.throws(TypeError, () => dateUntil.call(null), "null");
assert.throws(TypeError, () => dateUntil.call(true), "true");
assert.throws(TypeError, () => dateUntil.call(""), "empty string");
assert.throws(TypeError, () => dateUntil.call(Symbol()), "symbol");
assert.throws(TypeError, () => dateUntil.call(1), "1");
assert.throws(TypeError, () => dateUntil.call({}), "plain object");
assert.throws(TypeError, () => dateUntil.call(Temporal.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => dateUntil.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");
const args = [new Temporal.PlainDate(2021, 7, 16), new Temporal.PlainDate(2021, 7, 17)];

assert.throws(TypeError, () => dateUntil.apply(undefined, args), "undefined");
assert.throws(TypeError, () => dateUntil.apply(null, args), "null");
assert.throws(TypeError, () => dateUntil.apply(true, args), "true");
assert.throws(TypeError, () => dateUntil.apply("", args), "empty string");
assert.throws(TypeError, () => dateUntil.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => dateUntil.apply(1, args), "1");
assert.throws(TypeError, () => dateUntil.apply({}, args), "plain object");
assert.throws(TypeError, () => dateUntil.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => dateUntil.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");

This file was deleted.

20 changes: 11 additions & 9 deletions test/built-ins/Temporal/Calendar/prototype/day/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const day = Temporal.Calendar.prototype.day;

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.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => day.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");
const args = [new Temporal.PlainDate(2000, 1, 1)];

assert.throws(TypeError, () => day.apply(undefined, args), "undefined");
assert.throws(TypeError, () => day.apply(null, args), "null");
assert.throws(TypeError, () => day.apply(true, args), "true");
assert.throws(TypeError, () => day.apply("", args), "empty string");
assert.throws(TypeError, () => day.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => day.apply(1, args), "1");
assert.throws(TypeError, () => day.apply({}, args), "plain object");
assert.throws(TypeError, () => day.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => day.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");

This file was deleted.

20 changes: 11 additions & 9 deletions test/built-ins/Temporal/Calendar/prototype/dayOfWeek/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const dayOfWeek = Temporal.Calendar.prototype.dayOfWeek;

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.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => dayOfWeek.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");
const args = [new Temporal.PlainDate(2000, 1, 1)];

assert.throws(TypeError, () => dayOfWeek.apply(undefined, args), "undefined");
assert.throws(TypeError, () => dayOfWeek.apply(null, args), "null");
assert.throws(TypeError, () => dayOfWeek.apply(true, args), "true");
assert.throws(TypeError, () => dayOfWeek.apply("", args), "empty string");
assert.throws(TypeError, () => dayOfWeek.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => dayOfWeek.apply(1, args), "1");
assert.throws(TypeError, () => dayOfWeek.apply({}, args), "plain object");
assert.throws(TypeError, () => dayOfWeek.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => dayOfWeek.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");

This file was deleted.

20 changes: 11 additions & 9 deletions test/built-ins/Temporal/Calendar/prototype/dayOfYear/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const dayOfYear = Temporal.Calendar.prototype.dayOfYear;

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.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => dayOfYear.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");
const args = [new Temporal.PlainDate(2000, 1, 1)];

assert.throws(TypeError, () => dayOfYear.apply(undefined, args), "undefined");
assert.throws(TypeError, () => dayOfYear.apply(null, args), "null");
assert.throws(TypeError, () => dayOfYear.apply(true, args), "true");
assert.throws(TypeError, () => dayOfYear.apply("", args), "empty string");
assert.throws(TypeError, () => dayOfYear.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => dayOfYear.apply(1, args), "1");
assert.throws(TypeError, () => dayOfYear.apply({}, args), "plain object");
assert.throws(TypeError, () => dayOfYear.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => dayOfYear.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");

This file was deleted.

20 changes: 11 additions & 9 deletions test/built-ins/Temporal/Calendar/prototype/daysInMonth/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const daysInMonth = Temporal.Calendar.prototype.daysInMonth;

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.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => daysInMonth.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");
const args = [new Temporal.PlainDate(2000, 1, 1)];

assert.throws(TypeError, () => daysInMonth.apply(undefined, args), "undefined");
assert.throws(TypeError, () => daysInMonth.apply(null, args), "null");
assert.throws(TypeError, () => daysInMonth.apply(true, args), "true");
assert.throws(TypeError, () => daysInMonth.apply("", args), "empty string");
assert.throws(TypeError, () => daysInMonth.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => daysInMonth.apply(1, args), "1");
assert.throws(TypeError, () => daysInMonth.apply({}, args), "plain object");
assert.throws(TypeError, () => daysInMonth.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => daysInMonth.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");

This file was deleted.

20 changes: 11 additions & 9 deletions test/built-ins/Temporal/Calendar/prototype/daysInWeek/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const daysInWeek = Temporal.Calendar.prototype.daysInWeek;

assert.sameValue(typeof daysInWeek, "function");

assert.throws(TypeError, () => daysInWeek.call(undefined), "undefined");
assert.throws(TypeError, () => daysInWeek.call(null), "null");
assert.throws(TypeError, () => daysInWeek.call(true), "true");
assert.throws(TypeError, () => daysInWeek.call(""), "empty string");
assert.throws(TypeError, () => daysInWeek.call(Symbol()), "symbol");
assert.throws(TypeError, () => daysInWeek.call(1), "1");
assert.throws(TypeError, () => daysInWeek.call({}), "plain object");
assert.throws(TypeError, () => daysInWeek.call(Temporal.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => daysInWeek.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");
const args = [new Temporal.PlainDate(2000, 1, 1)];

assert.throws(TypeError, () => daysInWeek.apply(undefined, args), "undefined");
assert.throws(TypeError, () => daysInWeek.apply(null, args), "null");
assert.throws(TypeError, () => daysInWeek.apply(true, args), "true");
assert.throws(TypeError, () => daysInWeek.apply("", args), "empty string");
assert.throws(TypeError, () => daysInWeek.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => daysInWeek.apply(1, args), "1");
assert.throws(TypeError, () => daysInWeek.apply({}, args), "plain object");
assert.throws(TypeError, () => daysInWeek.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => daysInWeek.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");

This file was deleted.

20 changes: 11 additions & 9 deletions test/built-ins/Temporal/Calendar/prototype/daysInYear/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const daysInYear = Temporal.Calendar.prototype.daysInYear;

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.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => daysInYear.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");
const args = [new Temporal.PlainDate(2000, 1, 1)];

assert.throws(TypeError, () => daysInYear.apply(undefined, args), "undefined");
assert.throws(TypeError, () => daysInYear.apply(null, args), "null");
assert.throws(TypeError, () => daysInYear.apply(true, args), "true");
assert.throws(TypeError, () => daysInYear.apply("", args), "empty string");
assert.throws(TypeError, () => daysInYear.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => daysInYear.apply(1, args), "1");
assert.throws(TypeError, () => daysInYear.apply({}, args), "plain object");
assert.throws(TypeError, () => daysInYear.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => daysInYear.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");
Loading

0 comments on commit d8efd03

Please sign in to comment.