mirror of https://github.com/google/googletest.git
fix: correct spelling/grammar mistakes in codebase and docs
This commit is contained in:
parent
91c99b6ffe
commit
1a14c49d5b
|
|
@ -262,7 +262,7 @@ according to the C++ language specification, and so you may not use fatal
|
|||
assertions in them; you'll get a compilation error if you try. Instead, either
|
||||
call `abort` and crash the entire test executable, or put the fatal assertion in
|
||||
a `SetUp`/`TearDown` function; see
|
||||
[constructor/destructor vs. `SetUp`/`TearDown`](faq.md#CtorVsSetUp)
|
||||
[constructor/destructor vs. `SetUp`/`TearDown`](faq.md#CtorVsSetUp).
|
||||
|
||||
{: .callout .warning}
|
||||
WARNING: A fatal assertion in a helper function (private void-returning method)
|
||||
|
|
@ -1235,7 +1235,7 @@ returns the value of `testing::PrintToString(GetParam())`. It does not work for
|
|||
{: .callout .note}
|
||||
NOTE: test names must be non-empty, unique, and may only contain ASCII
|
||||
alphanumeric characters. In particular, they
|
||||
[should not contain underscores](faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore)
|
||||
[should not contain underscores](faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore).
|
||||
|
||||
```c++
|
||||
class MyTestSuite : public testing::TestWithParam<int> {};
|
||||
|
|
@ -1701,9 +1701,9 @@ checkpoints to implement a resource leak checker, for example.
|
|||
|
||||
### Defining Event Listeners
|
||||
|
||||
To define a event listener, you subclass either
|
||||
To define an event listener, you subclass either
|
||||
[`testing::TestEventListener`](reference/testing.md#TestEventListener) or
|
||||
[`testing::EmptyTestEventListener`](reference/testing.md#EmptyTestEventListener)
|
||||
[`testing::EmptyTestEventListener`](reference/testing.md#EmptyTestEventListener).
|
||||
The former is an (abstract) interface, where *each pure virtual method can be
|
||||
overridden to handle a test event* (For example, when a test starts, the
|
||||
`OnTestStart()` method will be called.). The latter provides an empty
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ to accept a std::function instead of the free function, and then use
|
|||
|
||||
Before the generic `MOCK_METHOD` macro
|
||||
[was introduced in 2018](https://github.com/google/googletest/commit/c5f08bf91944ce1b19bcf414fa1760e69d20afc2),
|
||||
mocks where created using a family of macros collectively called `MOCK_METHODn`.
|
||||
mocks were created using a family of macros collectively called `MOCK_METHODn`.
|
||||
These macros are still supported, though migration to the new `MOCK_METHOD` is
|
||||
recommended.
|
||||
|
||||
|
|
@ -1242,7 +1242,7 @@ Field(&Foo::number, Ge(3))
|
|||
matches a plain pointer `p` where `p->number >= 3`. If `p` is `NULL`, the match
|
||||
will always fail regardless of the inner matcher.
|
||||
|
||||
What if you want to validate more than one members at the same time? Remember
|
||||
What if you want to validate more than one member at the same time? Remember
|
||||
that there are [`AllOf()` and `AllOfArray()`](#CombiningMatchers).
|
||||
|
||||
Finally `Field()` and `Property()` provide overloads that take the field or
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ GoogleTest follows Google's
|
|||
[Foundational C++ Support Policy](https://opensource.google/documentation/policies/cplusplus-support).
|
||||
See
|
||||
[this table](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md)
|
||||
for a list of currently supported versions compilers, platforms, and build
|
||||
for a list of currently supported compiler versions, platforms, and build
|
||||
tools.
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ int main(int argc, char **argv) {
|
|||
The `testing::InitGoogleTest()` function parses the command line for GoogleTest
|
||||
flags, and removes all recognized flags. This allows the user to control a test
|
||||
program's behavior via various flags, which we'll cover in the
|
||||
[AdvancedGuide](advanced.md). You **must** call this function before calling
|
||||
[Advanced Guide](advanced.md). You **must** call this function before calling
|
||||
`RUN_ALL_TESTS()`, or the flags won't be properly initialized.
|
||||
|
||||
On Windows, `InitGoogleTest()` also works with wide strings, so it can be used
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ See also
|
|||
|
||||
The functions listed in the table above appear to return generators that create
|
||||
values of the desired types, but this is not generally the case. Rather, they
|
||||
typically return factory objects that convert to the the desired generators.
|
||||
typically return factory objects that convert to the desired generators.
|
||||
This affords some flexibility in allowing you to specify values of types that
|
||||
are different from, yet implicitly convertible to, the actual parameter type
|
||||
required by your fixture class.
|
||||
|
|
|
|||
|
|
@ -849,7 +849,7 @@ class [[nodiscard]] Action<R(Args...)> {
|
|||
|
||||
// The PolymorphicAction class template makes it easy to implement a
|
||||
// polymorphic action (i.e. an action that can be used in mock
|
||||
// functions of than one type, e.g. Return()).
|
||||
// functions of more than one type, e.g. Return()).
|
||||
//
|
||||
// To define a polymorphic action, a user first provides a COPYABLE
|
||||
// implementation class that has a Perform() method template:
|
||||
|
|
|
|||
|
|
@ -1785,7 +1785,7 @@ class [[nodiscard]] FloatingEqMatcher {
|
|||
nan_eq_nan_(nan_eq_nan),
|
||||
max_abs_error_(max_abs_error) {
|
||||
GTEST_CHECK_(max_abs_error >= 0)
|
||||
<< ", where max_abs_error is" << max_abs_error;
|
||||
<< ", where max_abs_error is " << max_abs_error;
|
||||
}
|
||||
|
||||
// Implements floating point equality matcher as a Matcher<T>.
|
||||
|
|
@ -4343,7 +4343,7 @@ auto IsOptionalEngaged(const Optional& optional, Rank0)
|
|||
return optional.has_value();
|
||||
}
|
||||
|
||||
// Implements a matcher that checks the value of a optional<> type variable.
|
||||
// Implements a matcher that checks the value of an optional<> type variable.
|
||||
template <typename ValueMatcher>
|
||||
class [[nodiscard]] OptionalMatcher {
|
||||
public:
|
||||
|
|
@ -5913,7 +5913,7 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage(
|
|||
EXPECT_PRED_FORMAT1( \
|
||||
::testing::internal::MakePredicateFormatterFromMatcher(matcher), value)
|
||||
|
||||
// MATCHER* macros itself are listed below.
|
||||
// MATCHER* macros are listed below.
|
||||
#define MATCHER(name, description) \
|
||||
class name##Matcher \
|
||||
: public ::testing::internal::MatcherBaseImpl<name##Matcher> { \
|
||||
|
|
|
|||
|
|
@ -373,10 +373,10 @@ bool UnorderedElementsAreMatcherImplBase::VerifyMatchMatrix(
|
|||
return true;
|
||||
}
|
||||
|
||||
const bool is_exact_match_with_size_discrepency =
|
||||
const bool is_exact_match_with_size_discrepancy =
|
||||
match_flags() == UnorderedMatcherRequire::ExactMatch &&
|
||||
matrix.LhsSize() != matrix.RhsSize();
|
||||
if (is_exact_match_with_size_discrepency) {
|
||||
if (is_exact_match_with_size_discrepancy) {
|
||||
// The element count doesn't match. If the container is empty,
|
||||
// there's no need to explain anything as Google Mock already
|
||||
// prints the empty container. Otherwise we just need to show
|
||||
|
|
@ -386,7 +386,7 @@ bool UnorderedElementsAreMatcherImplBase::VerifyMatchMatrix(
|
|||
}
|
||||
}
|
||||
|
||||
bool result = !is_exact_match_with_size_discrepency;
|
||||
bool result = !is_exact_match_with_size_discrepancy;
|
||||
::std::vector<char> element_matched(matrix.LhsSize(), 0);
|
||||
::std::vector<char> matcher_matched(matrix.RhsSize(), 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -1389,13 +1389,13 @@ TEST(MatcherPnMacroTest, SimpleTypePromotion) {
|
|||
// Verifies the type of a MATCHER*.
|
||||
|
||||
TEST(MatcherPnMacroTest, TypesAreCorrect) {
|
||||
// EqualsSumOf() must be assignable to a EqualsSumOfMatcher variable.
|
||||
// EqualsSumOf() must be assignable to an EqualsSumOfMatcher variable.
|
||||
EqualsSumOfMatcher a0 = EqualsSumOf();
|
||||
|
||||
// EqualsSumOf(1) must be assignable to a EqualsSumOfMatcherP variable.
|
||||
// EqualsSumOf(1) must be assignable to an EqualsSumOfMatcherP variable.
|
||||
EqualsSumOfMatcherP<int> a1 = EqualsSumOf(1);
|
||||
|
||||
// EqualsSumOf(p1, ..., pk) must be assignable to a EqualsSumOfMatcherPk
|
||||
// EqualsSumOf(p1, ..., pk) must be assignable to an EqualsSumOfMatcherPk
|
||||
// variable, and so on.
|
||||
EqualsSumOfMatcherP2<int, char> a2 = EqualsSumOf(1, '2');
|
||||
EqualsSumOfMatcherP3<int, int, char> a3 = EqualsSumOf(1, 2, '3');
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ sudo make install # Install in /usr/local/ by default
|
|||
```
|
||||
|
||||
If you use Windows and have Visual Studio installed, a `gtest.sln` file and
|
||||
several `.vcproj` files will be created. You can then build them using Visual
|
||||
several `.vcxproj` files will be created. You can then build them using Visual
|
||||
Studio.
|
||||
|
||||
On Mac OS X with Xcode installed, a `.xcodeproj` file will be generated.
|
||||
|
|
|
|||
|
|
@ -114,14 +114,14 @@ GTEST_DECLARE_bool_(list_tests);
|
|||
// in addition to its normal textual output.
|
||||
GTEST_DECLARE_string_(output);
|
||||
|
||||
// This flags control whether Google Test prints only test failures.
|
||||
// This flag controls whether Google Test prints only test failures.
|
||||
GTEST_DECLARE_bool_(brief);
|
||||
|
||||
// This flags control whether Google Test prints the elapsed time for each
|
||||
// This flag controls whether Google Test prints the elapsed time for each
|
||||
// test.
|
||||
GTEST_DECLARE_bool_(print_time);
|
||||
|
||||
// This flags control whether Google Test prints UTF8 characters as text.
|
||||
// This flag controls whether Google Test prints UTF8 characters as text.
|
||||
GTEST_DECLARE_bool_(print_utf8);
|
||||
|
||||
// This flag specifies the random number seed.
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ struct CodeLocation {
|
|||
};
|
||||
|
||||
// Helper to identify which setup function for TestCase / TestSuite to call.
|
||||
// Only one function is allowed, either TestCase or TestSute but not both.
|
||||
// Only one function is allowed, either TestCase or TestSuite but not both.
|
||||
|
||||
// Utility functions to help SuiteApiResolver
|
||||
using SetUpTearDownSuiteFuncType = void (*)();
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ class [[nodiscard]] ValuesInIteratorRangeGenerator
|
|||
return new Iterator(*this);
|
||||
}
|
||||
// We need to use cached value referenced by iterator_ because *iterator_
|
||||
// can return a temporary object (and of type other then T), so just
|
||||
// can return a temporary object (and of type other than T), so just
|
||||
// having "return &*iterator_;" doesn't work.
|
||||
// value_ is updated here and not in Advance() because Advance()
|
||||
// can advance iterator_ beyond the end of the range, and we cannot
|
||||
|
|
@ -762,8 +762,8 @@ class [[nodiscard]] ParameterizedTestSuiteRegistry {
|
|||
};
|
||||
|
||||
// Keep track of what type-parameterized test suite are defined and
|
||||
// where as well as which are intatiated. This allows susequently
|
||||
// identifying suits that are defined but never used.
|
||||
// where as well as which are initiated. This allows subsequently
|
||||
// identifying suites that are defined but never used.
|
||||
class [[nodiscard]] TypeParameterizedTestSuiteRegistry {
|
||||
public:
|
||||
// Add a suite definition
|
||||
|
|
@ -773,7 +773,7 @@ class [[nodiscard]] TypeParameterizedTestSuiteRegistry {
|
|||
// Add an instantiation of a suit.
|
||||
void RegisterInstantiation(const char* test_suite_name);
|
||||
|
||||
// For each suit repored as defined but not reported as instantiation,
|
||||
// For each suit reported as defined but not reported as instantiation,
|
||||
// emit a test that reports that fact (configurably, as an error).
|
||||
void CheckForInstantiations();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||
//
|
||||
// This header file declares the String class and functions used internally by
|
||||
// Google Test. They are subject to change without notice. They should not used
|
||||
// Google Test. They are subject to change without notice. They should not be used
|
||||
// by code external to Google Test.
|
||||
//
|
||||
// This header file is #included by gtest-internal.h.
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ static ::std::string FormatDeathTestOutput(const ::std::string& output) {
|
|||
// concluded: DIED, LIVED, THREW, or RETURNED. The death test
|
||||
// fails in the latter three cases.
|
||||
// status: The exit status of the child process. On *nix, it is in the
|
||||
// in the format specified by wait(2). On Windows, this is the
|
||||
// format specified by wait(2). On Windows, this is the
|
||||
// value supplied to the ExitProcess() API or a numeric code
|
||||
// of the exception that terminated the program.
|
||||
// matcher_: A matcher that's expected to match the stderr output by the child
|
||||
|
|
@ -724,7 +724,7 @@ int WindowsDeathTest::Wait() {
|
|||
|
||||
ReadAndInterpretStatusByte();
|
||||
|
||||
// Waits for the child process to exit if it haven't already. This
|
||||
// Waits for the child process to exit if it hasn't already. This
|
||||
// returns immediately if the child has already exited, regardless of
|
||||
// whether previous calls to WaitForMultipleObjects synchronized on this
|
||||
// handle or not.
|
||||
|
|
@ -773,7 +773,7 @@ DeathTest::TestRole WindowsDeathTest::AssumeRole() {
|
|||
&handles_are_inheritable,
|
||||
TRUE, // The event will automatically reset to non-signaled state.
|
||||
FALSE, // The initial state is non-signalled.
|
||||
nullptr)); // The even is unnamed.
|
||||
nullptr)); // The event is unnamed.
|
||||
GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != nullptr);
|
||||
const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ +
|
||||
"filter=" + info->test_suite_name() + "." +
|
||||
|
|
|
|||
|
|
@ -711,8 +711,8 @@ class GTEST_API_ UnitTestImpl {
|
|||
|
||||
// Registers all parameterized tests defined using TEST_P and
|
||||
// INSTANTIATE_TEST_SUITE_P, creating regular tests for each test/parameter
|
||||
// combination. This method can be called more then once; it has guards
|
||||
// protecting from registering the tests more then once. If
|
||||
// combination. This method can be called more than once; it has guards
|
||||
// protecting from registering the tests more than once. If
|
||||
// value-parameterized tests are disabled, RegisterParameterizedTests is
|
||||
// present but does nothing.
|
||||
void RegisterParameterizedTests();
|
||||
|
|
|
|||
|
|
@ -1129,7 +1129,7 @@ class CapturedStream {
|
|||
#elif defined(GTEST_OS_IOS)
|
||||
char user_temp_dir[PATH_MAX + 1];
|
||||
|
||||
// Documented alternative to NSTemporaryDirectory() (for obtaining creating
|
||||
// Documented alternative to NSTemporaryDirectory() (for creating
|
||||
// a temporary directory) at
|
||||
// https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585-SW10
|
||||
//
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ namespace {
|
|||
|
||||
// When TEST_P is found without a matching INSTANTIATE_TEST_SUITE_P
|
||||
// to creates test cases for it, a synthetic test case is
|
||||
// inserted to report ether an error or a log message.
|
||||
// inserted to report either an error or a log message.
|
||||
//
|
||||
// This configuration bit will likely be removed at some point.
|
||||
constexpr bool kErrorOnUninstantiatedParameterizedTest = true;
|
||||
|
|
@ -590,7 +590,7 @@ void InsertSyntheticTestCase(const std::string& name, CodeLocation location,
|
|||
"defined via TEST_P . No test cases will run."
|
||||
"\n\n"
|
||||
"Ideally, INSTANTIATE_TEST_SUITE_P should only ever be invoked from "
|
||||
"code that always depend on code that provides TEST_P. Failing to do "
|
||||
"code that always depends on code that provides TEST_P. Failing to do "
|
||||
"so is often an indication of dead code, e.g. the last TEST_P was "
|
||||
"removed but the rest got left behind.";
|
||||
|
||||
|
|
@ -638,7 +638,7 @@ void TypeParameterizedTestSuiteRegistry::RegisterInstantiation(
|
|||
if (it != suites_.end()) {
|
||||
it->second.instantiated = true;
|
||||
} else {
|
||||
GTEST_LOG_(ERROR) << "Unknown type parameterized test suit '"
|
||||
GTEST_LOG_(ERROR) << "Unknown type parameterized test suite '"
|
||||
<< test_suite_name << "'";
|
||||
}
|
||||
}
|
||||
|
|
@ -893,7 +893,7 @@ class PositiveAndNegativeUnitTestFilter {
|
|||
}
|
||||
|
||||
// Returns true if and only if test name (this is generated by appending test
|
||||
// suit name and test name via a '.' character) matches the positive filter
|
||||
// suite name and test name via a '.' character) matches the positive filter
|
||||
// and does not match the negative filter.
|
||||
bool MatchesTest(const std::string& test_suite_name,
|
||||
const std::string& test_name) const {
|
||||
|
|
@ -2427,7 +2427,7 @@ static std::vector<std::string> GetReservedAttributesForElement(
|
|||
} else {
|
||||
GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element;
|
||||
}
|
||||
// This code is unreachable but some compilers may not realizes that.
|
||||
// This code is unreachable but some compilers may not realize that.
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
|
|
@ -2445,7 +2445,7 @@ static std::vector<std::string> GetReservedOutputAttributesForElement(
|
|||
} else {
|
||||
GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element;
|
||||
}
|
||||
// This code is unreachable but some compilers may not realizes that.
|
||||
// This code is unreachable but some compilers may not realize that.
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2493,7 +2493,7 @@ void TestResult::Clear() {
|
|||
elapsed_time_ = 0;
|
||||
}
|
||||
|
||||
// Returns true off the test part was skipped.
|
||||
// Returns true if the test part was skipped.
|
||||
static bool TestPartSkipped(const TestPartResult& result) {
|
||||
return result.skipped();
|
||||
}
|
||||
|
|
@ -4535,19 +4535,19 @@ void XmlUnitTestResultPrinter::OutputXmlTestProperties(
|
|||
#endif // GTEST_HAS_FILE_SYSTEM
|
||||
|
||||
#if GTEST_HAS_FILE_SYSTEM
|
||||
// This class generates an JSON output file.
|
||||
// This class generates a JSON output file.
|
||||
class JsonUnitTestResultPrinter : public EmptyTestEventListener {
|
||||
public:
|
||||
explicit JsonUnitTestResultPrinter(const char* output_file);
|
||||
|
||||
void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override;
|
||||
|
||||
// Prints an JSON summary of all unit tests.
|
||||
// Prints a JSON summary of all unit tests.
|
||||
static void PrintJsonTestList(::std::ostream* stream,
|
||||
const std::vector<TestSuite*>& test_suites);
|
||||
|
||||
private:
|
||||
// Returns an JSON-escaped copy of the input string str.
|
||||
// Returns a JSON-escaped copy of the input string str.
|
||||
static std::string EscapeJson(const std::string& str);
|
||||
|
||||
//// Verifies that the given attribute belongs to the given element and
|
||||
|
|
@ -4620,7 +4620,7 @@ void JsonUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
|
|||
fclose(jsonout);
|
||||
}
|
||||
|
||||
// Returns an JSON-escaped copy of the input string str.
|
||||
// Returns a JSON-escaped copy of the input string str.
|
||||
std::string JsonUnitTestResultPrinter::EscapeJson(const std::string& str) {
|
||||
Message m;
|
||||
|
||||
|
|
@ -4660,7 +4660,7 @@ std::string JsonUnitTestResultPrinter::EscapeJson(const std::string& str) {
|
|||
return m.GetString();
|
||||
}
|
||||
|
||||
// The following routines generate an JSON representation of a UnitTest
|
||||
// The following routines generate a JSON representation of a UnitTest
|
||||
// object.
|
||||
|
||||
// Formats the given time in milliseconds as seconds.
|
||||
|
|
@ -4872,7 +4872,7 @@ void JsonUnitTestResultPrinter::OutputJsonTestResult(::std::ostream* stream,
|
|||
*stream << "\n" << Indent(8) << "}";
|
||||
}
|
||||
|
||||
// Prints an JSON representation of a TestSuite object
|
||||
// Prints a JSON representation of a TestSuite object
|
||||
void JsonUnitTestResultPrinter::PrintJsonTestSuite(
|
||||
std::ostream* stream, const TestSuite& test_suite) {
|
||||
const std::string kTestsuite = "testsuite";
|
||||
|
|
|
|||
|
|
@ -1002,7 +1002,7 @@ Stack trace: (omitted)
|
|||
googletest-output-test_.cc:#: Failure
|
||||
Parameterized test suite NoTests is instantiated via INSTANTIATE_TEST_SUITE_P, but no tests are defined via TEST_P . No test cases will run.
|
||||
|
||||
Ideally, INSTANTIATE_TEST_SUITE_P should only ever be invoked from code that always depend on code that provides TEST_P. Failing to do so is often an indication of dead code, e.g. the last TEST_P was removed but the rest got left behind.
|
||||
Ideally, INSTANTIATE_TEST_SUITE_P should only ever be invoked from code that always depends on code that provides TEST_P. Failing to do so is often an indication of dead code, e.g. the last TEST_P was removed but the rest got left behind.
|
||||
|
||||
To suppress this error for this test suite, insert the following line (in a non-header) in the namespace it is defined in:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue