diff options
author | ccalvarin <ccalvarin@google.com> | 2017-04-19 20:18:57 +0200 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2017-04-20 11:07:37 +0200 |
commit | f9efa42113c5bcf0aaadb73fbc3822b389cc5c96 (patch) | |
tree | 85fb90f006ca7d141e98b0b65f390b03c7973f75 /src/test/java/com/google/devtools/common | |
parent | 4c2c4284b6f72adf9042d3e9e24dde46c32d16e2 (diff) |
Don't hard remove --no_, give a warning first.
PiperOrigin-RevId: 153610163
Diffstat (limited to 'src/test/java/com/google/devtools/common')
-rw-r--r-- | src/test/java/com/google/devtools/common/options/OptionsParserTest.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/test/java/com/google/devtools/common/options/OptionsParserTest.java b/src/test/java/com/google/devtools/common/options/OptionsParserTest.java index 3d85315258..5b79dab689 100644 --- a/src/test/java/com/google/devtools/common/options/OptionsParserTest.java +++ b/src/test/java/com/google/devtools/common/options/OptionsParserTest.java @@ -1583,16 +1583,16 @@ public class OptionsParserTest { } @Test - public void testBooleanUnderscorePrefixError() { - try { - OptionsParser parser = newOptionsParser(ExampleBooleanFooOptions.class); - parser.parse("--no_foo"); + public void testBooleanUnderscorePrefixError() throws OptionsParsingException { + OptionsParser parser = newOptionsParser(ExampleBooleanFooOptions.class); + parser.parse("--no_foo"); + ExampleBooleanFooOptions result = parser.getOptions(ExampleBooleanFooOptions.class); + assertThat(result.foo).isFalse(); + List<String> warning = parser.getWarnings(); + assertThat(warning).hasSize(1); + assertThat(warning.get(0)).contains("Option 'foo' is specified using the deprecated " + + "--no_ prefix. Use --no without the underscore instead"); - fail("--no_foo should fail to parse and provide a nice error message."); - } catch (OptionsParsingException e) { - assertThat(e.getMessage()).contains( - "'no_' prefixes are no longer accepted, --no<flag> is an accepted alternative."); - } } public static class WrapperOptionExample extends OptionsBase { |