getify / ES-Feature-Tests

Feature Tests for JavaScript
199 stars 16 forks source link

there should be a TypedArrayMethods test #3

Open allenwb opened 9 years ago

allenwb commented 9 years ago

To test that the specified Array.prototype methods have been made available on %TypedArray%.prototyipe

getify commented 9 years ago

Agreed.

If you can short-circuit my research on this, are there any exceptions (like some methods that are not, or some TypedArray's that don't)?

allenwb commented 9 years ago

The only methods excluded from Array.prototype of those that change the length of the array: concat, pop, push, shift, splice, unshift

all methods are available on all typed arrays

getify commented 9 years ago

Thanks!

getify commented 9 years ago

clarification: concat(..) isn't a mutator, so it's safe, right? Does it get on the TypedArray prototypes?

allenwb commented 9 years ago

right concat isn't a mutator, but it was also excluded because it would be hard to reliably precompute the fixed size of the result typed array object.

Another feature point is the availability of from and of on the typed array constructors.

getify commented 9 years ago

@allenwb

How do these look?

https://github.com/getify/es-feature-tests/commit/18d9d89fe0eaee6ea8a47f0baac0068e6c73d0ce#diff-d3a5aa62a9c556f382860a6ea31c11f7R59

allenwb commented 9 years ago

Looks good, I might also test for 'sort' just because it is one of the more interesting methods and requires more implementation work than just moving over the Array.prototype method

getify commented 9 years ago

thanks!