Change ::testing
to testing
in Testing Reference doc
PiperOrigin-RevId: 544466397 Change-Id: Icb4d5fae38361cd75d47f908886831696eb2b1c9
This commit is contained in:
parent
687c589949
commit
251e720391
@ -122,8 +122,8 @@ custom function can be used for more control:
|
|||||||
```cpp
|
```cpp
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
MyInstantiation, MyTestSuite,
|
MyInstantiation, MyTestSuite,
|
||||||
::testing::Values(...),
|
testing::Values(...),
|
||||||
[](const ::testing::TestParamInfo<MyTestSuite::ParamType>& info) {
|
[](const testing::TestParamInfo<MyTestSuite::ParamType>& info) {
|
||||||
// Can use info.param here to generate the test suffix
|
// Can use info.param here to generate the test suffix
|
||||||
std::string name = ...
|
std::string name = ...
|
||||||
return name;
|
return name;
|
||||||
@ -148,7 +148,7 @@ type, for example:
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class MyFixture : public ::testing::Test {
|
class MyFixture : public testing::Test {
|
||||||
public:
|
public:
|
||||||
...
|
...
|
||||||
using List = std::list<T>;
|
using List = std::list<T>;
|
||||||
@ -324,7 +324,7 @@ Then the test code should look like:
|
|||||||
```cpp
|
```cpp
|
||||||
namespace my_namespace {
|
namespace my_namespace {
|
||||||
|
|
||||||
class MyClassTest : public ::testing::Test {
|
class MyClassTest : public testing::Test {
|
||||||
...
|
...
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ GoogleTest defines the following classes and types to help with writing tests.
|
|||||||
|
|
||||||
### AssertionResult {#AssertionResult}
|
### AssertionResult {#AssertionResult}
|
||||||
|
|
||||||
`::testing::AssertionResult`
|
`testing::AssertionResult`
|
||||||
|
|
||||||
A class for indicating whether an assertion was successful.
|
A class for indicating whether an assertion was successful.
|
||||||
|
|
||||||
@ -401,14 +401,14 @@ To create an instance of this class, use one of the factory functions
|
|||||||
|
|
||||||
### AssertionException {#AssertionException}
|
### AssertionException {#AssertionException}
|
||||||
|
|
||||||
`::testing::AssertionException`
|
`testing::AssertionException`
|
||||||
|
|
||||||
Exception which can be thrown from
|
Exception which can be thrown from
|
||||||
[`TestEventListener::OnTestPartResult`](#TestEventListener::OnTestPartResult).
|
[`TestEventListener::OnTestPartResult`](#TestEventListener::OnTestPartResult).
|
||||||
|
|
||||||
### EmptyTestEventListener {#EmptyTestEventListener}
|
### EmptyTestEventListener {#EmptyTestEventListener}
|
||||||
|
|
||||||
`::testing::EmptyTestEventListener`
|
`testing::EmptyTestEventListener`
|
||||||
|
|
||||||
Provides an empty implementation of all methods in the
|
Provides an empty implementation of all methods in the
|
||||||
[`TestEventListener`](#TestEventListener) interface, such that a subclass only
|
[`TestEventListener`](#TestEventListener) interface, such that a subclass only
|
||||||
@ -416,7 +416,7 @@ needs to override the methods it cares about.
|
|||||||
|
|
||||||
### Environment {#Environment}
|
### Environment {#Environment}
|
||||||
|
|
||||||
`::testing::Environment`
|
`testing::Environment`
|
||||||
|
|
||||||
Represents a global test environment. See
|
Represents a global test environment. See
|
||||||
[Global Set-Up and Tear-Down](../advanced.md#global-set-up-and-tear-down).
|
[Global Set-Up and Tear-Down](../advanced.md#global-set-up-and-tear-down).
|
||||||
@ -437,7 +437,7 @@ Override this to define how to tear down the environment.
|
|||||||
|
|
||||||
### ScopedTrace {#ScopedTrace}
|
### ScopedTrace {#ScopedTrace}
|
||||||
|
|
||||||
`::testing::ScopedTrace`
|
`testing::ScopedTrace`
|
||||||
|
|
||||||
An instance of this class causes a trace to be included in every test failure
|
An instance of this class causes a trace to be included in every test failure
|
||||||
message generated by code in the scope of the lifetime of the `ScopedTrace`
|
message generated by code in the scope of the lifetime of the `ScopedTrace`
|
||||||
@ -453,7 +453,7 @@ ScopedTrace(const char* file, int line, const T& message)
|
|||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
::testing::ScopedTrace trace("file.cc", 123, "message");
|
testing::ScopedTrace trace("file.cc", 123, "message");
|
||||||
```
|
```
|
||||||
|
|
||||||
The resulting trace includes the given source file path and line number, and the
|
The resulting trace includes the given source file path and line number, and the
|
||||||
@ -464,7 +464,7 @@ See also [`SCOPED_TRACE`](#SCOPED_TRACE).
|
|||||||
|
|
||||||
### Test {#Test}
|
### Test {#Test}
|
||||||
|
|
||||||
`::testing::Test`
|
`testing::Test`
|
||||||
|
|
||||||
The abstract class that all tests inherit from. `Test` is not copyable.
|
The abstract class that all tests inherit from. `Test` is not copyable.
|
||||||
|
|
||||||
@ -552,7 +552,7 @@ after running each individual test.
|
|||||||
|
|
||||||
### TestWithParam {#TestWithParam}
|
### TestWithParam {#TestWithParam}
|
||||||
|
|
||||||
`::testing::TestWithParam<T>`
|
`testing::TestWithParam<T>`
|
||||||
|
|
||||||
A convenience class which inherits from both [`Test`](#Test) and
|
A convenience class which inherits from both [`Test`](#Test) and
|
||||||
[`WithParamInterface<T>`](#WithParamInterface).
|
[`WithParamInterface<T>`](#WithParamInterface).
|
||||||
@ -672,7 +672,7 @@ during execution of `SetUpTestSuite` and `TearDownTestSuite`.
|
|||||||
|
|
||||||
### TestInfo {#TestInfo}
|
### TestInfo {#TestInfo}
|
||||||
|
|
||||||
`::testing::TestInfo`
|
`testing::TestInfo`
|
||||||
|
|
||||||
Stores information about a test.
|
Stores information about a test.
|
||||||
|
|
||||||
@ -751,7 +751,7 @@ Returns the result of the test. See [`TestResult`](#TestResult).
|
|||||||
|
|
||||||
### TestParamInfo {#TestParamInfo}
|
### TestParamInfo {#TestParamInfo}
|
||||||
|
|
||||||
`::testing::TestParamInfo<T>`
|
`testing::TestParamInfo<T>`
|
||||||
|
|
||||||
Describes a parameter to a value-parameterized test. The type `T` is the type of
|
Describes a parameter to a value-parameterized test. The type `T` is the type of
|
||||||
the parameter.
|
the parameter.
|
||||||
@ -761,7 +761,7 @@ and its integer index respectively.
|
|||||||
|
|
||||||
### UnitTest {#UnitTest}
|
### UnitTest {#UnitTest}
|
||||||
|
|
||||||
`::testing::UnitTest`
|
`testing::UnitTest`
|
||||||
|
|
||||||
This class contains information about the test program.
|
This class contains information about the test program.
|
||||||
|
|
||||||
@ -929,7 +929,7 @@ GoogleTest. See [`TestEventListeners`](#TestEventListeners).
|
|||||||
|
|
||||||
### TestEventListener {#TestEventListener}
|
### TestEventListener {#TestEventListener}
|
||||||
|
|
||||||
`::testing::TestEventListener`
|
`testing::TestEventListener`
|
||||||
|
|
||||||
The interface for tracing execution of tests. The methods below are listed in
|
The interface for tracing execution of tests. The methods below are listed in
|
||||||
the order the corresponding events are fired.
|
the order the corresponding events are fired.
|
||||||
@ -1027,7 +1027,7 @@ Fired after all test activities have ended.
|
|||||||
|
|
||||||
### TestEventListeners {#TestEventListeners}
|
### TestEventListeners {#TestEventListeners}
|
||||||
|
|
||||||
`::testing::TestEventListeners`
|
`testing::TestEventListeners`
|
||||||
|
|
||||||
Lets users add listeners to track events in GoogleTest.
|
Lets users add listeners to track events in GoogleTest.
|
||||||
|
|
||||||
@ -1072,7 +1072,7 @@ the caller and makes this function return `NULL` the next time.
|
|||||||
|
|
||||||
### TestPartResult {#TestPartResult}
|
### TestPartResult {#TestPartResult}
|
||||||
|
|
||||||
`::testing::TestPartResult`
|
`testing::TestPartResult`
|
||||||
|
|
||||||
A copyable object representing the result of a test part (i.e. an assertion or
|
A copyable object representing the result of a test part (i.e. an assertion or
|
||||||
an explicit `FAIL()`, `ADD_FAILURE()`, or `SUCCESS()`).
|
an explicit `FAIL()`, `ADD_FAILURE()`, or `SUCCESS()`).
|
||||||
@ -1154,7 +1154,7 @@ Returns true if and only if the test part failed.
|
|||||||
|
|
||||||
### TestProperty {#TestProperty}
|
### TestProperty {#TestProperty}
|
||||||
|
|
||||||
`::testing::TestProperty`
|
`testing::TestProperty`
|
||||||
|
|
||||||
A copyable object representing a user-specified test property which can be
|
A copyable object representing a user-specified test property which can be
|
||||||
output as a key/value string pair.
|
output as a key/value string pair.
|
||||||
@ -1181,7 +1181,7 @@ Sets a new value, overriding the previous one.
|
|||||||
|
|
||||||
### TestResult {#TestResult}
|
### TestResult {#TestResult}
|
||||||
|
|
||||||
`::testing::TestResult`
|
`testing::TestResult`
|
||||||
|
|
||||||
Contains information about the result of a single test.
|
Contains information about the result of a single test.
|
||||||
|
|
||||||
@ -1262,20 +1262,20 @@ range, aborts the program.
|
|||||||
|
|
||||||
### TimeInMillis {#TimeInMillis}
|
### TimeInMillis {#TimeInMillis}
|
||||||
|
|
||||||
`::testing::TimeInMillis`
|
`testing::TimeInMillis`
|
||||||
|
|
||||||
An integer type representing time in milliseconds.
|
An integer type representing time in milliseconds.
|
||||||
|
|
||||||
### Types {#Types}
|
### Types {#Types}
|
||||||
|
|
||||||
`::testing::Types<T...>`
|
`testing::Types<T...>`
|
||||||
|
|
||||||
Represents a list of types for use in typed tests and type-parameterized tests.
|
Represents a list of types for use in typed tests and type-parameterized tests.
|
||||||
|
|
||||||
The template argument `T...` can be any number of types, for example:
|
The template argument `T...` can be any number of types, for example:
|
||||||
|
|
||||||
```
|
```
|
||||||
::testing::Types<char, int, unsigned int>
|
testing::Types<char, int, unsigned int>
|
||||||
```
|
```
|
||||||
|
|
||||||
See [Typed Tests](../advanced.md#typed-tests) and
|
See [Typed Tests](../advanced.md#typed-tests) and
|
||||||
@ -1284,7 +1284,7 @@ information.
|
|||||||
|
|
||||||
### WithParamInterface {#WithParamInterface}
|
### WithParamInterface {#WithParamInterface}
|
||||||
|
|
||||||
`::testing::WithParamInterface<T>`
|
`testing::WithParamInterface<T>`
|
||||||
|
|
||||||
The pure interface class that all value-parameterized tests inherit from.
|
The pure interface class that all value-parameterized tests inherit from.
|
||||||
|
|
||||||
@ -1310,9 +1310,9 @@ tests.
|
|||||||
|
|
||||||
### InitGoogleTest {#InitGoogleTest}
|
### InitGoogleTest {#InitGoogleTest}
|
||||||
|
|
||||||
`void ::testing::InitGoogleTest(int* argc, char** argv)` \
|
`void testing::InitGoogleTest(int* argc, char** argv)` \
|
||||||
`void ::testing::InitGoogleTest(int* argc, wchar_t** argv)` \
|
`void testing::InitGoogleTest(int* argc, wchar_t** argv)` \
|
||||||
`void ::testing::InitGoogleTest()`
|
`void testing::InitGoogleTest()`
|
||||||
|
|
||||||
Initializes GoogleTest. This must be called before calling
|
Initializes GoogleTest. This must be called before calling
|
||||||
[`RUN_ALL_TESTS()`](#RUN_ALL_TESTS). In particular, it parses the command line
|
[`RUN_ALL_TESTS()`](#RUN_ALL_TESTS). In particular, it parses the command line
|
||||||
@ -1329,7 +1329,7 @@ platforms where there is no `argc`/`argv`.
|
|||||||
|
|
||||||
### AddGlobalTestEnvironment {#AddGlobalTestEnvironment}
|
### AddGlobalTestEnvironment {#AddGlobalTestEnvironment}
|
||||||
|
|
||||||
`Environment* ::testing::AddGlobalTestEnvironment(Environment* env)`
|
`Environment* testing::AddGlobalTestEnvironment(Environment* env)`
|
||||||
|
|
||||||
Adds a test environment to the test program. Must be called before
|
Adds a test environment to the test program. Must be called before
|
||||||
[`RUN_ALL_TESTS()`](#RUN_ALL_TESTS) is called. See
|
[`RUN_ALL_TESTS()`](#RUN_ALL_TESTS) is called. See
|
||||||
@ -1342,7 +1342,7 @@ See also [`Environment`](#Environment).
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
template <typename Factory>
|
template <typename Factory>
|
||||||
TestInfo* ::testing::RegisterTest(const char* test_suite_name, const char* test_name,
|
TestInfo* testing::RegisterTest(const char* test_suite_name, const char* test_name,
|
||||||
const char* type_param, const char* value_param,
|
const char* type_param, const char* value_param,
|
||||||
const char* file, int line, Factory factory)
|
const char* file, int line, Factory factory)
|
||||||
```
|
```
|
||||||
@ -1381,27 +1381,27 @@ an all-caps name.
|
|||||||
|
|
||||||
### AssertionSuccess {#AssertionSuccess}
|
### AssertionSuccess {#AssertionSuccess}
|
||||||
|
|
||||||
`AssertionResult ::testing::AssertionSuccess()`
|
`AssertionResult testing::AssertionSuccess()`
|
||||||
|
|
||||||
Creates a successful assertion result. See
|
Creates a successful assertion result. See
|
||||||
[`AssertionResult`](#AssertionResult).
|
[`AssertionResult`](#AssertionResult).
|
||||||
|
|
||||||
### AssertionFailure {#AssertionFailure}
|
### AssertionFailure {#AssertionFailure}
|
||||||
|
|
||||||
`AssertionResult ::testing::AssertionFailure()`
|
`AssertionResult testing::AssertionFailure()`
|
||||||
|
|
||||||
Creates a failed assertion result. Use the `<<` operator to store a failure
|
Creates a failed assertion result. Use the `<<` operator to store a failure
|
||||||
message:
|
message:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
::testing::AssertionFailure() << "My failure message";
|
testing::AssertionFailure() << "My failure message";
|
||||||
```
|
```
|
||||||
|
|
||||||
See [`AssertionResult`](#AssertionResult).
|
See [`AssertionResult`](#AssertionResult).
|
||||||
|
|
||||||
### StaticAssertTypeEq {#StaticAssertTypeEq}
|
### StaticAssertTypeEq {#StaticAssertTypeEq}
|
||||||
|
|
||||||
`::testing::StaticAssertTypeEq<T1, T2>()`
|
`testing::StaticAssertTypeEq<T1, T2>()`
|
||||||
|
|
||||||
Compile-time assertion for type equality. Compiles if and only if `T1` and `T2`
|
Compile-time assertion for type equality. Compiles if and only if `T1` and `T2`
|
||||||
are the same type. The value it returns is irrelevant.
|
are the same type. The value it returns is irrelevant.
|
||||||
@ -1410,7 +1410,7 @@ See [Type Assertions](../advanced.md#type-assertions) for more information.
|
|||||||
|
|
||||||
### PrintToString {#PrintToString}
|
### PrintToString {#PrintToString}
|
||||||
|
|
||||||
`std::string ::testing::PrintToString(x)`
|
`std::string testing::PrintToString(x)`
|
||||||
|
|
||||||
Prints any value `x` using GoogleTest's value printer.
|
Prints any value `x` using GoogleTest's value printer.
|
||||||
|
|
||||||
@ -1420,7 +1420,7 @@ for more information.
|
|||||||
|
|
||||||
### PrintToStringParamName {#PrintToStringParamName}
|
### PrintToStringParamName {#PrintToStringParamName}
|
||||||
|
|
||||||
`std::string ::testing::PrintToStringParamName(TestParamInfo<T>& info)`
|
`std::string testing::PrintToStringParamName(TestParamInfo<T>& info)`
|
||||||
|
|
||||||
A built-in parameterized test name generator which returns the result of
|
A built-in parameterized test name generator which returns the result of
|
||||||
[`PrintToString`](#PrintToString) called on `info.param`. Does not work when the
|
[`PrintToString`](#PrintToString) called on `info.param`. Does not work when the
|
||||||
|
Loading…
Reference in New Issue
Block a user