Skip to content

Commit

Permalink
Fix typos in tests.
Browse files Browse the repository at this point in the history
Closes #16425.

PiperOrigin-RevId: 484171015
Change-Id: Ie5a5a29574f5c5d786f385b803cbe3d25e13929c
  • Loading branch information
xiaoxq authored and copybara-github committed Oct 27, 2022
1 parent 89d7702 commit 7c0bdc2
Show file tree
Hide file tree
Showing 61 changed files with 94 additions and 94 deletions.
2 changes: 1 addition & 1 deletion src/test/cpp/rc_options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class RcOptionsTest : public ::testing::Test {

// Test that exactly each command in the expected map was in the results,
// and that for each of these, exactly the expected args are found, in the
// correct order. Note that this is not just an exercise in rewritting map
// correct order. Note that this is not just an exercise in rewriting map
// equality - the results have type RcOption, and the expected values
// are just strings. This is ignoring the source_path for convenience.
const RcFile::OptionMap& result = rc->options();
Expand Down
4 changes: 2 additions & 2 deletions src/test/cpp/util/strings_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ TEST(BlazeUtil, Tokenize) {
}

static vector<string> SplitQuoted(const string &contents,
const char delimeter) {
const char delimiter) {
vector<string> result;
SplitQuotedStringUsing(contents, delimeter, &result);
SplitQuotedStringUsing(contents, delimiter, &result);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void testJunctionCaching() throws Exception {
assertThat(file2juncActual.toFile().exists()).isTrue();
assertThat(file3juncActual.toFile().exists()).isTrue();

// Assert that the junctions were chached.
// Assert that the junctions were cached.
// Cast Path to Object to disambiguate which assertThat-overload to use.
assertThat((Object) dir1juncActual).isEqualTo(junc0);
assertThat((Object) dir2juncActual).isEqualTo(junc1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ public void cachedMappings_sharedAcrossDirOverrides() {
SingleRunfilesSupplier original =
SingleRunfilesSupplier.createCaching(
oldDir, runfiles, /*buildRunfileLinks=*/ false, /*runfileLinksEnabled=*/ false);
SingleRunfilesSupplier overriden = original.withOverriddenRunfilesDir(newDir);
SingleRunfilesSupplier overridden = original.withOverriddenRunfilesDir(newDir);

Map<PathFragment, Map<PathFragment, Artifact>> mappingsOld = original.getMappings();
Map<PathFragment, Map<PathFragment, Artifact>> mappingsNew = overriden.getMappings();
Map<PathFragment, Map<PathFragment, Artifact>> mappingsNew = overridden.getMappings();

assertThat(mappingsOld).containsExactly(oldDir, runfiles.getRunfilesInputs(null, null));
assertThat(mappingsNew).containsExactly(newDir, runfiles.getRunfilesInputs(null, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ public void testInvalidNativeOptionOutput() throws Exception {

@Test
public void testBannedNativeOptionOutput() throws Exception {
// Just picked an arbirtary incompatible_ flag; however, could be any flag
// Just picked an arbitrary incompatible_ flag; however, could be any flag
// besides incompatible_enable_cc_toolchain_resolution (and might not even need to be real).
writeAllowlistFile();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void testGetReachableLabels() throws Exception {
assertThat(mapper.getReachableLabels("srcs", false)).containsExactlyElementsIn(valueLabels);
}

/** Custom rule to support testing over default valuess. */
/** Custom rule to support testing over default values. */
public static final class RuleWithDefaults
implements RuleDefinition, RuleConfiguredTargetFactory {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@
*/
public interface MockRule extends RuleDefinition {
// MockRule is designed to be easy to use. That doesn't necessarily mean its implementation is
// easy to undestand.
// easy to understand.
//
// If you just want to mock a rule, it's best to rely on the interface javadoc above, rather than
// trying to parse what's going on below. You really only need to understand the below if you want
// to customize MockRule itself.

/**
* Container for the desired name and custom settings for this rule class.
*/
/** Container for the desired name and custom settings for this rule class. */
class State {
private final String name;
private final MockRuleCustomBehavior customBehavior;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,13 +968,14 @@ public ConfiguredAspect create(
.add(attr("foo", LABEL_LIST).allowedFileTypes(FileTypeSet.ANY_FILE))
.advertiseProvider(RequiredProvider2.class));

/**
* Rule with an implcit dependency.
*/
public static final MockRule IMPLICIT_DEP_RULE = () ->
MockRule.ancestor(BASE_RULE.getClass()).factory(DummyRuleFactory.class).define(
"implicit_dep",
attr("$dep", LABEL).value(Label.parseAbsoluteUnchecked("//extra:extra")));
/** Rule with an implicit dependency. */
public static final MockRule IMPLICIT_DEP_RULE =
() ->
MockRule.ancestor(BASE_RULE.getClass())
.factory(DummyRuleFactory.class)
.define(
"implicit_dep",
attr("$dep", LABEL).value(Label.parseAbsoluteUnchecked("//extra:extra")));

// TODO(b/65746853): provide a way to do this without passing the entire configuration
private static final LabelListLateBoundDefault<?> PLUGINS_LABEL_LIST =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testPutCacheValue() throws Exception {
}

/**
* Test that the put mehtod without cache key correctly stores the downloaded file into the cache.
* Test that the put method without cache key correctly stores the downloaded file into the cache.
*/
@Test
public void testPutCacheValueWithoutHash() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void testHeaderComputationFunction() throws Exception {
Function<URL, ImmutableMap<String, List<String>>> headerFunction =
HttpConnectorMultiplexer.getHeaderFunction(baseHeaders, additionalHeaders);

// Unreleated URL
// Unrelated URL
assertThat(headerFunction.apply(new URL("http://example.org/some/path/file.txt")))
.containsExactly(
"Accept-Encoding",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void testCreatesFileAndWritesProtoJsonFormat() throws Exception {
/**
* A thin wrapper around an OutputStream that counts number of bytes written and verifies flushes.
*
* <p>The methods below need to be syncrhonized because they override methods from {@link
* <p>The methods below need to be synchronized because they override methods from {@link
* BufferedOutputStream} *not* because there's a concurrent access to the stream.
*/
private static final class WrappedOutputStream extends BufferedOutputStream {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void testInterrupt() throws Exception {
invocationLatch.await();
testThread.interrupt();

// Verify that the thread is interruptable (unit test will time out if it's not interruptable).
// Verify that the thread is interruptible (unit test will time out if it's not interruptible).
testThread.join();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void testMultipleDescriptionFilter() throws Exception {
}

/**
* This demostrate that the latter description filter overrides preceding one of same regexp.
* This demonstrate that the latter description filter overrides preceding one of same regexp.
* filter=val_1 filter=val_2 is equivalent to filter=val_2
*/
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void testCreateRule() throws Exception {
assertThat(rule.getRuleClass()).isEqualTo("cc_library");
assertThat(rule.getTargetKind()).isEqualTo("cc_library rule");
// The rule reports the location of the outermost call (aka generator), in the BUILD file.
// Thie behavior was added to fix b/23974287, but it loses informtion and is redundant
// This behavior was added to fix b/23974287, but it loses information and is redundant
// w.r.t. generator_location. A better fix to that issue would be to keep rule.location as
// the innermost call, and to report the entire call stack at the first error for the rule.
assertThat(rule.getLocation().file()).isEqualTo("BUILD");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private MockProtoSupport() {
throw new UnsupportedOperationException();
}

/** This is workarround for tests that do not use {@code Scratch} (e.g. aquery-tests). */
/** This is workaround for tests that do not use {@code Scratch} (e.g. aquery-tests). */
public static final String MIGRATION_TAG =
String.format("tags = ['%s'],", ProtoCommon.PROTO_RULES_MIGRATION_LABEL);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void singleChunkCompressedUploadAlreadyExists() throws Exception {

byte[] blob = {'A'};

// Set a chunk size that should have no problem accomodating the compressed
// Set a chunk size that should have no problem accommodating the compressed
// blob, even though the blob most likely has a compression ratio >= 1.
Chunker chunker =
Chunker.builder().setInput(blob).setCompressed(true).setChunkSize(100).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public void nonCachableSpawnsShouldNotBeCached_localFallback() throws Exception

@Test
public void cachableSpawnsShouldBeCached_localFallback() throws Exception {
// Test that if a cachable spawn is executed locally due to the local fallback,
// Test that if a cacheable spawn is executed locally due to the local fallback,
// that its result is uploaded to the remote cache.

remoteOptions.remoteAcceptCached = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ protected Artifact getLibraryManifest(ConfiguredTarget target) throws Exception
return null;
}

// Returns an artifact that will be generated when a rule has assets that are processed seperately
// Returns an artifact that will be generated when a rule has assets that are processed separately
static Artifact getDecoupledAssetArtifact(ConfiguredTarget target) {
return target.get(AndroidAssetsInfo.PROVIDER).getValidationResult();
}
Expand Down Expand Up @@ -507,7 +507,7 @@ protected void checkProguardUse(
.isNotNull();
SpawnAction proOptimization = getGeneratingSpawnAction(preoptimizationOutput);

// Verify intitial step.
// Verify initial step.
assertThat(proOptimization.getArguments()).contains("-runtype INITIAL");
checkProguardLibJars(proOptimization, expectedlibraryJars);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1514,15 +1514,15 @@ private void assertXcodeVersion(String version, String providerTargetLabel) thro
assertThat(provider.getXcodeVersion()).isEqualTo(DottedVersion.fromString(version));
}

private void assertAvailability(XcodeConfigInfo.Availability availabilty) throws Exception {
assertAvailability(availabilty, "//xcode:foo");
private void assertAvailability(XcodeConfigInfo.Availability availability) throws Exception {
assertAvailability(availability, "//xcode:foo");
}

private void assertAvailability(
XcodeConfigInfo.Availability availabilty, String providerTargetLabel) throws Exception {
XcodeConfigInfo.Availability availability, String providerTargetLabel) throws Exception {
ConfiguredTarget xcodeConfig = getConfiguredTarget(providerTargetLabel);
XcodeConfigInfo provider = xcodeConfig.get(XcodeConfigInfo.PROVIDER);
assertThat(provider.getAvailability()).isEqualTo(availabilty);
assertThat(provider.getAvailability()).isEqualTo(availability);
}

private void assertHasRequirements(List<String> executionRequirements) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ public void testCcLinkingContextOnWindows() throws Exception {
doTestCcLinkingContext(
ImmutableList.of("a.a", "libdep2.a", "b.rlib", "c.a", "d.a", "libdep1.a"),
ImmutableList.of("a.pic.a", "b.rlib", "c.pic.a", "e.pic.a"),
// The suffix of dynamic library is caculated based on repository name and package path
// The suffix of dynamic library is calculated based on repository name and package path
// to avoid conflicts with dynamic library from other packages.
ImmutableList.of("a.so", "libdep2_61.so", "b.so", "e.so", "libdep1_61.so"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase {
DottedVersion.fromStringUnchecked(AppleCommandLineOptions.DEFAULT_IOS_SDK_VERSION);

/**
* Returns the configuration obtained by applying the apple crosstool configuration transtion to
* Returns the configuration obtained by applying the apple crosstool configuration transition to
* this {@code BuildViewTestCase}'s target configuration.
*/
protected BuildConfigurationValue getAppleCrosstoolConfiguration() throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ final String bundleExtension() {
* </pre>
* }
*
* @throws IOException for whatever reason the implementator feels like, but mostly just when
* @throws IOException for whatever reason the implementer feels like, but mostly just when
* a scratch file couldn't be created
*/
abstract Iterable<String> requiredAttributes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ public void testEarlyFlushBadInitialEvent() {
// In this case, we expect 3 events in the stream, in that order:
// - an artificial progress event as initial event, to properly link in
// all events
// - the unusal first event we have seen, and
// - the unusual first event we have seen, and
// - a progress event reporting the flushed messages.
BuildEventStreamer.OutErrProvider outErr = mock(BuildEventStreamer.OutErrProvider.class);
String stdoutMsg = "Some text that was written to stdout.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public void testActionVisible() throws IOException {
clock.advanceMillis(120000);

UiStateTracker stateTracker = getUiStateTracker(clock);
// Mimick being at the execution phase.
// Mimic being at the execution phase.
simulateExecutionPhase(stateTracker);
stateTracker.actionStarted(new ActionStartedEvent(mockAction(message, "bar/foo"), 123456789));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ private static String getOptionValue(
.collect(Collectors.toList());
if (ans.size() > 1) {
throw new NoSuchElementException(
String.format("Multple matches for fragment=%s, option=%s", fragmentOptions, optionName));
String.format(
"Multiple matches for fragment=%s, option=%s", fragmentOptions, optionName));
} else if (ans.isEmpty()) {
throw new NoSuchElementException(
String.format("No matches for fragment=%s, option=%s", fragmentOptions, optionName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ public void onCompleted() {}

/**
* Ensure that if a command is marked as preemptible, running a second preemptible command
* interupts the first command.
* interrupts the first command.
*/
@Test
public void testMultiPreeempt() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ public void testNonSkyframeGlobbingEncountersSymlinkCycleAndThrowsIOException()
new IOException() {
@Override
public String getMessage() {
throw new IllegalStateException("should't get here!");
throw new IllegalStateException("shouldn't get here!");
}
});
// And we evaluate the PackageValue node for the Package in keepGoing mode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ public void testCreateTemplateAction() throws Exception {
* encoded string which has been ingested as Latin 1. The hack converts the string to its
* "correct" UTF-8 value. Once Blaze starts calling {@link
* net.starlark.java.syntax.ParserInput#fromUTF8} instead of {@code fromLatin1} and the hack for
* the substituations parameter is removed, this test will fail.
* the substitutions parameter is removed, this test will fail.
*/
@Test
public void testCreateTemplateActionWithWrongEncoding() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private Set<Class<?>> getClassesRecursive(String pkgName) {
}
}
} catch (ClassPathException e) {
throw new AssertionError("Cannot retrive classes: " + e.getMessage());
throw new AssertionError("Cannot retrieve classes: " + e.getMessage());
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ private void doTestDeleteUnreadableDirectories(DeleteFunc deleteFunc) throws IOE
bDir.setReadable(false);
topDir.setReadable(false);
} catch (UnsupportedOperationException e) {
// Skip testing if the file system does not support clearing the needed attibutes.
// Skip testing if the file system does not support clearing the needed attributes.
return;
}

Expand Down Expand Up @@ -922,7 +922,7 @@ private void doTestDeleteUnwritableDirectories(DeleteFunc deleteFunc) throws IOE
bDir.setWritable(false);
topDir.setWritable(false);
} catch (UnsupportedOperationException e) {
// Skip testing if the file system does not support clearing the needed attibutes.
// Skip testing if the file system does not support clearing the needed attributes.
return;
}

Expand Down Expand Up @@ -971,7 +971,7 @@ private void doTestDeleteReadableUnexecutableDirectories(DeleteFunc deleteFunc)
bDir.setExecutable(false);
topDir.setExecutable(false);
} catch (UnsupportedOperationException e) {
// Skip testing if the file system does not support clearing the needed attibutes.
// Skip testing if the file system does not support clearing the needed attributes.
return;
}

Expand Down Expand Up @@ -1023,7 +1023,7 @@ private void doTestDeleteUnreadableUnexecutableDirectories(DeleteFunc deleteFunc
topDir.setReadable(false);
topDir.setExecutable(false);
} catch (UnsupportedOperationException e) {
// Skip testing if the file system does not support clearing the needed attibutes.
// Skip testing if the file system does not support clearing the needed attributes.
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void testOneVersionArgs() throws Exception {
.containsAtLeast("--enforce_one_version", "--succeed_on_found_violations");

// --one_version_whitelist and the execpath to the whitelist are two different args, but they
// need to be next to eachother.
// need to be next to each other.
MoreAsserts.assertContainsSublist(
Lists.newArrayList(command.arguments()), "--one_version_whitelist", "whitelistfile");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Minimal example of a repository rule.
<td>
String; optional
<p>
This argument will be ingored. You don't have to specify it, but you may.
This argument will be ignored. You don't have to specify it, but you may.
</p>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ my_repo = repository_rule(
doc = "Minimal example of a repository rule.",
attrs = {
"useless": attr.string(
doc = "This argument will be ingored. You don't have to specify it, but you may.",
doc = "This argument will be ignored. You don't have to specify it, but you may.",
default = "ignoreme",
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ private void assertDirtyAndNotChanged(SkyKey key) {
}

protected InvalidatingNodeVisitor.InvalidationState newInvalidationState() {
throw new UnsupportedOperationException("Sublcasses must override");
throw new UnsupportedOperationException("Subclasses must override");
}

protected InvalidationType defaultInvalidationType() {
throw new UnsupportedOperationException("Sublcasses must override");
throw new UnsupportedOperationException("Subclasses must override");
}

protected boolean reverseDepsPresent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ final void checkEvalError(String msg, String... input) throws Exception {
}

/**
* Verifies that a piece of Starlark code fails at the specifed location with either a {@link
* Verifies that a piece of Starlark code fails at the specified location with either a {@link
* SyntaxError} or an {@link EvalException} having the specified error message.
*
* <p>For a {@link SyntaxError}, the location checked is the first reported error's location. For
Expand Down
Loading

0 comments on commit 7c0bdc2

Please sign in to comment.