Skip to content

Commit

Permalink
add kotlin function types
Browse files Browse the repository at this point in the history
  • Loading branch information
hcoles committed Aug 30, 2024
1 parent a7d9d90 commit bcc62d9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
18 changes: 17 additions & 1 deletion pitest-entry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,23 @@
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>


<!-- https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core -->
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>1.8.1</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>2.0.20</version>
</dependency>


</dependencies>

</project>
27 changes: 26 additions & 1 deletion pitest-entry/src/main/resources/functional_interfaces.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,29 @@ com/google/common/util/concurrent/ClosingFuture$Combiner4$AsyncClosingFunction4
com/google/common/util/concurrent/ClosingFuture$Combiner4$ClosingFunction4
com/google/common/util/concurrent/ClosingFuture$Combiner5$AsyncClosingFunction5
com/google/common/util/concurrent/ClosingFuture$Combiner5$ClosingFunction5
com/google/common/util/concurrent/ClosingFuture$ValueAndCloserConsumer
com/google/common/util/concurrent/ClosingFuture$ValueAndCloserConsumer
kotlin/Function
kotlin/jvm/functions/Function0
kotlin/jvm/functions/Function1
kotlin/jvm/functions/Function10
kotlin/jvm/functions/Function11
kotlin/jvm/functions/Function12
kotlin/jvm/functions/Function13
kotlin/jvm/functions/Function14
kotlin/jvm/functions/Function15
kotlin/jvm/functions/Function16
kotlin/jvm/functions/Function17
kotlin/jvm/functions/Function18
kotlin/jvm/functions/Function19
kotlin/jvm/functions/Function2
kotlin/jvm/functions/Function20
kotlin/jvm/functions/Function21
kotlin/jvm/functions/Function22
kotlin/jvm/functions/Function3
kotlin/jvm/functions/Function4
kotlin/jvm/functions/Function5
kotlin/jvm/functions/Function6
kotlin/jvm/functions/Function7
kotlin/jvm/functions/Function8
kotlin/jvm/functions/Function9
kotlin/jvm/functions/FunctionN
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
import org.junit.Test;
import org.pitest.bytecode.analysis.ClassTree;
import org.pitest.classinfo.ClassByteArraySource;
import org.pitest.classpath.ClassPath;
import org.pitest.classpath.ClassloaderByteArraySource;
import org.pitest.classpath.CodeSource;
import org.pitest.mutationtest.FixedCodeSource;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -31,22 +34,25 @@ public void recognisesFunctionalInterfaces() {
}


/*

@Test
public void wholeClassPath() throws Exception {
ClassPath cp = new ClassPath();
List<String> classes = cp.classNames().stream()
.map(n -> source.getBytes(n))
.map(b -> ClassTree.fromBytes(b.get()))
.filter(ClassTree::isInterface)
.flatMap(t -> underTest.apply(codeSourceFor(t)).stream())
// .flatMap(t -> underTest.apply(codeSourceFor(t)).stream())
.filter(c -> c.name().getNameWithoutPackage().asInternalName().startsWith("Consume"))
.map(c -> c.name().asInternalName())

.distinct()
.collect(Collectors.toList());

System.out.println(classes.stream()
.collect(Collectors.joining("\n")));
}
*/


/*
// not a test and only works with java 9+
Expand Down

0 comments on commit bcc62d9

Please sign in to comment.