Skip to content

Commit

Permalink
Fix broken flag pass-thru name and test
Browse files Browse the repository at this point in the history
  • Loading branch information
thegridman committed Sep 23, 2024
1 parent 34e97d7 commit 3373e9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion javatools/src/main/java/org/xvm/tool/flag/Flag.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ public boolean isPassThru()
*/
public String getPassThruName()
{
return passThruName == null || passThruName.isBlank() ? name : passThruName;
if (passThru)
{
return passThruName == null || passThruName.isBlank() ? name : passThruName;
}
return null;
}

/**
Expand Down
5 changes: 2 additions & 3 deletions javatools/src/test/java/org/xvm/tool/flag/FlagTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ public void shouldPassThruCreateFlag()
BooleanValue noOptValue = new BooleanValue();
boolean hidden = false;
boolean passThru = true;
String passThruName = null;

Flag<Boolean> flag = new Flag<>(name, shortcut, usage, value, dfltValue, noOptValue,
hidden, passThru, passThruName);
hidden, passThru, null);

assertThat(flag.getName(), is(name));
assertThat(flag.hasShorthand(), is(true));
Expand All @@ -118,7 +117,7 @@ public void shouldPassThruCreateFlag()
assertThat(flag.getNoArgDefault(), is(sameInstance(noOptValue)));
assertThat(flag.isHidden(), is(hidden));
assertThat(flag.isPassThru(), is(passThru));
assertThat(flag.getPassThruName(), is(passThruName));
assertThat(flag.getPassThruName(), is(name));
}

@Test
Expand Down

0 comments on commit 3373e9c

Please sign in to comment.