Plugin tests bugfixes

This commit is contained in:
Stef Tervelde
2025-07-08 10:31:12 +02:00
parent 7379166bc4
commit a36c8a353b
2 changed files with 26 additions and 21 deletions

View File

@@ -51,8 +51,8 @@ abstract class PDETask : SourceTask() {
.files
.groupBy { it.name }
.map { entry ->
// TODO: Select by which one is in the unsaved folder
entry.value.maxByOrNull { it.lastModified() }!!
entry.value.firstOrNull { it.parentFile?.name == "unsaved" }
?: entry.value.first()
}
.joinToString("\n"){
it.readText()

View File

@@ -75,7 +75,7 @@ class ProcessingPluginTest{
@Test
fun testMultiplePDE(){
val (buildResult, sketchFolder, classLoader) = createTemporaryProcessingSketch("build"){ sketchFolder ->
sketchFolder.resolve("sketch.pde").writeText(""")
sketchFolder.resolve("sketch.pde").writeText("""
void setup(){
size(100, 100);
}
@@ -175,24 +175,29 @@ class ProcessingPluginTest{
}
}
}
@Test
fun testImportingLibrary(){
fun isDebuggerAttached(): Boolean {
val runtimeMxBean = ManagementFactory.getRuntimeMXBean()
val inputArguments = runtimeMxBean.inputArguments
return inputArguments.any {
it.contains("-agentlib:jdwp")
}
}
fun openFolderInFinder(folder: File) {
if (!folder.exists() || !folder.isDirectory) {
println("Invalid directory: ${folder.absolutePath}")
return
}
val process = ProcessBuilder("open", folder.absolutePath)
.inheritIO()
.start()
process.waitFor()
}
fun isDebuggerAttached(): Boolean {
val runtimeMxBean = ManagementFactory.getRuntimeMXBean()
val inputArguments = runtimeMxBean.inputArguments
return inputArguments.any {
it.contains("-agentlib:jdwp")
}
}
fun openFolderInFinder(folder: File) {
if (!folder.exists() || !folder.isDirectory) {
println("Invalid directory: ${folder.absolutePath}")
return
}
val process = ProcessBuilder("open", folder.absolutePath)
.inheritIO()
.start()
process.waitFor()
}
}