-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure pitest and jdk cannot be instrumented
These checks would only come into play if the user set an over wide target glob, but were previously broken.
- Loading branch information
Henry Coles
committed
Jun 16, 2022
1 parent
0bdeb66
commit 90859f0
Showing
17 changed files
with
182 additions
and
142 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
pitest-entry/src/test/java/com/example/systemtest/EatsMemoryWhenMutated.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,21 @@ | ||
package com.example.systemtest; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class EatsMemoryWhenMutated { | ||
public static int loop() throws InterruptedException { | ||
int i = 1; | ||
final List<String[]> vals = new ArrayList<>(); | ||
Thread.sleep(1500); | ||
do { | ||
i++; | ||
vals.add(new String[9999999]); | ||
vals.add(new String[9999999]); | ||
vals.add(new String[9999999]); | ||
vals.add(new String[9999999]); | ||
} while (i < 1); | ||
i++; | ||
return i; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
pitest-entry/src/test/java/com/example/systemtest/FailingTest.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,12 @@ | ||
package com.example.systemtest; | ||
|
||
import org.pitest.simpletest.TestAnnotationForTesting; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class FailingTest { | ||
@TestAnnotationForTesting | ||
public void fail() { | ||
assertEquals(1, 2); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
pitest-entry/src/test/java/com/example/systemtest/InfiniteLoop.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,17 @@ | ||
package com.example.systemtest; | ||
|
||
public class InfiniteLoop { | ||
public static int loop() { | ||
int i = 1; | ||
do { | ||
i++; | ||
try { | ||
Thread.sleep(1); | ||
} catch (final InterruptedException e) { | ||
e.printStackTrace(); | ||
} | ||
} while (i < 1); | ||
i++; | ||
return i; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
pitest-entry/src/test/java/com/example/systemtest/NoMutations.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,5 @@ | ||
package com.example.systemtest; | ||
|
||
public class NoMutations { | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
pitest-entry/src/test/java/com/example/systemtest/NoMutationsTest.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,10 @@ | ||
package com.example.systemtest; | ||
|
||
import org.pitest.simpletest.TestAnnotationForTesting; | ||
|
||
public class NoMutationsTest { | ||
@TestAnnotationForTesting | ||
public void pass() { | ||
|
||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
pitest-entry/src/test/java/com/example/systemtest/NoTests.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,5 @@ | ||
package com.example.systemtest; | ||
|
||
public class NoTests { | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
pitest-entry/src/test/java/com/example/systemtest/OneMutationFullTest.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,12 @@ | ||
package com.example.systemtest; | ||
|
||
import org.pitest.simpletest.TestAnnotationForTesting; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class OneMutationFullTest { | ||
@TestAnnotationForTesting | ||
public void testReturnOne() { | ||
assertEquals(1, OneMutationOnly.returnOne()); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...src/test/java/com/example/systemtest/OneMutationFullTestWithSystemPropertyDependency.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,14 @@ | ||
package com.example.systemtest; | ||
|
||
import org.pitest.simpletest.TestAnnotationForTesting; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class OneMutationFullTestWithSystemPropertyDependency { | ||
@TestAnnotationForTesting | ||
public void testReturnOne() { | ||
if (System.getProperty("foo").equals("foo")) { | ||
assertEquals(1, OneMutationOnly.returnOne()); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
pitest-entry/src/test/java/com/example/systemtest/OneMutationOnly.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,7 @@ | ||
package com.example.systemtest; | ||
|
||
public class OneMutationOnly { | ||
public static int returnOne() { | ||
return 1; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
pitest-entry/src/test/java/com/example/systemtest/OneMutationTest.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,5 @@ | ||
package com.example.systemtest; | ||
|
||
public class OneMutationTest { | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
pitest-entry/src/test/java/com/example/systemtest/ThreeMutations.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,15 @@ | ||
package com.example.systemtest; | ||
|
||
public class ThreeMutations { | ||
public static int returnOne() { | ||
return 1; | ||
} | ||
|
||
public static int returnTwo() { | ||
return 2; | ||
} | ||
|
||
public static int returnThree() { | ||
return 3; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
pitest-entry/src/test/java/com/example/systemtest/ThreeMutationsTwoMeaningfullTests.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,22 @@ | ||
package com.example.systemtest; | ||
|
||
import org.pitest.simpletest.TestAnnotationForTesting; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class ThreeMutationsTwoMeaningfullTests { | ||
@TestAnnotationForTesting | ||
public void testReturnOne() { | ||
assertEquals(1, ThreeMutations.returnOne()); | ||
} | ||
|
||
@TestAnnotationForTesting | ||
public void testReturnTwo() { | ||
assertEquals(2, ThreeMutations.returnTwo()); | ||
} | ||
|
||
@TestAnnotationForTesting | ||
public void coverButDoNotTestReturnThree() { | ||
ThreeMutations.returnThree(); | ||
} | ||
} |
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.