Skip to content

Commit fd6e904

Browse files
committed
automate running tests
1 parent f3eda80 commit fd6e904

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package io.viash.helpers
2+
3+
import org.scalatest.BeforeAndAfterAll
4+
import org.scalatest.funsuite.AnyFunSuite
5+
import java.nio.file.{Files, Paths, Path}
6+
7+
/**
8+
* Test suite for bash utility functions.
9+
* Runs all *.test.sh files in src/test/resources/io/viash/helpers/bashutils/
10+
*/
11+
class BashUtilsTest extends AnyFunSuite with BeforeAndAfterAll {
12+
Logger.UseColorOverride.value = Some(false)
13+
14+
private val projectRoot = Paths.get(System.getProperty("user.dir"))
15+
private val bashUtilsTestDir = projectRoot.resolve("src/test/resources/io/viash/helpers/bashutils")
16+
17+
test("ViashParseArgumentValue") {
18+
val testScript = bashUtilsTestDir.resolve("ViashParseArgumentValue.test.sh")
19+
20+
val result = Exec.runCatchPath(
21+
List("bash", testScript.toString),
22+
cwd = Some(projectRoot)
23+
)
24+
25+
assert(result.exitValue == 0, s"ViashParseArgumentValue test failed:\n${result.output}")
26+
}
27+
28+
test("ViashCleanupRegistry") {
29+
val testScript = bashUtilsTestDir.resolve("ViashCleanupRegistry.test.sh")
30+
31+
val result = Exec.runCatchPath(
32+
List("bash", testScript.toString),
33+
cwd = Some(projectRoot)
34+
)
35+
36+
assert(result.exitValue == 0, s"ViashCleanupRegistry test failed:\n${result.output}")
37+
}
38+
}

0 commit comments

Comments
 (0)