use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method newDeprecationWarningForExpansionOption.
@Test
public void newDeprecationWarningForExpansionOption() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(NewWarningOptions.class);
parser.parse(OptionPriority.COMMAND_LINE, null, Arrays.asList("--third"));
assertEquals(Arrays.asList("Option 'third' is deprecated: use --forth instead"), parser.getWarnings());
assertTrue(parser.getOptions(NewWarningOptions.class).fourth);
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method canonicalize.
public static List<String> canonicalize(Class<? extends OptionsBase> optionsClass, String... args) throws OptionsParsingException {
OptionsParser parser = OptionsParser.newOptionsParser(ImmutableList.<Class<? extends OptionsBase>>of(optionsClass));
parser.setAllowResidue(false);
parser.parse(Arrays.asList(args));
return parser.canonicalize();
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method warningForExplicitOverridingImplicitOption.
@Test
public void warningForExplicitOverridingImplicitOption() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(ImplicitDependencyWarningOptions.class);
parser.parse("--first=first");
assertThat(parser.getWarnings()).isEmpty();
parser.parse("--second=second");
assertThat(parser.getWarnings()).containsExactly("A new value for option 'second' overrides a" + " previous implicit setting of that option by option 'first'");
}
Aggregations