File tree Expand file tree Collapse file tree
src/test/java/io/github/easy4j/opencode/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 */
1616class OpenCodeRunOptionsContractTest {
1717
18+ @ Test
19+ void autoApprovalMustBeOptInBooleanSwitch () {
20+ OpenCodeRunOptions disabled = new OpenCodeRunOptions ("hello" );
21+ List <String > disabledArgs = Arrays .asList (disabled .toArgs ());
22+ assertFalse (disabledArgs .contains ("--auto" ), "--auto must be disabled by default" );
23+
24+ OpenCodeRunOptions enabled = new OpenCodeRunOptions ("hello" );
25+ Method auto = assertDoesNotThrow (
26+ () -> OpenCodeRunOptions .class .getMethod ("auto" , boolean .class ),
27+ "OpenCode run --auto must be explicitly modeled" );
28+ assertDoesNotThrow (() -> auto .invoke (enabled , true ));
29+
30+ List <String > enabledArgs = Arrays .asList (enabled .toArgs ());
31+ assertTrue (enabledArgs .contains ("--auto" ));
32+ }
33+
34+ @ Test
35+ void interactiveModeMustBeExplicitlyModeled () {
36+ OpenCodeRunOptions options = new OpenCodeRunOptions ("hello" );
37+ Method interactive = assertDoesNotThrow (
38+ () -> OpenCodeRunOptions .class .getMethod ("interactive" , boolean .class ),
39+ "OpenCode run --interactive must be explicitly modeled" );
40+ assertDoesNotThrow (() -> interactive .invoke (options , true ));
41+
42+ assertTrue (Arrays .asList (options .toArgs ()).contains ("--interactive" ));
43+ }
44+
1845 @ Test
1946 void shareMustBeBooleanSwitchWithoutValue () {
2047 OpenCodeRunOptions options = new OpenCodeRunOptions ("hello" );
You can’t perform that action at this time.
0 commit comments