diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/DataView/defined-bytelength-and-byteoffset.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/DataView/defined-bytelength-and-byteoffset.js')
-rw-r--r-- | js/src/tests/test262/built-ins/DataView/defined-bytelength-and-byteoffset.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/DataView/defined-bytelength-and-byteoffset.js b/js/src/tests/test262/built-ins/DataView/defined-bytelength-and-byteoffset.js new file mode 100644 index 0000000000..a1a7edb7f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/defined-bytelength-and-byteoffset.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview-buffer-byteoffset-bytelength +description: > + Return new instance from defined length and offset +info: | + 24.2.2.1 DataView (buffer, byteOffset, byteLength ) + + ... + 17. Return O. +---*/ + +var sample; +var buffer = new ArrayBuffer(3); + +sample = new DataView(buffer, 1, 2); +assert.sameValue(sample.byteLength, 2, "sample.byteLength"); +assert.sameValue(sample.byteOffset, 1, "sample.byteOffset"); +assert.sameValue(sample.buffer, buffer, "sample.buffer"); +assert.sameValue(sample.constructor, DataView); +assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype); + +sample = new DataView(buffer, 1, 0); +assert.sameValue(sample.byteLength, 0, "sample.byteLength"); +assert.sameValue(sample.byteOffset, 1, "sample.byteOffset"); +assert.sameValue(sample.buffer, buffer, "sample.buffer"); +assert.sameValue(sample.constructor, DataView); +assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype); + +sample = new DataView(buffer, 0, 3); +assert.sameValue(sample.byteLength, 3, "sample.byteLength"); +assert.sameValue(sample.byteOffset, 0, "sample.byteOffset"); +assert.sameValue(sample.buffer, buffer, "sample.buffer"); +assert.sameValue(sample.constructor, DataView); +assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype); + +sample = new DataView(buffer, 3, 0); +assert.sameValue(sample.byteLength, 0, "sample.byteLength"); +assert.sameValue(sample.byteOffset, 3, "sample.byteOffset"); +assert.sameValue(sample.buffer, buffer, "sample.buffer"); +assert.sameValue(sample.constructor, DataView); +assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype); + +sample = new DataView(buffer, 0, 1); +assert.sameValue(sample.byteLength, 1, "sample.byteLength"); +assert.sameValue(sample.byteOffset, 0, "sample.byteOffset"); +assert.sameValue(sample.buffer, buffer, "sample.buffer"); +assert.sameValue(sample.constructor, DataView); +assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype); + +sample = new DataView(buffer, 0, 2); +assert.sameValue(sample.byteLength, 2, "sample.byteLength"); +assert.sameValue(sample.byteOffset, 0, "sample.byteOffset"); +assert.sameValue(sample.buffer, buffer, "sample.buffer"); +assert.sameValue(sample.constructor, DataView); +assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype); + +reportCompare(0, 0); |