Search in sources :

Example 6 with TargetDevice

use of com.facebook.buck.step.TargetDevice in project buck by facebook.

the class JavaTestRuleTest method shouldAddEmulatorTargetDeviceToVmArgsIfPresent.

@Test
public void shouldAddEmulatorTargetDeviceToVmArgsIfPresent() throws Exception {
    ImmutableList<String> vmArgs = ImmutableList.of("--one");
    JavaTest rule = newRule(vmArgs);
    TargetDevice device = new TargetDevice(TargetDevice.Type.EMULATOR, Optional.empty());
    ImmutableList<String> amended = rule.amendVmArgs(vmArgs, createMock(SourcePathResolver.class), Optional.of(device));
    ImmutableList<String> expected = ImmutableList.of("--one", "-Dbuck.device=emulator");
    assertEquals(expected, amended);
}
Also used : SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) TargetDevice(com.facebook.buck.step.TargetDevice) Test(org.junit.Test)

Example 7 with TargetDevice

use of com.facebook.buck.step.TargetDevice in project buck by facebook.

the class TargetDeviceCommandLineOptionsTest method shouldReturnADeviceIfOnlyDeviceFlagSet.

@Test
public void shouldReturnADeviceIfOnlyDeviceFlagSet() {
    TargetDeviceCommandLineOptions options = buildOptions("-d");
    TargetDevice device = options.getTargetDeviceOptional().get();
    assertFalse(device.isEmulator());
    assertFalse(device.getIdentifier().isPresent());
}
Also used : TargetDevice(com.facebook.buck.step.TargetDevice) Test(org.junit.Test)

Aggregations

TargetDevice (com.facebook.buck.step.TargetDevice)7 Test (org.junit.Test)7 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)3 CmdLineException (org.kohsuke.args4j.CmdLineException)1 CmdLineParser (org.kohsuke.args4j.CmdLineParser)1