mbj / mutant

Automated code reviews via mutation testing - semantic code coverage.
Other
1.94k stars 151 forks source link

Add mutation `Enumerable#grep_v` -> `Enumerable#grep` #481

Open backus opened 8 years ago

backus commented 8 years ago

In ruby 2.3:

> %w[John Jack Jim Bob Greg Joe].grep_v(/^J/)
 => ["Bob", "Greg"]
> [1, 1.0, '1', 'one'].grep_v(Numeric)
 => ["1", "one"]

Mutating to Enumerable#grep is then a clear orthogonal mutation

mbj commented 8 years ago

Mutating to Enumerable#grep is then a clear orthogonal mutation

I wounder if this mutation will ever yield an alive? We already mutate to the absence of grep (not explicitly, but we simply kill send nodes and emit the receiver).

The only case where this mutation will yield an alive is when the already existing "to absence" mutation will yield an alive?

backus commented 8 years ago

I think you're right here. Might not make sense to make this a mutation. One possible case might be if a test is asserting that the output array is a subset of the input array. Doesn't seem too likely to pop up though so I'm ambivalent about whether this would be useful

mbj commented 8 years ago

Yeah, if the test is that weak this mutation would yield an alive. In doubt lets add it.

Once my service is up we can log which operators yielded alives the last N month, and kill the ones that never yielded an alive.

dgollahon commented 3 years ago

In doubt lets add it.

@mbj Do you still feel this way? If so, I'm happy to add it.

dgollahon commented 3 years ago

Likewise, we could do #select -> #reject.