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.
5 esid: sec-uint8array.prototype.tohex
6 description: Conversion of Uint8Arrays to hex strings
7 features: [uint8array-base64, TypedArray]
10 assert.sameValue((new Uint8Array([])).toHex(), "");
11 assert.sameValue((new Uint8Array([102])).toHex(), "66");
12 assert.sameValue((new Uint8Array([102, 111])).toHex(), "666f");
13 assert.sameValue((new Uint8Array([102, 111, 111])).toHex(), "666f6f");
14 assert.sameValue((new Uint8Array([102, 111, 111, 98])).toHex(), "666f6f62");
15 assert.sameValue((new Uint8Array([102, 111, 111, 98, 97])).toHex(), "666f6f6261");
16 assert.sameValue((new Uint8Array([102, 111, 111, 98, 97, 114])).toHex(), "666f6f626172");