mutagen icon indicating copy to clipboard operation
mutagen copied to clipboard

Document mutations

Open llogiq opened this issue 6 years ago • 6 comments

We should have some document that outlines which mutations are actually there and what they do to the code.

llogiq avatar Mar 09 '18 11:03 llogiq

What does "insert opportunistic return default() - RETURN_DEFAULT" do? My function is fn parse_something(value: &str) -> Result<(u16, u16), Error>

bbigras avatar Jul 04 '18 18:07 bbigras

It adds code to directly return a default value if your functions return type implements Default. Otherwise it's a no-op.

llogiq avatar Jul 04 '18 21:07 llogiq

It adds code to directly return a default value if your functions return type implements Default.

That's weird, if I change my function to return Ok((Default::default(), Default::default())) my unit test will catch the error but cargo mutagen still say insert opportunistic return default() - RETURN_DEFAULT src/main.rs:276:62: 286:2 (1) ... FAILED (if I restore my function).

Otherwise it's a co-op.

Pardon my ignorance but what does co-op mean in this context?

bbigras avatar Jul 04 '18 21:07 bbigras

Stupid autocorrect: I meant a no-op. Edited my comment.

llogiq avatar Jul 05 '18 08:07 llogiq

Is there something beyond https://github.com/llogiq/mutagen/blob/master/docs/mutators.md that would be required for this issue?

williammartin avatar Sep 02 '20 12:09 williammartin

This document certainly describes every mutation currently implemented. I am not too happy with the format displayed in the documentation. Other than that, this issue can be closed.

samuelpilz avatar Sep 03 '20 11:09 samuelpilz