cometkim / rescript-vitest

ReScript bindings to Vitest
MIT License
42 stars 9 forks source link

test.each and describe.each support #8

Closed jmagaram closed 1 year ago

jmagaram commented 1 year ago

I've never created a pull request before. Not sure how to do it. This is for "test.each" and "describe.each". Tests included. Seems to work.

jmagaram commented 1 year ago

This looks quite verbose but I couldn't figure out how to shorten it. Each flavor of test.each has a distinct signature. The array version, for example, can be called with array<(int, string,int)> and requires a callback with 3 parameters while array<(string,int)> requires a callback with 2 parameters. I think these require different external bindings since the callbacks have a different number of parameters. I tried using functors to eliminate repetitive code but couldn't figure it out since the resultant modules need generic types, like a callback ('a,'b,'c)=>unit.

cometkim commented 1 year ago

Thank you @jmagaram !