use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method newDeprecationWarningForListOption.
@Test
public void newDeprecationWarningForListOption() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(NewWarningOptions.class);
parser.parse(OptionPriority.COMMAND_LINE, null, Arrays.asList("--second=a"));
assertEquals(Arrays.asList("Option 'second' is deprecated: sorry, no replacement"), parser.getWarnings());
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method getOptionValueDescriptionWithoutValue.
@Test
public void getOptionValueDescriptionWithoutValue() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(NullTestOptions.class);
assertNull(parser.getOptionValueDescription("simple"));
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method deprecationWarning.
@Test
public void deprecationWarning() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(WarningOptions.class);
parser.parse(OptionPriority.COMMAND_LINE, null, Arrays.asList("--first"));
assertEquals(Arrays.asList("Option 'first' is deprecated"), parser.getWarnings());
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method getOptionValueDescriptionWithNonExistingOption.
@Test
public void getOptionValueDescriptionWithNonExistingOption() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(NullTestOptions.class);
try {
parser.getOptionValueDescription("notexisting");
fail();
} catch (IllegalArgumentException e) {
/* Expected exception. */
}
}
use of com.google.devtools.common.options.OptionsParser.newOptionsParser in project bazel by bazelbuild.
the class OptionsParserTest method badExpansionOptions.
@Test
public void badExpansionOptions() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(BadExpansionOptions.class);
try {
parser.parse(OptionPriority.COMMAND_LINE, null, Arrays.asList("--first"));
} catch (AssertionError e) {
/* Expected error. */
return;
}
fail();
}
Aggregations