aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/runtime/BlazeOptionHandlerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/runtime/BlazeOptionHandlerTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/runtime/BlazeOptionHandlerTest.java44
1 files changed, 38 insertions, 6 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/runtime/BlazeOptionHandlerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/BlazeOptionHandlerTest.java
index 567499ca7d..d9454bcbbd 100644
--- a/src/test/java/com/google/devtools/build/lib/runtime/BlazeOptionHandlerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/runtime/BlazeOptionHandlerTest.java
@@ -450,15 +450,47 @@ public class BlazeOptionHandlerTest {
public void testExpandConfigOptions_withConfigForUnapplicableCommand_fixedPoint()
throws Exception {
makeFixedPointExpandingConfigOptionHandler();
+ try {
testExpandConfigOptions_withConfigForUnapplicableCommand();
+ fail();
+ } catch (OptionsParsingException e) {
+ assertThat(e)
+ .hasMessageThat()
+ .contains("Config values are not defined in any .rc file: other");
+ }
+ }
+
+ @Test
+ public void testExpandConfigOptions_withConfigForUnapplicableCommand_inPlace() throws Exception {
+ makeInPlaceExpandingConfigOptionHandler();
+ try {
+ testExpandConfigOptions_withConfigForUnapplicableCommand();
+ fail();
+ } catch (OptionsParsingException e) {
+ assertThat(e).hasMessageThat().contains("Config value other is not defined in any .rc file");
+ }
+ }
+
+ private void testExpandConfigOptions_withConfigForUnapplicableCommand_allowUndefined()
+ throws Exception {
+ parser.parse("--config=other", "--allow_undefined_configs");
+ optionHandler.expandConfigOptions(eventHandler, structuredArgsFrom2SimpleRcsWithOnlyResidue());
+ }
+
+ @Test
+ public void testExpandConfigOptions_withConfigForUnapplicableCommand_allowUndefined_fixedPoint()
+ throws Exception {
+ makeFixedPointExpandingConfigOptionHandler();
+ testExpandConfigOptions_withConfigForUnapplicableCommand_allowUndefined();
assertThat(eventHandler.getEvents())
.contains(Event.warn("Config values are not defined in any .rc file: other"));
}
@Test
- public void testExpandConfigOptions_withConfigForUnapplicableCommand_inPlace() throws Exception {
+ public void testExpandConfigOptions_withConfigForUnapplicableCommand_allowUndefined_inPlace()
+ throws Exception {
makeInPlaceExpandingConfigOptionHandler();
- testExpandConfigOptions_withConfigForUnapplicableCommand();
+ testExpandConfigOptions_withConfigForUnapplicableCommand_allowUndefined();
assertThat(eventHandler.getEvents())
.contains(Event.warn("Config value other is not defined in any .rc file"));
}
@@ -486,8 +518,8 @@ public class BlazeOptionHandlerTest {
.contains(Event.warn("Config value invalid is not defined in any .rc file"));
}
- private void testNoAllowUndefinedConfig() throws OptionsParsingException {
- parser.parse("--config=invalid", "--noallow_undefined_configs");
+ private void testUndefinedConfig() throws OptionsParsingException {
+ parser.parse("--config=invalid");
optionHandler.expandConfigOptions(eventHandler, ArrayListMultimap.create());
}
@@ -495,7 +527,7 @@ public class BlazeOptionHandlerTest {
public void testNoAllowUndefinedConfig_fixedPoint() {
makeFixedPointExpandingConfigOptionHandler();
try {
- testNoAllowUndefinedConfig();
+ testUndefinedConfig();
fail();
} catch (OptionsParsingException e) {
assertThat(e)
@@ -508,7 +540,7 @@ public class BlazeOptionHandlerTest {
public void testNoAllowUndefinedConfig_inPlace() {
makeInPlaceExpandingConfigOptionHandler();
try {
- testNoAllowUndefinedConfig();
+ testUndefinedConfig();
fail();
} catch (OptionsParsingException e) {
assertThat(e)