use of com.facebook.buck.versions.FixedTargetNodeTranslator in project buck by facebook.
the class NeededCoverageSpecTest method translatedTargets.
@Test
public void translatedTargets() {
BuildTarget target = BuildTargetFactory.newInstance("//:rule");
BuildTarget newTarget = BuildTargetFactory.newInstance("//something:else");
TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of(target, newTarget));
NeededCoverageSpec spec = NeededCoverageSpec.of(1.0f, target, Optional.empty());
assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, spec), Matchers.equalTo(Optional.of(spec.withBuildTarget(newTarget))));
}
use of com.facebook.buck.versions.FixedTargetNodeTranslator in project buck by facebook.
the class SourceListTest method untranslatedUnnamedSourcesTargets.
@Test
public void untranslatedUnnamedSourcesTargets() {
BuildTarget target = BuildTargetFactory.newInstance("//:rule");
TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of());
SourceList list = SourceList.ofUnnamedSources(ImmutableSortedSet.of(new DefaultBuildTargetSourcePath(target)));
assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, list), Matchers.equalTo(Optional.empty()));
}
use of com.facebook.buck.versions.FixedTargetNodeTranslator in project buck by facebook.
the class SourceListTest method translatedUnnamedSourcesTargets.
@Test
public void translatedUnnamedSourcesTargets() {
BuildTarget target = BuildTargetFactory.newInstance("//:rule");
BuildTarget newTarget = BuildTargetFactory.newInstance("//something:else");
TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of(target, newTarget));
assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, SourceList.ofUnnamedSources(ImmutableSortedSet.of(new DefaultBuildTargetSourcePath(target)))), Matchers.equalTo(Optional.of(SourceList.ofUnnamedSources(ImmutableSortedSet.of(new DefaultBuildTargetSourcePath(newTarget))))));
}
use of com.facebook.buck.versions.FixedTargetNodeTranslator in project buck by facebook.
the class SourceListTest method untranslatedNamedSourcesTargets.
@Test
public void untranslatedNamedSourcesTargets() {
BuildTarget target = BuildTargetFactory.newInstance("//:rule");
TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of());
SourceList list = SourceList.ofNamedSources(ImmutableSortedMap.of("name", new DefaultBuildTargetSourcePath(target)));
assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, list), Matchers.equalTo(Optional.empty()));
}
use of com.facebook.buck.versions.FixedTargetNodeTranslator in project buck by facebook.
the class PatternMatchedCollectionTest method translatedTargets.
@Test
public void translatedTargets() {
BuildTarget target = BuildTargetFactory.newInstance("//:rule");
BuildTarget newTarget = BuildTargetFactory.newInstance("//something:else");
TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of(target, newTarget));
PatternMatchedCollection<BuildTarget> collection = PatternMatchedCollection.<BuildTarget>builder().add(Pattern.compile("something"), target).build();
assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, collection).map(PatternMatchedCollection::getValues), Matchers.equalTo(Optional.of(ImmutableList.of(newTarget))));
}
Aggregations