|
18 | 18 | import io.github.easy4j.codex.CodexClientConfig; |
19 | 19 | import org.junit.jupiter.api.Test; |
20 | 20 |
|
| 21 | +import java.nio.file.Path; |
| 22 | + |
21 | 23 | import static org.junit.jupiter.api.Assertions.assertArrayEquals; |
22 | 24 | import static org.junit.jupiter.api.Assertions.assertEquals; |
23 | 25 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
|
27 | 29 | * Unit tests for {@link CodexCli} and its inner option builders |
28 | 30 | * ({@link CodexCli.ExecOptions} and {@link CodexCli.GlobalOptions}). |
29 | 31 | * |
30 | | - * <p>Uses {@code /bin/echo} as the CLI executable so that argument |
31 | | - * assembly can be verified without depending on the real {@code codex} |
32 | | - * binary.</p> |
| 32 | + * <p>Uses the {@code echo-args.sh} test fixture as the CLI executable so that |
| 33 | + * argument assembly can be verified without depending on the real {@code codex} |
| 34 | + * binary. {@code /bin/echo} cannot be used because GNU coreutils echo (Linux) |
| 35 | + * interprets {@code --version} as a flag while BSD echo (macOS) prints it |
| 36 | + * literally.</p> |
33 | 37 | * |
34 | 38 | * @since 3.0.0 |
35 | 39 | */ |
36 | 40 | class CodexCliTest { |
37 | 41 |
|
| 42 | + /** Absolute path of the argument-echoing fixture script (surefire runs from the module base dir). */ |
| 43 | + private static final String ECHO_ARGS_SCRIPT = |
| 44 | + Path.of("src", "test", "resources", "echo-args.sh").toAbsolutePath().toString(); |
| 45 | + |
38 | 46 | private static CodexCli echoCli() { |
39 | 47 | CodexClientConfig config = new CodexClientConfig(); |
40 | | - config.setLocalExecutable("/bin/echo"); |
| 48 | + config.setLocalExecutable(ECHO_ARGS_SCRIPT); |
41 | 49 | config.setLocalTimeoutSeconds(2); |
42 | 50 | return new CodexCli(new CodexCliExecutor(config)); |
43 | 51 | } |
|
0 commit comments