Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for infection. #37

Open
Danack opened this issue Jul 3, 2019 · 1 comment
Open

Add support for infection. #37

Danack opened this issue Jul 3, 2019 · 1 comment

Comments

@Danack
Copy link

Danack commented Jul 3, 2019

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
@DaveLiddament
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants