From 68a817d71341175e3cd1029c3b3905948b23ef28 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 2 Jul 2025 12:25:00 +0200 Subject: [PATCH] Verify that Duration#with() doesn't accept duration strings Also fix the description and put the string tests together. --- .../Temporal/Duration/prototype/with/argument-not-object.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/built-ins/Temporal/Duration/prototype/with/argument-not-object.js b/test/built-ins/Temporal/Duration/prototype/with/argument-not-object.js index cdf2a3f26a..1c8797b340 100644 --- a/test/built-ins/Temporal/Duration/prototype/with/argument-not-object.js +++ b/test/built-ins/Temporal/Duration/prototype/with/argument-not-object.js @@ -3,7 +3,7 @@ /*--- esid: sec-temporal.duration.prototype.with -description: Passing a primitive other than string to with() throws +description: Passing a primitive to with() throws features: [Symbol, Temporal] ---*/ @@ -12,7 +12,8 @@ assert.throws(TypeError, () => instance.with(undefined), "undefined"); assert.throws(TypeError, () => instance.with(null), "null"); assert.throws(TypeError, () => instance.with(true), "boolean"); assert.throws(TypeError, () => instance.with(""), "empty string"); +assert.throws(TypeError, () => instance.with("P1D"), "duration string"); +assert.throws(TypeError, () => instance.with("string"), "string"); assert.throws(TypeError, () => instance.with(Symbol()), "Symbol"); assert.throws(TypeError, () => instance.with(7), "number"); assert.throws(TypeError, () => instance.with(7n), "bigint"); -assert.throws(TypeError, () => instance.with("string"), "string");