pub enum Operator {
Show 23 variants
ArithmeticOperator,
RelationalOperator,
LogicalOperator,
NegateCondition,
UnaryOperator,
UpdateOperator,
RemovedCall,
ReturnValue,
BooleanLiteral,
StringLiteral,
OptionalChaining,
RegexLiteral,
RemovedChainLink,
BlockStatement,
ArrayLiteral,
ObjectLiteral,
MethodExpression,
SwitchCase,
CallExpression,
ThrowStatement,
RegexConstructor,
RegexAssertion,
NullishFallback,
}Expand description
One mutation operator.
The default set (Operator::DEFAULT) comes from selective-mutation
research: it keeps the operators that give most of the test-strength
signal and drops redundant ones. The other operators of Operator::ALL
are opt-in: they make more mutants, many of them equivalent or killed by
any test, so they run only when a run names them.
Variants§
ArithmeticOperator
+ and - swap, * and / swap, % becomes *. The compound
assignments += and -=, *= and /=, <<= and >>=, &= and
|= swap, and %= becomes *=.
RelationalOperator
The non-redundant relational subset (Kaminski), and the constant result of the comparison.
LogicalOperator
&& and || swap, ?? becomes &&. &&= and ||= swap, ??=
becomes &&=.
NegateCondition
A branch or loop test becomes true and false, and a boolean
operand of && or || becomes the constant that does not decide
the whole expression.
UnaryOperator
!x, -x and ~x become x. -x and +x swap.
UpdateOperator
++ and -- swap.
RemovedCall
A call statement becomes a no-op.
ReturnValue
return expr and the concise body of x => expr become undefined.
BooleanLiteral
true and false swap.
StringLiteral
A non-empty string or template becomes empty. An empty one becomes
"fallow" or `fallow`.
OptionalChaining
a?.b becomes a.b, a?.() becomes a().
RegexLiteral
One token of a regular expression literal changes: an anchor or a
quantifier is removed, a {n,m} range becomes {n}, a character
class is negated, or a class escape gets the opposite case.
RemovedChainLink
One call link of a fluent chain in a module-level const
initializer is removed: r.m(args) becomes r, when r is a call.
BlockStatement
Opt-in. The statements of a non-empty block or function body are removed.
ArrayLiteral
Opt-in. [x] becomes [], and [] becomes ["fallow"].
ObjectLiteral
Opt-in. A non-empty object literal becomes {}.
MethodExpression
Opt-in. A string, array or date method call becomes its pair
(startsWith and endsWith), or the call is removed (s.trim()
becomes s).
SwitchCase
Opt-in. The statements of a case or default clause are removed,
so the clause falls through.
CallExpression
Opt-in. A call in an expression position becomes void 0.
ThrowStatement
Opt-in. A throw new X(...) statement is removed.
RegexConstructor
Opt-in. The regex-literal and regex-assertion changes, applied
to the string pattern of new RegExp("...") or RegExp("...").
RegexAssertion
Opt-in. A lookaround of a regular expression literal is negated
((?= and (?! swap, (?<= and (?<! swap), or \b and \B
swap.
NullishFallback
Opt-in. a ?? b becomes a: the fallback of a nullish coalescing
expression is removed.
Implementations§
Trait Implementations§
impl Copy for Operator
impl Eq for Operator
Source§impl Ord for Operator
impl Ord for Operator
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Operator
impl PartialOrd for Operator
Source§impl Serialize for Operator
impl Serialize for Operator
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Operator
Auto Trait Implementations§
impl Forget for Operator
impl Freeze for Operator
impl Move for Operator
impl RefUnwindSafe for Operator
impl Send for Operator
impl Sync for Operator
impl Unpin for Operator
impl UnsafeUnpin for Operator
impl UnwindSafe for Operator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more