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

Refactoring rotten green test on Context #13411

Merged

Conversation

jordanmontt
Copy link
Member

The test ContextTest>>#testHasNonLocalReturn is a rotten green test because:

ContextTest>>#testHasNonLocalReturn
1.	"the method has a non-local return, in some block inside"
2.	self assert: thisContext method hasNonLocalReturn.
3.	"but the context that executes not (as it is later another block context"
4.	self deny: thisContext hasNonLocalReturn.
5.	"this block context has no non-local return"
6.	[ self deny: thisContext hasNonLocalReturn] value.
7.	"but this"
8.	[ self assert: thisContext hasNonLocalReturn. ^self] value.
9.	"again, this is about the context locally, nested blocks to not count"
10.	[ self deny: thisContext hasNonLocalReturn. [^self]] value.
11.	[ self deny: thisContext hasNonLocalReturn. [self assert: thisContext hasNonLocalReturn. ^self]] value
  1. in the line 8 there is return so none of the following assertions are done.
  2. In the line 11 the second inner block has an assertion that is never execution

In this PR I propose to refactor this test to move the line 8 to the end. The assertion is needed. The return is in the last line so it's not a problem. Remove the second inner block of line 11 as it has exactly the same assertion as the one in line 8.

@MarcusDenker MarcusDenker merged commit 6b40db4 into pharo-project:Pharo12 Apr 12, 2023
3 checks passed
@jordanmontt jordanmontt deleted the refactoring-context-test branch April 12, 2023 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants