4 ms·
Where are the test cases? Babel's parser alone has quite a formidable suite of fixtures (a few thousand as I recall): https://github.com/babel/babel/tree/maste
by rattray 8y ago
Where are the test cases?
Babel's parser alone has quite a formidable suite of fixtures (a few thousand as I recall): https://github.com/babel/babel/tree/master/packages/babel-parser/test/fixtures https://github.com/babel/babel/tree/master/packages/babel-pa...
The nice thing about implementing a JS-JS compiler is that there is already a huge number of tests out there, like these, that you can use to TDD your compiler's edge-cases.
SWC's CONTRIBUTING mentions this:
> Include tests that cover all non-trivial code. The existing tests in test/ provide templates on how to test swc's behavior in a sandbox-environment. The internal crate testing provides a vast amount of helpers to minimize boilerplate. See [testing/lib.rs] for an introduction to writing tests.
But I cannot find a `/test` directory, and it does not appear in the .gitignore either.
EDIT: Ah, the tests are in `/tests.rs` with JS embedded inside rust code. This makes it a bit harder to compare directly with babel's suite, but claims to be lifted from test262, which babel also based many of their tests on (albeit recategorized). hzoo's comment here has details: https://news.ycombinator.com/item?id=18746905 https://news.ycombinator.com/item?id=18746905
- steveklabnik 8y agohttps://news.ycombinator.com/item?id=18746754 https://news.ycombinator.com/item?id=18746754 https://news.ycombinator.com/item?id=18746905 https://news.ycombinator.com/item?id=18746905
- rattray 8y agoThanks Steve! Missed those; race condition perhaps. Updated.