pharo-contributions / mutalk

Mutation Testing in Pharo Smalltalk
20 stars 14 forks source link

Syntax Error stops the analysis #91

Closed PalumboN closed 6 months ago

PalumboN commented 6 months ago

Trying running mutations in a compiler code with tests that generate code, sometimes the generated code breaks because of a Syntax Error, and this window opens.

image

The problem is that the analysis stops when this happens :(

I would expect Mutalk to recover from the error, killing the mutation, and continue with the analysis

PalumboN commented 6 months ago

So, this error is related to how Pharo is running the tests. The SyntaxError is special because it is has a special flow when you are editing a CodeTextBox.

For now, we solved with @DurieuxPol using a less declarative Opal's API from the code of the application:

writeAST: aRBMethodNode

    OpalCompiler new
        source: aRBMethodNode formattedCode;
        class: compilerClass;
        requestor: OCMockRequestor new;
        failBlock: [ 
            self error: 'Failed to generate code of: ' , aRBMethodNode selector ];
        compile

This code fails without open the windows.

Since we have to touch the code of the application to run Mutalk, this is not a solution.

But we think that the problem is in the Pharo side (not Mutalk specifically), so we close this issue.