Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ sourceSets {
}

test {
// exclude "io/flutter/run/bazelTest/LaunchCommandsTest.class"
// exclude "io/flutter/utils/EventStreamTest.class"
ignoreFailures true
}
Expand Down
43 changes: 24 additions & 19 deletions testSrc/unit/io/flutter/run/bazelTest/LaunchCommandsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void producesCorrectCommandLineForBazelTargetWithoutTestScript() throws E

final List<String> expectedCommandLine = new ArrayList<>();
expectedCommandLine.add("/workspace/scripts/launch.sh");
expectedCommandLine.add("--no-color");
expectedCommandLine.add("//foo:test");
assertThat(launchCommand.getCommandLineList(null), equalTo(expectedCommandLine));
}
Expand All @@ -150,6 +151,7 @@ public void producesCorrectCommandLineForBazelTargetWithoutTestScriptInDebugMode

final List<String> expectedCommandLine = new ArrayList<>();
expectedCommandLine.add("/workspace/scripts/launch.sh");
expectedCommandLine.add("--no-color");
expectedCommandLine.add("//foo:test");
expectedCommandLine.add("--");
expectedCommandLine.add("--enable-debugging");
Expand Down Expand Up @@ -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(
Expand All @@ -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<String> 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));
}
Expand Down