A File can now also be used to specify the working dir

This commit is contained in:
Erik C. Thauvin 2024-04-05 12:55:44 -07:00
parent e7d3060649
commit 2a2c81994a
Signed by: erik
GPG key ID: 776702A6A2DA330E
2 changed files with 39 additions and 18 deletions

View file

@ -53,12 +53,12 @@ class ExecOperationTest {
}
@Test
void testExitStatus() {
void testExitValue() {
assertThatCode(() ->
new ExecOperation()
.fromProject(new BaseProject())
.command(List.of("cat", FOO))
.execute()).message().contains("exit status");
.execute()).message().contains("exit value/status");
}
@Test
@ -83,11 +83,21 @@ class ExecOperationTest {
@Test
void testWorkDir() {
assertThatCode(() ->
new ExecOperation()
.fromProject(new BaseProject())
.command("echo", FOO)
.workDir(new File(System.getProperty("java.io.tmpdir")))
.execute()).doesNotThrowAnyException();
}
@Test
void testWorkDirInvalid() {
assertThatCode(() ->
new ExecOperation()
.fromProject(new BaseProject())
.command("echo")
.workDir(FOO)
.execute()).message().startsWith("Invalid work directory: ").endsWith(FOO);
.execute()).message().startsWith("Invalid working directory: ").endsWith(FOO);
}
}