muter icon indicating copy to clipboard operation
muter copied to clipboard

Muter should look inside the body of forEach

Open ZevEisenberg opened this issue 6 years ago • 2 comments
trafficstars

Feel free to update the title if there’s a better way to word this.

Screenshot: image

Code:

textViewsAndEncodings.map { $0.key }.forEach {
    $0.enabledTextCheckingTypes = 0
    $0.isAutomaticQuoteSubstitutionEnabled = false
    $0.isAutomaticLinkDetectionEnabled = false
    $0.isAutomaticDataDetectionEnabled = false
    $0.isAutomaticDashSubstitutionEnabled = false
    $0.isAutomaticTextReplacementEnabled = false
    $0.isAutomaticSpellingCorrectionEnabled = false
    $0.isAutomaticTextCompletionEnabled = false
}

In this code example, Muter correctly identifies that removing the whole forEach call, including its entire body, fails to trigger, but it doesn’t test each of the internal $0.isFooEnabled = false lines for un-tested side effects.

ZevEisenberg avatar Jun 16 '19 17:06 ZevEisenberg

Great catch. I'm also struggling on how to word this issue, but your example is clear to me. I've labeled it accordingly and will figure out the scheduling for this change.

SeanROlszewski avatar Jun 16 '19 19:06 SeanROlszewski

Also, ugh, I hate the thought of actually writing tests for the code I pasted. Probably gonna be a UI test, but could also just query those properties and make sure they stay disabled.

ZevEisenberg avatar Jun 16 '19 21:06 ZevEisenberg