Bug 1885337 - Part 3: Import tests from test262 PR. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / prs / 3994 / built-ins / Uint8Array / fromBase64 / whitespace.js
blob87c79a65631818b7dee815716c2fcc3ce8a87b3a
1 // |reftest| shell-option(--enable-uint8array-base64) skip-if(!Uint8Array.fromBase64||!xulRuntime.shell) -- uint8array-base64 is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 Kevin Gibbons. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-uint8array.frombase64
6 description: Uint8Array.fromBase64 ignores ASCII whitespace in the input
7 includes: [compareArray.js]
8 features: [uint8array-base64, TypedArray]
9 ---*/
11 var whitespaceKinds = [
12   ["Z g==", "space"],
13   ["Z\tg==", "tab"],
14   ["Z\x0Ag==", "LF"],
15   ["Z\x0Cg==", "FF"],
16   ["Z\x0Dg==", "CR"],
18 whitespaceKinds.forEach(function(pair) {
19   var arr = Uint8Array.fromBase64(pair[0]);
20   assert.sameValue(arr.length, 1);
21   assert.sameValue(arr.buffer.byteLength, 1);
22   assert.compareArray(arr, [102], "ascii whitespace: " + pair[1]);
23 });
25 reportCompare(0, 0);