sarb icon indicating copy to clipboard operation
sarb copied to clipboard

Add support for infection.

Open Danack opened this issue 5 years ago • 1 comments

Example output is below. The failures are listed in the 'Escaped mutants' section of the infection-log.txt file. For the example below the failure would be file /projects/danack/github/params/lib/Params/Params.php on line 36 and the error type would be OneZeroInteger.

Escaped mutants:
================


1) /projects/danack/github/params/lib/Params/Params.php:36    [M] OneZeroInteger

--- Original
+++ New
@@ @@
     {
         foreach ($namedRules as $parameterName => $rules) {
             // TODO - test for packed array?
-            if (count($rules) === 0) {
+            if (count($rules) === 1) {
                 throw new RulesEmptyException();
             }
             $firstRule = $rules[0];

PHPUnit 8.1.2 by Sebastian Bergmann and contributors.

...                                                                 3 / 3 (100%)

Time: 29 ms, Memory: 4.00 MB

OK (3 tests, 13 assertions)

Timed Out mutants:
==================

Killed mutants:
===============


1) /projects/danack/github/params/lib/Params/Exception/ValidationException.php:29    [M] OneZeroInteger

Danack avatar Jul 03 '19 14:07 Danack

Is this the only output format available?

Are all escaped mutants recorded in the same place? Do you have an example with multiple escaped mutations over multiple files?

I assume some kind of state machine that parses infection-log.txt line by line could work.

It would first look for the string Escaped mutants: and then the next line it would expect is================ If would then parse all lines that start <number>) and pull out the file, line number and type. in above example:

  • /projects/danack/github/params/lib/Params/Params.php
  • 36
  • [M] OneZeroInteger

It would keep going until it hit another line like this: ================ and ignore the rest of the file?

DaveLiddament avatar Jul 03 '19 15:07 DaveLiddament