Skip to content

Math mutator: Don't mutate string concatenation '+' #10

Open

Description

@DiegoRBaquero
No description provided.

Activity

  1. simondel commented on Apr 25, 2018

    @simondel

    Why not? It's valid JavaScript.

  2. DiegoRBaquero commented on Apr 25, 2018

    @DiegoRBaquero
    MemberAuthor

    Valid JavaScript but results in NaN. Easily caught while coding, when failing to see the expected text or by a linter. Saves many mutators when there are many concatenations -> saves time.

  3. simondel commented on Apr 25, 2018

    @simondel

    True, but how big of an issue is this in modern JavaScript code? Since you won't have this issue with template strings.

  4. DiegoRBaquero commented on Apr 25, 2018

    @DiegoRBaquero
    MemberAuthor

    Small, even more reason to not mutate it as template strings take over.

  5. simondel commented on Apr 25, 2018

    @simondel

    👍 your call. You could also keep it in to encourage devs to switch to template strings.

    In the case of Stryker, the only complaints we got from mutating string concatenation was from TypeScript users and we fixed that by using the TypeScript compiler together with the projects tsconfig.json to determine which code would cause a transpiler error.

  6. DiegoRBaquero commented on Apr 25, 2018

    @DiegoRBaquero
    MemberAuthor

    This I like

    You could also keep it in to encourage devs to switch to template strings.

    How did you mutate string concat? + to - too?

  7. simondel commented on Apr 26, 2018

    @simondel

    Yes. We don't look at the types of the left or right operand in binary expressions. We simply change the plus token into a minus token.

    With JavaScript code, the mutant will actually get tested. With TypeScript it will first be ran though the TypeScript compiler which will (in most cases) cause an error. Mutants that cause a transpilation error are not tested and not counted in the score.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions