You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, we mutate string concatenations with the arithmetic operator mutator.
"foo"+"bar"
Is mutated to:
"foo"-"bar"
This is all in all not that helpful, as such expressions result in NaN. You do want to mutate these strings, as you want to make sure they are tested. However, the string literal mutator already does a great job at it.
Describe the solution you'd like
As soon as 1 of the 2 operands is a string literal, don't mutate + into -,
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered:
As far as I'm aware I think you only need to traverse your way down the left path of the tree. If there's a string on the right hand side, but nothing on the left hand then it could still be an arithmetic operator. For example:
'a' + 3 + 2 will result in a32, but 3 + 2 + 'a' will result in 5a. It leaves a gap when you have instances of
consta='a';constb='b';console.log(a+b+'c');
where you won't be able to tell if a + b is a string concatenation or an arithmetic operation, but it'll still help to optomise cases where we can
As far as I'm aware I think you only need to traverse your way down the left path of the tree
I don't think so. What I propose here, is a 'shallow' search. In other words: 'a' + 3 + 2 would still be mutated in 'a' + 3 - 2.
where you won't be able to tell if a + b is a string concatenation or an arithmetic operation
Yes, you are correct. This is why we originally decided not to differentiate.
I don't want to have too much logic inside mutators. What I propose here, is "best-effort". If it is not immediately visible if it's a string concatenation or not, then we mutate. It is at least better than what we have now, and we can add more exceptions if they occur in actual production code.
Is your feature request related to a problem? Please describe.
Currently, we mutate string concatenations with the arithmetic operator mutator.
Is mutated to:
This is all in all not that helpful, as such expressions result in
NaN
. You do want to mutate these strings, as you want to make sure they are tested. However, the string literal mutator already does a great job at it.Describe the solution you'd like
As soon as 1 of the 2 operands is a string literal, don't mutate
+
into-
,Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: