Skip to content

Commit

Permalink
[#1440] Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
remkop committed Jan 18, 2022
1 parent b478280 commit 50a724d
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package picocli.annotation.processing.tests;

import com.google.testing.compile.Compilation;
import com.google.testing.compile.JavaFileObjects;
import org.junit.Ignore;
import org.junit.Test;

import javax.annotation.processing.Processor;

import static com.google.testing.compile.CompilationSubject.assertThat;
import static com.google.testing.compile.Compiler.javac;

public class Issue1440Test {
@Ignore("https://github.com/remkop/picocli/issues/1440")
@Test
public void testIssue1440() {
Processor processor = new AnnotatedCommandSourceGeneratorProcessor();
Compilation compilation =
javac()
.withProcessors(processor)
.compile(JavaFileObjects.forResource(
"picocli/issue1440inheritedoptions/Command1.java"),
JavaFileObjects.forResource(
"picocli/issue1440inheritedoptions/Command2.java"));

assertThat(compilation).succeeded();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package picocli.issue1440inheritedoptions;

import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Spec;

@Command(name = "Command1", subcommands = CommandLine.HelpCommand.class,
description = "Command 1 description")
class Command1 {

@Spec
CommandSpec spec;

@CommandLine.Option(names = "--option",
scope = CommandLine.ScopeType.INHERIT,
description = "If set to true, will not ask questions and configurations, e.g. to overwrite a file. We don't recommend setting this option to true unless you are working in a scripted environment")
String option = "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package picocli.issue1440inheritedoptions;

import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Spec;

@Command(name = "Command1", subcommands = CommandLine.HelpCommand.class,
description = "Command 1 description")
class Command2 {
@Spec
CommandSpec spec;

@CommandLine.Option(names = "--option",
scope = CommandLine.ScopeType.INHERIT,
description = "If set to true, will not ask questions and configurations, e.g. to overwrite a file. We don't recommend setting this option to true unless you are working in a scripted environment")
String option = "";
}

0 comments on commit 50a724d

Please sign in to comment.