Skip to content

Commit 0eb8ac3

Browse files
committed
Fix resolving lib path in tests
1 parent 52f5036 commit 0eb8ac3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/test/kotlin/com/tomwyr/GeneratorTest.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,24 @@ const val basePath = "src/test/resources/"
4646

4747
fun setUpTestCommand(testCase: String, packageName: String): GenerateTreeCommand {
4848
return GenerateTreeCommand(
49-
libPath = "libGodotNodeTreeCore.dylib",
49+
libPath = "libGodotNodeTreeCore" + getLibExtension(),
5050
projectPath = "$basePath/$testCase/scenes",
5151
validateProjectPath = false,
5252
outputPath = "$basePath/$testCase/Actual",
5353
packageName = packageName,
5454
)
5555
}
5656

57+
fun getLibExtension(): String {
58+
val osName = System.getProperty("os.name")
59+
return when {
60+
osName.contains("Mac", ignoreCase = true) -> ".dylib"
61+
osName.contains("Linux", ignoreCase = true) -> ".so"
62+
osName.contains("Windows", ignoreCase = true) -> ".dll"
63+
else -> throw UnsupportedOperationException("Unsupported OS")
64+
}
65+
}
66+
5767
fun assertOutputsEqual(testCase: String) {
5868
val expected = File("$basePath/$testCase/Expected").readText(Charsets.UTF_8)
5969
val actual = File("$basePath/$testCase/Actual").readText(Charsets.UTF_8)

0 commit comments

Comments
 (0)