mirror of
https://github.com/tc39/test262.git
synced 2025-05-30 11:40:30 +02:00
update detached buffer tests
This commit is contained in:
parent
07807bd544
commit
911aa6173d
@ -2,16 +2,16 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-uint8array.prototype.setfrombase64
|
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]
|
includes: [detachArrayBuffer.js]
|
||||||
features: [uint8array-base64]
|
features: [uint8array-base64]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var target = new Uint8Array([255, 255, 255]);
|
var target = new Uint8Array([255, 255, 255]);
|
||||||
$DETACHBUFFER(target.buffer);
|
$DETACHBUFFER(target.buffer);
|
||||||
var result = target.setFromBase64('Zg==');
|
assert.throws(TypeError, function() {
|
||||||
assert.sameValue(result.read, 0);
|
target.setFromBase64('Zg==');
|
||||||
assert.sameValue(result.written, 0);
|
});
|
||||||
|
|
||||||
var getterCalls = 0;
|
var getterCalls = 0;
|
||||||
var targetDetachingOptions = {};
|
var targetDetachingOptions = {};
|
||||||
@ -23,7 +23,6 @@ Object.defineProperty(targetDetachingOptions, 'alphabet', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
var target = new Uint8Array([255, 255, 255]);
|
var target = new Uint8Array([255, 255, 255]);
|
||||||
var result = target.setFromBase64('Zg==', targetDetachingOptions);
|
assert.throws(TypeError, function() {
|
||||||
assert.sameValue(getterCalls, 1);
|
target.setFromBase64('Zg==', targetDetachingOptions);
|
||||||
assert.sameValue(result.read, 0);
|
});
|
||||||
assert.sameValue(result.written, 0);
|
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-uint8array.prototype.setfromhex
|
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]
|
includes: [detachArrayBuffer.js]
|
||||||
features: [uint8array-base64]
|
features: [uint8array-base64]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var target = new Uint8Array([255, 255, 255]);
|
var target = new Uint8Array([255, 255, 255]);
|
||||||
$DETACHBUFFER(target.buffer);
|
$DETACHBUFFER(target.buffer);
|
||||||
var result = target.setFromHex('aa');
|
assert.throws(TypeError, function() {
|
||||||
assert.sameValue(result.read, 0);
|
target.setFromHex('aa');
|
||||||
assert.sameValue(result.written, 0);
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user