From 6c2519a204d62b704c98ba8e8e9f29c3ca0bcff6 Mon Sep 17 00:00:00 2001 From: Dave Shuckerow Date: Fri, 7 Jun 2019 13:29:43 -0700 Subject: [PATCH 1/2] Make the launch commands test work again. --- .../run/bazelTest/LaunchCommandsTest.java | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/testSrc/unit/io/flutter/run/bazelTest/LaunchCommandsTest.java b/testSrc/unit/io/flutter/run/bazelTest/LaunchCommandsTest.java index b25b2b5cfb..2ed803925c 100644 --- a/testSrc/unit/io/flutter/run/bazelTest/LaunchCommandsTest.java +++ b/testSrc/unit/io/flutter/run/bazelTest/LaunchCommandsTest.java @@ -131,6 +131,7 @@ public void producesCorrectCommandLineForBazelTargetWithoutTestScript() throws E final List expectedCommandLine = new ArrayList<>(); expectedCommandLine.add("/workspace/scripts/launch.sh"); + expectedCommandLine.add("--no-color"); expectedCommandLine.add("//foo:test"); assertThat(launchCommand.getCommandLineList(null), equalTo(expectedCommandLine)); } @@ -150,6 +151,7 @@ public void producesCorrectCommandLineForBazelTargetWithoutTestScriptInDebugMode final List expectedCommandLine = new ArrayList<>(); expectedCommandLine.add("/workspace/scripts/launch.sh"); + expectedCommandLine.add("--no-color"); expectedCommandLine.add("//foo:test"); expectedCommandLine.add("--"); expectedCommandLine.add("--enable-debugging"); @@ -198,6 +200,28 @@ public void failsForTestNameWithoutTestScript() { assertTrue("This test method expected to throw an exception, but did not.", didThrow); } + @Test + public void failsForTestNameAndBazelTargetWithoutTestScript() throws ExecutionException { + final BazelTestFields fields = new FakeBazelTestFields( + new BazelTestFields(null, "/workspace/foo/test/foo_test.dart", "//foo:test", "--ignored-args"), + "scripts/daemon.sh", + "scripts/doctor.sh", + "scripts/launch.sh", + null, + null, + null + ); + + boolean didThrow = false; + try { + final GeneralCommandLine launchCommand = fields.getLaunchCommand(projectFixture.getProject(), RunMode.RUN); + } + catch (ExecutionException e) { + didThrow = true; + } + assertTrue("This test method expected to throw an exception, but did not.", didThrow); + } + @Test public void runsInFileModeWhenBothFileAndBazelTargetAreProvided() throws ExecutionException { final BazelTestFields fields = new FakeBazelTestFields( @@ -215,25 +239,6 @@ public void runsInFileModeWhenBothFileAndBazelTargetAreProvided() throws Executi assertThat(launchCommand.getCommandLineList(null), equalTo(expectedCommandLine)); } - @Test - public void runsInBazelTargetModeWhenBothFileAndBazelTargetAreProvidedWithoutTestScript() throws ExecutionException { - final BazelTestFields fields = new FakeBazelTestFields( - new BazelTestFields(null, "/workspace/foo/test/foo_test.dart", "//foo:test", "--ignored-args"), - "scripts/daemon.sh", - "scripts/doctor.sh", - "scripts/launch.sh", - null, - null, - null - ); - final GeneralCommandLine launchCommand = fields.getLaunchCommand(projectFixture.getProject(), RunMode.RUN); - - final List expectedCommandLine = new ArrayList<>(); - expectedCommandLine.add("/workspace/scripts/launch.sh"); - expectedCommandLine.add("//foo:test"); - assertThat(launchCommand.getCommandLineList(null), equalTo(expectedCommandLine)); - } - private FakeBazelTestFields forFile(String file) { return new FakeBazelTestFields(BazelTestFields.forFile(file, null)); } From cdbbbf032064940af05caaebd241c5b8cd15c844 Mon Sep 17 00:00:00 2001 From: Dave Shuckerow Date: Fri, 7 Jun 2019 13:48:37 -0700 Subject: [PATCH 2/2] Remove exclusion of bazel tests from build.gradel --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0e79e49153..a3d36ce25b 100644 --- a/build.gradle +++ b/build.gradle @@ -83,7 +83,6 @@ sourceSets { } test { -// exclude "io/flutter/run/bazelTest/LaunchCommandsTest.class" // exclude "io/flutter/utils/EventStreamTest.class" ignoreFailures true }