Fix tests with working -D for zip output
Change-Id: Ib9513bab93bb1b8a20d6553449f8365559049d96
diff --git a/app/src/test/kotlin/de/ids_mannheim/korapxmltools/KorapXmlToolTest.kt b/app/src/test/kotlin/de/ids_mannheim/korapxmltools/KorapXmlToolTest.kt
index 7d67da5..2c7cd6d 100644
--- a/app/src/test/kotlin/de/ids_mannheim/korapxmltools/KorapXmlToolTest.kt
+++ b/app/src/test/kotlin/de/ids_mannheim/korapxmltools/KorapXmlToolTest.kt
@@ -313,10 +313,11 @@
@Test
fun korapXmlOutputWorks() {
val sourceFile = loadResource("wdf19.zip").path
- val tmpSourceFileName = java.io.File.createTempFile("tmp", ".zip").absolutePath
+ val tmpSourceFile = File.createTempFile("tmp", ".zip")
+ val tmpSourceFileName = tmpSourceFile.absolutePath
File(sourceFile).copyTo(File(tmpSourceFileName), true)
-
- val args = arrayOf("-o", "-f", "zip", tmpSourceFileName)
+ val outputDir = File(tmpSourceFileName).parentFile.absolutePath
+ val args = arrayOf("-D", outputDir, "-o", "-f", "zip", tmpSourceFileName)
debug(args)
val resultFile = tmpSourceFileName.toString().replace(".zip", ".base.zip")
@@ -326,11 +327,13 @@
@Test
fun overwriteWorks() {
val sourceFile = loadResource("wdf19.zip").path
- val tmpSourceFileName = java.io.File.createTempFile("tmp", ".zip").absolutePath
+ val tmpSourceFile = File.createTempFile("tmp", ".zip")
+ val tmpSourceFileName = tmpSourceFile.absolutePath
File(sourceFile).copyTo(File(tmpSourceFileName), true)
val resultFile = tmpSourceFileName.toString().replace(".zip", ".base.zip")
File(resultFile).createNewFile()
- val args = arrayOf("-o", "-f", "zip", tmpSourceFileName)
+ val outputDir = File(tmpSourceFileName).parentFile.absolutePath
+ val args = arrayOf("-D", outputDir, "-o", "-f", "zip", tmpSourceFileName)
debug(args)
assert(File(resultFile).exists())
assert(File(resultFile).length() > 0)