apex-mutation-testing
Version:
Apex mutation testing plugin
33 lines • 1.07 kB
JavaScript
import { BaseListener } from './baseListener.js';
import { TerminalNode } from 'antlr4ts/tree/index.js';
export class BoundaryConditionMutator extends BaseListener {
REPLACEMENT_MAP = {
'!=': '==',
'==': '!=',
'<': '<=',
'<=': '<',
'>': '>=',
'>=': '>',
'===': '!==',
'!==': '===',
};
// Target rule
// expression: expression ('<=' | '>=' | '>' | '<') expression
enterParExpression(ctx) {
if (ctx.childCount === 3) {
const symbol = ctx.getChild(1).getChild(1);
if (symbol instanceof TerminalNode) {
const symbolText = symbol.text;
const replacement = this.REPLACEMENT_MAP[symbolText];
if (replacement) {
this._mutations.push({
mutationName: this.constructor.name,
token: symbol,
replacement,
});
}
}
}
}
}
//# sourceMappingURL=boundaryConditionMutator.js.map