Skip to content

Commit

Permalink
Temporal: Ensure PlainTime branding tests fail if needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed May 20, 2022
1 parent 7960d61 commit 2de2fe3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
18 changes: 9 additions & 9 deletions test/built-ins/Temporal/PlainTime/prototype/round/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const round = Temporal.PlainTime.prototype.round;

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

assert.throws(TypeError, () => round.call(undefined), "undefined");
assert.throws(TypeError, () => round.call(null), "null");
assert.throws(TypeError, () => round.call(true), "true");
assert.throws(TypeError, () => round.call(""), "empty string");
assert.throws(TypeError, () => round.call(Symbol()), "symbol");
assert.throws(TypeError, () => round.call(1), "1");
assert.throws(TypeError, () => round.call({}), "plain object");
assert.throws(TypeError, () => round.call(Temporal.PlainTime), "Temporal.PlainTime");
assert.throws(TypeError, () => round.call(Temporal.PlainTime.prototype), "Temporal.PlainTime.prototype");
assert.throws(TypeError, () => round.call(undefined, "hour"), "undefined");
assert.throws(TypeError, () => round.call(null, "hour"), "null");
assert.throws(TypeError, () => round.call(true, "hour"), "true");
assert.throws(TypeError, () => round.call("", "hour"), "empty string");
assert.throws(TypeError, () => round.call(Symbol(), "hour"), "symbol");
assert.throws(TypeError, () => round.call(1, "hour"), "1");
assert.throws(TypeError, () => round.call({}, "hour"), "plain object");
assert.throws(TypeError, () => round.call(Temporal.PlainTime, "hour"), "Temporal.PlainTime");
assert.throws(TypeError, () => round.call(Temporal.PlainTime.prototype, "hour"), "Temporal.PlainTime.prototype");
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const toZonedDateTime = Temporal.PlainTime.prototype.toZonedDateTime;

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

assert.throws(TypeError, () => toZonedDateTime.call(undefined), "undefined");
assert.throws(TypeError, () => toZonedDateTime.call(null), "null");
assert.throws(TypeError, () => toZonedDateTime.call(true), "true");
assert.throws(TypeError, () => toZonedDateTime.call(""), "empty string");
assert.throws(TypeError, () => toZonedDateTime.call(Symbol()), "symbol");
assert.throws(TypeError, () => toZonedDateTime.call(1), "1");
assert.throws(TypeError, () => toZonedDateTime.call({}), "plain object");
assert.throws(TypeError, () => toZonedDateTime.call(Temporal.PlainTime), "Temporal.PlainTime");
assert.throws(TypeError, () => toZonedDateTime.call(Temporal.PlainTime.prototype), "Temporal.PlainTime.prototype");
assert.throws(TypeError, () => toZonedDateTime.call(undefined, { plainDate: "2022-05-19", timeZone: "UTC" }), "undefined");
assert.throws(TypeError, () => toZonedDateTime.call(null, { plainDate: "2022-05-19", timeZone: "UTC" }), "null");
assert.throws(TypeError, () => toZonedDateTime.call(true, { plainDate: "2022-05-19", timeZone: "UTC" }), "true");
assert.throws(TypeError, () => toZonedDateTime.call("", { plainDate: "2022-05-19", timeZone: "UTC" }), "empty string");
assert.throws(TypeError, () => toZonedDateTime.call(Symbol(), { plainDate: "2022-05-19", timeZone: "UTC" }), "symbol");
assert.throws(TypeError, () => toZonedDateTime.call(1, { plainDate: "2022-05-19", timeZone: "UTC" }), "1");
assert.throws(TypeError, () => toZonedDateTime.call({}, { plainDate: "2022-05-19", timeZone: "UTC" }), "plain object");
assert.throws(TypeError, () => toZonedDateTime.call(Temporal.PlainTime, { plainDate: "2022-05-19", timeZone: "UTC" }), "Temporal.PlainTime");
assert.throws(TypeError, () => toZonedDateTime.call(Temporal.PlainTime.prototype, { plainDate: "2022-05-19", timeZone: "UTC" }), "Temporal.PlainTime.prototype");
18 changes: 9 additions & 9 deletions test/built-ins/Temporal/PlainTime/prototype/with/branding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const with_ = Temporal.PlainTime.prototype.with;

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

assert.throws(TypeError, () => with_.call(undefined), "undefined");
assert.throws(TypeError, () => with_.call(null), "null");
assert.throws(TypeError, () => with_.call(true), "true");
assert.throws(TypeError, () => with_.call(""), "empty string");
assert.throws(TypeError, () => with_.call(Symbol()), "symbol");
assert.throws(TypeError, () => with_.call(1), "1");
assert.throws(TypeError, () => with_.call({}), "plain object");
assert.throws(TypeError, () => with_.call(Temporal.PlainTime), "Temporal.PlainTime");
assert.throws(TypeError, () => with_.call(Temporal.PlainTime.prototype), "Temporal.PlainTime.prototype");
assert.throws(TypeError, () => with_.call(undefined, { hour: 7 }), "undefined");
assert.throws(TypeError, () => with_.call(null, { hour: 7 }), "null");
assert.throws(TypeError, () => with_.call(true, { hour: 7 }), "true");
assert.throws(TypeError, () => with_.call("", { hour: 7 }), "empty string");
assert.throws(TypeError, () => with_.call(Symbol(), { hour: 7 }), "symbol");
assert.throws(TypeError, () => with_.call(1, { hour: 7 }), "1");
assert.throws(TypeError, () => with_.call({}, { hour: 7 }), "plain object");
assert.throws(TypeError, () => with_.call(Temporal.PlainTime, { hour: 7 }), "Temporal.PlainTime");
assert.throws(TypeError, () => with_.call(Temporal.PlainTime.prototype, { hour: 7 }), "Temporal.PlainTime.prototype");

0 comments on commit 2de2fe3

Please sign in to comment.