Add decorators tests
This PR is still a WIP, I will be trying to wrap it up tomorrow. Took me a while to get best way to combine templates and cases to have as wide coverage as possible without having to write out every permutation manually.
I've completed writing the tests, now I just need to actually get them to run properly and debug any issues (could be typos, etc).
https://github.com/babel/babel-test262-runner/ could be useful to run the tests and check if they have any problem.
Yes, I've been using that repo for testing in general. The previous commit for fields (a3b4282) was passing, at that point I kinda had all the details figured out for the overall structure so I scaffolded out all of the tests themselves and made sure I had written all of the ones we needed.
Next is just running them again to see if they work and fixing issues. I'm sure there are minor issues, definitely, but could also be some larger ones.
@nicolo-ribaudo one quick question, the generators in make throw an error if the folders don't exist for the output of a template/case file, so I've just been making them manually. I couldn't figure out the command to run to not throw, is there a way to do that easily?
This PR is now ready for review. There are some tests that are failing against the Babel test runner that I can't figure out:
- Some class expression tests are failing due to a Babel transpilation error,
var Cis already declared for some reason. The code is valid and should work, and it transpiles fine in the Babel playground, so I'm not sure what the issue is there. - Some tests that rely on Proxy are failing because Proxy is undefined. I did add the feature flag for it, so I'm not sure what else I need to do to make Proxy available.
- The tests for a class decorator returning a non-
[[Construct]]arrow function are failing, this is something that the Babel transform does not check for (not sure if it realistically can check for this).
I believe that's it though.
The tests should cover the bulk of decorator behavior, there may be some small gaps but we can address those in followups, this is already a massive PR and I don't want to continue adding to it.
@pzuraq We discussed this in yesterday's test262 meeting. We plan to start reviewing it after tackling one other large PR that's been waiting longer.
In the meantime, would you mind splitting the commit on this branch into two commits, one with any hand-written changes and one with autogenerated changes? We'll focus on the former.
Ok, sounds good! I can get that done likely by the end of the month or early next month.
@pzuraq I went ahead and investigated which tests were autogenerated — it looks like they all are! :smile:
A few of them don't have corresponding templates in src/, maybe you forgot to add some files?
src/decorator/field-context-kind.casesrc/decorator/field-initializers-interleave.casesrc/decorator/field-instance-initializer-order.casesrc/decorator/field-received-value.casesrc/decorator/field-static-initializer-order.casesrc/decorator/decorator-test-123.case
@ptomato ah those files were mistakenly added actually, they were work in progress files as I was working out the way the generator system worked. Removing them and rebasing now.
The diff is quite big, I didn't read all, but it will good to add this case to tests if missing.
class A {
@decorators[0]
method() {}
}