-
Notifications
You must be signed in to change notification settings - Fork 29
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
after_each may be executed before the test (if it contains only a statement that doesn't end with a semicolon) #47
Comments
Wow this is a weird case! I think I know why this happens - in this code https://github.com/reem/stainless/blob/master/src/generate.rs#L58, which deals with combining the three blocks, all attributes other than the statements in the block are copied from the main test block, including the attribute for "final expression". This causes the final expression of the test block, if it has one, to be placed after all statements in all three blocks! For now I would just make sure to stick a semicolon in every test, but I will try to get a fix for this up soon. |
Also if the last statement doesn't end with a ';' Like a |
And what it does in that case is that it put the content for |
To solve both this and #34, do you want to make it an error to have a block have a top-level expression (with an error message suggesting ending with a |
I would make it an error - implicitly converting to a statement would probably have unintended consequences. |
Okay. I'm just concerned about the weirdness of having to do things like putting semicolons after for loops :). |
Hmm, that's a good point. It is a bit awkward to have to semicolon |
Hello,
First and foremost, thank you for this framework! It really helps in writing readable tests 😃
I came across an edge case, today: if you don't have statements that end with a semicolon, the generated code doesn't get ordered properly. For example:
Here's a part of the code when macros are expanded:
The text was updated successfully, but these errors were encountered: