aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/common/options/OptionsDataTest.java
diff options
context:
space:
mode:
authorGravatar ccalvarin <ccalvarin@google.com>2017-08-31 06:32:03 +0200
committerGravatar Vladimir Moskva <vladmos@google.com>2017-08-31 13:45:42 +0200
commit3e44d5b0de694632ac802c81838063d7f8563998 (patch)
tree2febcd4f2fe3c4dc3fd62fc91ce5ea84c3fc0f64 /src/test/java/com/google/devtools/common/options/OptionsDataTest.java
parent618a2bf3574015d1d341d59a34e4d0bf285ad5bf (diff)
Move static converter legality checks to compile time.
The information about whether a converter correctly matches the type of option it is meant to convert strings to is available at compile time. There is no reason to do this check at runtime. Now, for an option to compile, it will need to have a converter that matches the option's type, taking into account whether the option is expected to accumulate multiple values. If it does not specify its own converter, a matching converter in the Converters.DEFAULT_CONVERTER list must be found, and the default value provided must be parseable by the matching default converter. Remove tests that were testing failure modes which no longer compile. RELNOTES: None. PiperOrigin-RevId: 167092773
Diffstat (limited to 'src/test/java/com/google/devtools/common/options/OptionsDataTest.java')
-rw-r--r--src/test/java/com/google/devtools/common/options/OptionsDataTest.java32
1 files changed, 0 insertions, 32 deletions
diff --git a/src/test/java/com/google/devtools/common/options/OptionsDataTest.java b/src/test/java/com/google/devtools/common/options/OptionsDataTest.java
index 1266d2e25d..5a8534f8fd 100644
--- a/src/test/java/com/google/devtools/common/options/OptionsDataTest.java
+++ b/src/test/java/com/google/devtools/common/options/OptionsDataTest.java
@@ -416,38 +416,6 @@ public class OptionsDataTest {
}
/** Dummy options class. */
- public static class InvalidExpansionOptions extends OptionsBase {
- @Option(
- name = "foo",
- documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
- effectTags = {OptionEffectTag.NO_OP},
- defaultValue = "1"
- )
- public int foo;
-
- @Option(
- name = "bar",
- documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
- effectTags = {OptionEffectTag.NO_OP},
- defaultValue = "1",
- expansion = {"--foo=42"}
- )
- public int bar;
- }
-
- @Test
- public void staticExpansionOptionsShouldNotHaveValues() {
- try {
- construct(InvalidExpansionOptions.class);
- fail();
- } catch (ConstructionException e) {
- // Expected exception
- assertThat(e).hasMessageThat().contains(
- "Option bar is an expansion flag with a static expansion, but does not have Void type.");
- }
- }
-
- /** Dummy options class. */
public static class ValidExpansionOptions extends OptionsBase {
@Option(
name = "foo",