use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method warningForExplicitOverridingImplicitOptionInSameCall.
@Test
public void warningForExplicitOverridingImplicitOptionInSameCall() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(ImplicitDependencyWarningOptions.class);
parser.parse("--first=first", "--second=second");
assertThat(parser.getWarnings()).containsExactly("Option 'second' is implicitly defined by " + "option 'first'; the implicitly set value overrides the previous one");
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method deprecationWarningForAbbreviatedExpansionOption.
@Test
public void deprecationWarningForAbbreviatedExpansionOption() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(WarningOptions.class);
parser.parse(OptionPriority.COMMAND_LINE, null, Arrays.asList("-t"));
assertEquals(Arrays.asList("Option 'third' is deprecated"), parser.getWarnings());
assertTrue(parser.getOptions(WarningOptions.class).fourth);
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method badImplicitDependency.
@Test
public void badImplicitDependency() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(BadImplicitDependencyOptions.class);
try {
parser.parse(OptionPriority.COMMAND_LINE, null, Arrays.asList("--first=first"));
} catch (AssertionError e) {
/* Expected error. */
return;
}
fail();
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method warningForImplicitOverridingImplicitOption.
@Test
public void warningForImplicitOverridingImplicitOption() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(ImplicitDependencyWarningOptions.class);
parser.parse("--first=first");
assertThat(parser.getWarnings()).isEmpty();
parser.parse("--third=third");
assertThat(parser.getWarnings()).containsExactly("Option 'second' is implicitly defined by both " + "option 'first' and option 'third'");
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method newDeprecationWarning.
@Test
public void newDeprecationWarning() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(NewWarningOptions.class);
parser.parse(OptionPriority.COMMAND_LINE, null, Arrays.asList("--first"));
assertEquals(Arrays.asList("Option 'first' is deprecated: it's gone"), parser.getWarnings());
}
Aggregations