Skip to content

Commit

Permalink
[#1471] Add failing test reproducing the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
remkop committed Jul 19, 2022
1 parent c1fe9d4 commit 675327c
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/test/java/picocli/Issue1471.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package picocli;

import org.junit.Ignore;
import org.junit.Test;
import picocli.CommandLine.Command;
import picocli.CommandLine.Parameters;

import static org.junit.Assert.*;
import static picocli.CommandLine.ScopeType.INHERIT;

public class Issue1471 {
public CommandLine getTestCommandLine(ParentTestCommand parentCommand, TestCommand testCommand, CommandLine.IFactory factory) {
CommandLine commandLine = new CommandLine(parentCommand, factory);
commandLine.addSubcommand(testCommand);
return commandLine;
}
@Command(name = "parentTestCommand", mixinStandardHelpOptions = true, scope = INHERIT)
static class ParentTestCommand {
}

@Command(name = "sorteotest")
static class TestCommand {
@Command(name = "entertest", description = "Start participating in a giveaway")
void enter(@Parameters(arity = "1") String sentenceType,
@Parameters(arity = "1") String tweetUrl) {
System.out.println("entering giveaway");
}
}

@Ignore
@Test
public void testIssue1741() {
CommandLine commandLine = getTestCommandLine(new ParentTestCommand(), new TestCommand(), CommandLine.defaultFactory());
assertEquals(0, commandLine.execute("sorteotest", "entertest", "sequenceType", "url"));
}

}

0 comments on commit 675327c

Please sign in to comment.