From 7f546b34c5e66bdb1ab20ff0b5ae8a32ea950fb0 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Wed, 7 Feb 2024 16:43:17 -0800 Subject: [PATCH] update detached buffer tests --- .../prototype/setFromBase64/detached-buffer.js | 15 +++++++-------- .../prototype/setFromHex/detached-buffer.js | 8 ++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/test/built-ins/Uint8Array/prototype/setFromBase64/detached-buffer.js b/test/built-ins/Uint8Array/prototype/setFromBase64/detached-buffer.js index 11597b55a61..5c01a7f43b8 100644 --- a/test/built-ins/Uint8Array/prototype/setFromBase64/detached-buffer.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/detached-buffer.js @@ -2,16 +2,16 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-uint8array.prototype.setfrombase64 -description: Uint8Array.prototype.setFromBase64 does not write to or error on detatched buffers +description: Uint8Array.prototype.setFromBase64 throws on detatched buffers includes: [detachArrayBuffer.js] features: [uint8array-base64] ---*/ var target = new Uint8Array([255, 255, 255]); $DETACHBUFFER(target.buffer); -var result = target.setFromBase64('Zg=='); -assert.sameValue(result.read, 0); -assert.sameValue(result.written, 0); +assert.throws(TypeError, function() { + target.setFromBase64('Zg=='); +}); var getterCalls = 0; var targetDetachingOptions = {}; @@ -23,7 +23,6 @@ Object.defineProperty(targetDetachingOptions, 'alphabet', { } }); var target = new Uint8Array([255, 255, 255]); -var result = target.setFromBase64('Zg==', targetDetachingOptions); -assert.sameValue(getterCalls, 1); -assert.sameValue(result.read, 0); -assert.sameValue(result.written, 0); +assert.throws(TypeError, function() { + target.setFromBase64('Zg==', targetDetachingOptions); +}); diff --git a/test/built-ins/Uint8Array/prototype/setFromHex/detached-buffer.js b/test/built-ins/Uint8Array/prototype/setFromHex/detached-buffer.js index 6f77c4de474..881ca258ed8 100644 --- a/test/built-ins/Uint8Array/prototype/setFromHex/detached-buffer.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/detached-buffer.js @@ -2,13 +2,13 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-uint8array.prototype.setfromhex -description: Uint8Array.prototype.setFromHex does not write to or error on detatched buffers +description: Uint8Array.prototype.setFromHex throws on detatched buffers includes: [detachArrayBuffer.js] features: [uint8array-base64] ---*/ var target = new Uint8Array([255, 255, 255]); $DETACHBUFFER(target.buffer); -var result = target.setFromHex('aa'); -assert.sameValue(result.read, 0); -assert.sameValue(result.written, 0); +assert.throws(TypeError, function() { + target.setFromHex('aa'); +});