MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

update spec's

+32
+24
examples/spec/buffer.js
··· 45 45 test('Uint32Array length', u32.length, 2); 46 46 test('Uint32Array BYTES_PER_ELEMENT', u32.BYTES_PER_ELEMENT, 4); 47 47 48 + const f16 = new Float16Array(4); 49 + test('Float16Array length', f16.length, 4); 50 + test('Float16Array byteLength', f16.byteLength, 8); 51 + test('Float16Array BYTES_PER_ELEMENT', f16.BYTES_PER_ELEMENT, 2); 52 + test('Float16Array constructor', f16.constructor, Float16Array); 53 + f16[0] = 1.5; 54 + f16[1] = -0.5; 55 + test('Float16Array index read approx positive', Math.abs(f16[0] - 1.5) < 0.001, true); 56 + test('Float16Array index read approx negative', Math.abs(f16[1] + 0.5) < 0.001, true); 57 + 48 58 const i8 = new Int8Array(8); 49 59 test('Int8Array length', i8.length, 8); 50 60 test('Int8Array BYTES_PER_ELEMENT', i8.BYTES_PER_ELEMENT, 1); ··· 65 75 const view8 = new Uint8Array(buffer); 66 76 const view16 = new Uint16Array(buffer); 67 77 const view32 = new Uint32Array(buffer); 78 + const view16f = new Float16Array(buffer); 68 79 69 80 test('Uint8Array view length', view8.length, 16); 70 81 test('Uint16Array view length', view16.length, 8); 71 82 test('Uint32Array view length', view32.length, 4); 83 + test('Float16Array view length', view16f.length, 8); 72 84 73 85 const viewWithOffset = new Uint8Array(buffer, 4); 74 86 test('view with offset length', viewWithOffset.length, 12); ··· 123 135 const subarrayed = original.subarray(2, 8); 124 136 test('TypedArray subarray length', subarrayed.length, 6); 125 137 test('TypedArray subarray byteOffset', subarrayed.byteOffset, 2); 138 + 139 + const f16Source = new Float16Array([1.5, -0.5, 2.25, 4.5]); 140 + const f16Sliced = f16Source.slice(1, 3); 141 + test('Float16Array slice length', f16Sliced.length, 2); 142 + test('Float16Array slice first approx', Math.abs(f16Sliced[0] + 0.5) < 0.001, true); 143 + test('Float16Array slice second approx', Math.abs(f16Sliced[1] - 2.25) < 0.001, true); 144 + 145 + const f16Cloned = structuredClone(f16Source); 146 + test('Float16Array structuredClone constructor', f16Cloned.constructor, Float16Array); 147 + test('Float16Array structuredClone distinct', f16Cloned !== f16Source, true); 148 + test('Float16Array structuredClone first approx', Math.abs(f16Cloned[0] - 1.5) < 0.001, true); 149 + test('Float16Array structuredClone second approx', Math.abs(f16Cloned[1] + 0.5) < 0.001, true); 126 150 127 151 test('Buffer.isBuffer with Buffer', Buffer.isBuffer(Buffer.from('test')), true); 128 152 test('Buffer.isBuffer with string', Buffer.isBuffer('test'), false);
+8
examples/spec/response.js
··· 55 55 testThrows('Response.json rejects symbol', () => Response.json(Symbol('x'))); 56 56 testThrows('Response.json null body status rejects', () => Response.json('x', { status: 204 })); 57 57 58 + const f16Body = new Float16Array([1.5, -0.5, 2.25]); 59 + const f16Res = new Response(f16Body); 60 + const f16Bytes = await f16Res.bytes(); 61 + const f16Expected = Array.from(new Uint8Array(f16Body.buffer, f16Body.byteOffset, f16Body.byteLength)).join(','); 62 + test('Response bytes from Float16Array type', f16Bytes.constructor, Uint8Array); 63 + test('Response bytes from Float16Array length', f16Bytes.byteLength, f16Body.byteLength); 64 + test('Response bytes from Float16Array raw copy', Array.from(f16Bytes).join(','), f16Expected); 65 + 58 66 const redirectRes = Response.redirect('https://example.com/next', 301); 59 67 test('Response.redirect status', redirectRes.status, 301); 60 68 test('Response.redirect location', redirectRes.headers.get('location'), 'https://example.com/next');