From b62a0702214be0eb768934ae64fe9d59d18c6396 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Fri, 3 Sep 2021 16:04:52 -0400 Subject: [PATCH] Simplify test Remove semantics which are not necessary to exercise the behavior under test. --- test/built-ins/Math/hypot/Math.hypot_ToNumberErr.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/built-ins/Math/hypot/Math.hypot_ToNumberErr.js b/test/built-ins/Math/hypot/Math.hypot_ToNumberErr.js index 818fe74666..f94944d961 100644 --- a/test/built-ins/Math/hypot/Math.hypot_ToNumberErr.js +++ b/test/built-ins/Math/hypot/Math.hypot_ToNumberErr.js @@ -13,13 +13,10 @@ info: | 3. For each element _number_ of _coerced_, do ---*/ -let uniqueErrorCount = 0; -class UniqueError extends Error { - constructor() { super(); uniqueErrorCount++; } -} +var counter = 0; assert.throws( - UniqueError, + Test262Error, function() { Math.hypot( Infinity, @@ -27,12 +24,12 @@ assert.throws( NaN, 0, -0, - {valueOf(){ throw new UniqueError(); }}, - {valueOf(){ throw new UniqueError(); }}, + {valueOf: function(){ throw new Test262Error(); }}, + {valueOf: function(){ counter++; }} ); }, 'Math.hypot propagates an abrupt completion from coercing an argument to Number' ); -assert.sameValue(uniqueErrorCount, 1, +assert.sameValue(counter, 0, 'Math.hypot aborts argument processing at the first abrupt completion');