mirror of https://github.com/tc39/test262.git
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.
|
||||
/*---
|
||||
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);
|
||||
});
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue