-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1069 from hcoles/feature/better_static_init
expand filtering of static initializer mutants
- Loading branch information
Showing
9 changed files
with
232 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
pitest-entry/src/test/java/com/example/staticinitializers/BrokenChain.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.example.staticinitializers; | ||
|
||
public class BrokenChain { | ||
static { | ||
dontMutate1(); | ||
} | ||
|
||
private static void dontMutate1() { | ||
dontMutate2(); | ||
System.out.println("mutate me"); | ||
} | ||
|
||
private static void dontMutate2() { | ||
mutateMe(); | ||
System.out.println("mutate me"); | ||
} | ||
|
||
// chain broken here by public method | ||
public static void mutateMe() { | ||
mutateMe2(); | ||
System.out.println("mutate me"); | ||
} | ||
|
||
private static void mutateMe2() { | ||
System.out.println("mutate me"); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
pitest-entry/src/test/java/com/example/staticinitializers/MethodsCallsEachOtherInLoop.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example.staticinitializers; | ||
|
||
public class MethodsCallsEachOtherInLoop { | ||
static { | ||
a(true); | ||
} | ||
|
||
private static void a(boolean bool) { | ||
if (bool) { | ||
b(false); | ||
} | ||
} | ||
|
||
private static void b(boolean bool) { | ||
if (bool) { | ||
a(false); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
pitest-entry/src/test/java/com/example/staticinitializers/SecondLevelPrivateMethods.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.example.staticinitializers; | ||
|
||
public class SecondLevelPrivateMethods { | ||
static { | ||
dontMutate1(); | ||
} | ||
|
||
private static void dontMutate1() { | ||
dontMutate2(); | ||
System.out.println("mutate me"); | ||
} | ||
|
||
private static void dontMutate2() { | ||
System.out.println("mutate me"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
pitest-entry/src/test/java/com/example/staticinitializers/ThirdLevelPrivateMethods.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.example.staticinitializers; | ||
|
||
public class ThirdLevelPrivateMethods { | ||
|
||
static { | ||
dontMutate1(); | ||
dontMutate2(); | ||
} | ||
|
||
private static void dontMutate1() { | ||
dontMutate2(); | ||
System.out.println("mutate me"); | ||
} | ||
|
||
private static void dontMutate2() { | ||
dontMutate3(); | ||
System.out.println("mutate me"); | ||
} | ||
|
||
private static void dontMutate3() { | ||
dontMutate4(); | ||
System.out.println("mutate me"); | ||
} | ||
|
||
private static void dontMutate4() { | ||
System.out.println("mutate me"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.