Skip to content

Commit

Permalink
Automatic code cleanup.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 246137781
  • Loading branch information
cpovirk authored and Copybara-Service committed May 1, 2019
1 parent 42edea6 commit c724f5e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
Expand Up @@ -105,7 +105,7 @@ public void testFetching() throws Exception {
.isEqualTo("fizz buzz");
assertThat(a2.getPath().isExecutable()).isTrue();
assertThat(actionInputFetcher.downloadedFiles()).hasSize(2);
assertThat(actionInputFetcher.downloadedFiles()).containsAllOf(a1.getPath(), a2.getPath());
assertThat(actionInputFetcher.downloadedFiles()).containsAtLeast(a1.getPath(), a2.getPath());
assertThat(actionInputFetcher.downloadsInProgress).isEmpty();
}

Expand Down
Expand Up @@ -268,7 +268,7 @@ public void testFilesToBuildWithSaveFeatureState() throws Exception {
Artifact archive = getBinArtifact("libhello.a", hello);
assertThat(getFilesToBuild(hello)).containsExactly(archive);
assertThat(ActionsTestUtil.baseArtifactNames(getOutputGroup(hello, OutputGroupInfo.DEFAULT)))
.containsAllOf("enabled_features.txt", "requested_features.txt");
.containsAtLeast("enabled_features.txt", "requested_features.txt");
}

@Test
Expand Down
Expand Up @@ -608,7 +608,7 @@ public void testCompileBuildVariablesWithSourceFile() throws Exception {
"cc_toolchain = toolchain,",
"source_file = 'foo/bar/hello'",
")"))
.containsAllOf("-c", "foo/bar/hello")
.containsAtLeast("-c", "foo/bar/hello")
.inOrder();
}

Expand All @@ -622,7 +622,7 @@ public void testCompileBuildVariablesWithOutputFile() throws Exception {
"cc_toolchain = toolchain,",
"output_file = 'foo/bar/hello.o'",
")"))
.containsAllOf("-o", "foo/bar/hello.o")
.containsAtLeast("-o", "foo/bar/hello.o")
.inOrder();
}

Expand Down Expand Up @@ -731,7 +731,7 @@ public void testLibrarySearchDirectoriesLinkVariables() throws Exception {
"cc_toolchain = toolchain,",
"library_search_directories = depset([ 'a', 'b', 'c' ]),",
")"))
.containsAllOf("--library=a", "--library=b", "--library=c")
.containsAtLeast("--library=a", "--library=b", "--library=c")
.inOrder();
}

Expand All @@ -751,7 +751,7 @@ public void testRuntimeLibrarySearchDirectoriesLinkVariables() throws Exception
"cc_toolchain = toolchain,",
"runtime_library_search_directories = depset([ 'a', 'b', 'c' ]),",
")"))
.containsAllOf("--runtime_library=a", "--runtime_library=b", "--runtime_library=c")
.containsAtLeast("--runtime_library=a", "--runtime_library=b", "--runtime_library=c")
.inOrder();
}

Expand Down Expand Up @@ -1046,17 +1046,17 @@ public void testCcCompilationProvider() throws Exception {
mergedHeaders.stream()
.map(Artifact::getFilename)
.collect(ImmutableList.toImmutableList()))
.containsAllOf("header.h", "dep1.h", "dep2.h");
.containsAtLeast("header.h", "dep1.h", "dep2.h");

List<String> mergedDefines =
((SkylarkNestedSet) myInfo.getValue("merged_defines")).getSet(String.class).toList();
assertThat(mergedDefines).containsAllOf("MYDEFINE", "DEP1", "DEP2");
assertThat(mergedDefines).containsAtLeast("MYDEFINE", "DEP1", "DEP2");

List<String> mergedSystemIncludes =
((SkylarkNestedSet) myInfo.getValue("merged_system_includes"))
.getSet(String.class)
.toList();
assertThat(mergedSystemIncludes).containsAllOf("foo/bar", "a/dep1/baz", "a/dep2/qux");
assertThat(mergedSystemIncludes).containsAtLeast("foo/bar", "a/dep1/baz", "a/dep2/qux");

List<String> mergedIncludes =
((SkylarkNestedSet) myInfo.getValue("merged_includes")).getSet(String.class).toList();
Expand Down Expand Up @@ -4277,12 +4277,12 @@ public void testCcToolchainInfoFromSkylarkWithLegacyFeatures() throws Exception
// legacy_compile_flags should appear first in the list of features, followed by
// default_compile_flags.
assertThat(featureNames)
.containsAllOf(
.containsAtLeast(
"legacy_compile_flags", "default_compile_flags", "custom_feature", "fdo_optimize")
.inOrder();
// assemble is one of the action_configs added as a legacy behavior, therefore it needs to be
// prepended to the action configs defined by the user.
assertThat(actionConfigNames).containsAllOf("assemble", "custom-action").inOrder();
assertThat(actionConfigNames).containsAtLeast("assemble", "custom-action").inOrder();
}

@Test
Expand Down Expand Up @@ -4798,7 +4798,7 @@ public void testIncludeDirs() throws Exception {
assertThat(target).isNotNull();
CppCompileAction action =
(CppCompileAction) getGeneratingAction(artifactByPath(getFilesToBuild(target), ".o"));
assertThat(action.getArguments()).containsAllOf("-Ifoo/bar", "-Ibaz/qux");
assertThat(action.getArguments()).containsAtLeast("-Ifoo/bar", "-Ibaz/qux");
}

@Test
Expand All @@ -4810,7 +4810,7 @@ public void testSystemIncludeDirs() throws Exception {
CppCompileAction action =
(CppCompileAction) getGeneratingAction(artifactByPath(getFilesToBuild(target), ".o"));
assertThat(action.getArguments())
.containsAllOf("-isystem", "foo/bar", "-isystem", "baz/qux")
.containsAtLeast("-isystem", "foo/bar", "-isystem", "baz/qux")
.inOrder();
}

Expand All @@ -4823,7 +4823,7 @@ public void testQuoteIncludeDirs() throws Exception {
CppCompileAction action =
(CppCompileAction) getGeneratingAction(artifactByPath(getFilesToBuild(target), ".o"));
assertThat(action.getArguments())
.containsAllOf("-iquote", "foo/bar", "-iquote", "baz/qux")
.containsAtLeast("-iquote", "foo/bar", "-iquote", "baz/qux")
.inOrder();
}

Expand All @@ -4835,7 +4835,7 @@ public void testDefines() throws Exception {
assertThat(target).isNotNull();
CppCompileAction action =
(CppCompileAction) getGeneratingAction(artifactByPath(getFilesToBuild(target), ".o"));
assertThat(action.getArguments()).containsAllOf("-DDEFINE1", "-DDEFINE2");
assertThat(action.getArguments()).containsAtLeast("-DDEFINE1", "-DDEFINE2");
}

@Test
Expand All @@ -4846,7 +4846,8 @@ public void testHeaders() throws Exception {
assertThat(target).isNotNull();
CcInfo ccInfo = target.get(CcInfo.PROVIDER);
assertThat(artifactsToStrings(ccInfo.getCcCompilationContext().getDeclaredIncludeSrcs()))
.containsAllOf("src foo/dep2.h", "src foo/skylark_lib.h", "src foo/private_skylark_lib.h");
.containsAtLeast(
"src foo/dep2.h", "src foo/skylark_lib.h", "src foo/private_skylark_lib.h");
}

@Test
Expand All @@ -4867,7 +4868,7 @@ public void testCompilationContexts() throws Exception {
ConfiguredTarget target = getConfiguredTarget("//foo:skylark_lib");
CppCompileAction action =
(CppCompileAction) getGeneratingAction(artifactByPath(getFilesToBuild(target), ".o"));
assertThat(action.getArguments()).containsAllOf("-DDEFINE_DEP1", "-DDEFINE_DEP2");
assertThat(action.getArguments()).containsAtLeast("-DDEFINE_DEP1", "-DDEFINE_DEP2");
}

@Test
Expand Down Expand Up @@ -4902,7 +4903,7 @@ public void testLinkingContexts() throws Exception {
ConfiguredTarget target = getConfiguredTarget("//foo:bin");
CppLinkAction action =
(CppLinkAction) getGeneratingAction(artifactByPath(getFilesToBuild(target), "bin"));
assertThat(action.getArguments()).containsAllOf("-DEP1_LINKOPT", "-DEP2_LINKOPT");
assertThat(action.getArguments()).containsAtLeast("-DEP1_LINKOPT", "-DEP2_LINKOPT");
}

@Test
Expand Down
Expand Up @@ -167,7 +167,7 @@ public void testWatchSimulatorDepCompile() throws Exception {
getGeneratingAction(getFirstArtifactEndingWith(linkAction.getInputs(), "libobjcLib.a"));

assertAppleSdkPlatformEnv(objcLibCompileAction, "WatchSimulator");
assertThat(objcLibCompileAction.getArguments()).containsAllOf("-arch_only", "i386").inOrder();
assertThat(objcLibCompileAction.getArguments()).containsAtLeast("-arch_only", "i386").inOrder();
}

@Test
Expand Down Expand Up @@ -222,7 +222,7 @@ public void testWatchSimulatorLipoAction() throws Exception {

assertContainsSublist(action.getArguments(), ImmutableList.of(
MOCK_XCRUNWRAPPER_EXECUTABLE_PATH, LIPO, "-create"));
assertThat(action.getArguments()).containsAllOf(armv7kBin, i386Bin);
assertThat(action.getArguments()).containsAtLeast(armv7kBin, i386Bin);
assertContainsSublist(action.getArguments(), ImmutableList.of(
"-o", execPathEndingWith(action.getOutputs(), "x_lipo.a")));

Expand Down Expand Up @@ -447,7 +447,7 @@ public void testWatchSimulatorLinkAction() throws Exception {

assertAppleSdkPlatformEnv(linkAction, "WatchSimulator");
assertThat(normalizeBashArgs(linkAction.getArguments()))
.containsAllOf("-arch_only", "i386")
.containsAtLeast("-arch_only", "i386")
.inOrder();
}

Expand Down Expand Up @@ -484,8 +484,8 @@ public void testAvoidDepsObjects() throws Exception {
"objc_library(name = 'avoidLib', srcs = [ 'c.m' ])");

CommandAction action = linkLibAction("//package:test");
assertThat(Artifact.toRootRelativePaths(action.getInputs())).containsAllOf(
"package/libobjcLib.a", "package/libbaseLib.a");
assertThat(Artifact.toRootRelativePaths(action.getInputs()))
.containsAtLeast("package/libobjcLib.a", "package/libbaseLib.a");
assertThat(Artifact.toRootRelativePaths(action.getInputs())).doesNotContain(
"package/libavoidLib.a");
}
Expand Down
Expand Up @@ -1091,7 +1091,7 @@ public void testSkylarkCanAccessSdkFrameworks() throws Exception {

SkylarkNestedSet sdkFrameworks =
(SkylarkNestedSet) getMyInfoFromTarget(skylarkTarget).getValue("sdk_frameworks");
assertThat(sdkFrameworks.toCollection()).containsAllOf("Accelerate", "GLKit");
assertThat(sdkFrameworks.toCollection()).containsAtLeast("Accelerate", "GLKit");
}

@Test
Expand Down

0 comments on commit c724f5e

Please sign in to comment.