Skip to content

Commit

Permalink
Add Float16Array to the list of valid basic types (#601)
Browse files Browse the repository at this point in the history
Added to Web IDL in whatwg/webidl#1398 and already used
in the definition of `ArrayBufferView`.

The test is not fantastically useful but will allow to make the test fail next
time we need to add a basic type to the list.
  • Loading branch information
tidoust authored Apr 10, 2024
1 parent 0e31f6e commit 2d98fce
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/study-webidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const basicTypes = new Set([
'DOMString', // https://webidl.spec.whatwg.org/#idl-DOMString
'double', // https://webidl.spec.whatwg.org/#idl-double
'float', // https://webidl.spec.whatwg.org/#idl-float
'Float16Array', // https://webidl.spec.whatwg.org/#idl-Float16Array
'Float32Array', // https://webidl.spec.whatwg.org/#idl-Float32Array
'Float64Array', // https://webidl.spec.whatwg.org/#idl-Float64Array
'Int16Array', // https://webidl.spec.whatwg.org/#idl-Int16Array
Expand Down
47 changes: 47 additions & 0 deletions test/study-webidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,53 @@ interface Valid {};
assertNbAnomalies(report, 0);
});

it('knows about basic IDL type', () => {
const report = analyzeIdl(`
[Global=Window,Exposed=*]
interface ValidBasicTypes {
attribute any test1;
attribute ArrayBuffer test2;
attribute bigint test3;
attribute boolean test4;
attribute byte test5;
attribute ByteString test6;
attribute DataView test7;
attribute DOMString test8;
attribute double test9;
attribute float test10;
attribute Float16Array test11;
attribute Float32Array test12;
attribute Float64Array test13;
attribute Int16Array test14;
attribute Int32Array test15;
attribute Int8Array test16;
attribute long long test17;
attribute long test18;
attribute object test19;
attribute octet test20;
attribute SharedArrayBuffer test21;
attribute short test22;
attribute symbol test23;
attribute BigUint64Array test24;
attribute BigInt64Array test25;
attribute Uint16Array test26;
attribute Uint32Array test27;
attribute Uint8Array test28;
attribute Uint8ClampedArray test29;
attribute unrestricted double test30;
attribute unrestricted float test31;
attribute unsigned long long test32;
attribute unsigned long test33;
attribute unsigned short test34;
attribute USVString test35;
attribute undefined test36;
attribute CSSOMString test37;
attribute WindowProxy test38;
};
`);
assertNbAnomalies(report, 0);
});

it('reports invalid IDL', () => {
const report = analyzeIdl(`
[Global=Window,Exposed=*]
Expand Down

0 comments on commit 2d98fce

Please sign in to comment.