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

Reporting mutation surviving which should not #442

Closed
rossdrew opened this issue Jan 21, 2018 · 1 comment
Closed

Reporting mutation surviving which should not #442

rossdrew opened this issue Jan 21, 2018 · 1 comment

Comments

@rossdrew
Copy link

rossdrew commented Jan 21, 2018

In one of my tests, I create a memory object, then reset() it, setting all that memory to 0.

I have a test, which confirms that memory is set to 0 and not empty.

Pitest reports the line doing the reset() as

1. removed call to com/rox/emu/mem/SimpleMemory::reset → SURVIVED

but if I remove the specified reset() line, it throws an error as the array hasn't been set up, meaning the mutation is (or should be) covered.

@rossdrew rossdrew changed the title Reporting mutations surviving which should not Reporting mutation surviving which should not Jan 21, 2018
@hcoles
Copy link
Owner

hcoles commented Jan 21, 2018

Your test uses the assert keyword instead of a test assertion.

If the JVM is not run with the -ea flag then none of the code within the assert statement is executed - the assert is effectively commented out.

It would appear that the gradle test runner is setting the flag in the when running the tests.

Pitest does not set the flag so that this type of test error is revealed.

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

2 participants