Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quote testing: remove quoteOutputMatches when there isn't any difference to check #316

Closed
rachelcarmena opened this issue Dec 10, 2019 · 8 comments

Comments

@rachelcarmena
Copy link
Member

rachelcarmena commented Dec 10, 2019

When there are no differences between the source code and the quote output, the test isn't providing any value with quoteOutputMatches:

      code = { <piece of code> },
      assert = { quoteOutputMatches(<the same piece of code>) }

I think it could be better with these alternatives:

  • Just compiles.
  • Add expression evaluation to ensure that the generated bytecode works as expected.
@nomisRev
Copy link
Member

Can we do this with property based testing?
That'd mean we need would need to build a Gen for every KtElement.

@rachelcarmena rachelcarmena changed the title Quote testing: replace quoteOutputMatches by expression evaluation Quote testing: remove quoteOutputMatches when there isn't any difference to check Dec 10, 2019
@rachelcarmena
Copy link
Member Author

Can we do this with property based testing?
That'd mean we need would need to build a Gen for every KtElement.

Thanks for the feedback @nomisRev! I've updated the description.

@rachelcarmena
Copy link
Member Author

And it seems property-based testing is an upcoming feature. Until then, I think we could improve these tests.

Some errors were just detected when evaluating expressions on the bytecode.

@ahinchman1
Copy link
Collaborator

Some errors were just detected when evaluating expressions on the bytecode.

@rachelcarmena are there specific examples with the error messages and where it's failing? I'm sorry, this is vague for me.

@rachelcarmena
Copy link
Member Author

Some errors were just detected when evaluating expressions on the bytecode.

@rachelcarmena are there specific examples with the error messages and where it's failing? I'm sorry, this is vague for me.

Or course! I'm talking about execution errors instead of compilation errors. Compilation can be OK and then the execution can raise an error. If we add the check of execution with expression evaluation, the test will be more robust 👍

@ahinchman1
Copy link
Collaborator

ahhh yeah thanks so much Raquel - I still have more base ones to add for the rest of today, but perhaps I can open a PR with to experiment with some of these ideas tomorrow or Thursday so we can create a good standard for more robust testing for the quote-and-template system! 😄

@raulraja
Copy link
Member

@nomisRev yes these are the laws I have been talking to @ahinchman1 we will build once all the elements are there. A Gen and a law set for scopes. The first law is the empty identity for the destructuring template producing no effect when an element is replaced by it. This ensures all templates as quoted are non-destructive

@rachelcarmena
Copy link
Member Author

Thanks @raulraja , let's close the issue because of the upcoming features!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants