From 251e720391e92ab1aec845c7fd8ecdda35737f39 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 29 Jun 2023 14:39:44 -0700 Subject: [PATCH] Change `::testing` to `testing` in Testing Reference doc PiperOrigin-RevId: 544466397 Change-Id: Icb4d5fae38361cd75d47f908886831696eb2b1c9 --- docs/reference/testing.md | 70 +++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/docs/reference/testing.md b/docs/reference/testing.md index 877dfa32..17225a68 100644 --- a/docs/reference/testing.md +++ b/docs/reference/testing.md @@ -122,8 +122,8 @@ custom function can be used for more control: ```cpp INSTANTIATE_TEST_SUITE_P( MyInstantiation, MyTestSuite, - ::testing::Values(...), - [](const ::testing::TestParamInfo& info) { + testing::Values(...), + [](const testing::TestParamInfo& info) { // Can use info.param here to generate the test suffix std::string name = ... return name; @@ -148,7 +148,7 @@ type, for example: ```cpp template -class MyFixture : public ::testing::Test { +class MyFixture : public testing::Test { public: ... using List = std::list; @@ -324,7 +324,7 @@ Then the test code should look like: ```cpp 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} -`::testing::AssertionResult` +`testing::AssertionResult` 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} -`::testing::AssertionException` +`testing::AssertionException` Exception which can be thrown from [`TestEventListener::OnTestPartResult`](#TestEventListener::OnTestPartResult). ### EmptyTestEventListener {#EmptyTestEventListener} -`::testing::EmptyTestEventListener` +`testing::EmptyTestEventListener` Provides an empty implementation of all methods in the [`TestEventListener`](#TestEventListener) interface, such that a subclass only @@ -416,7 +416,7 @@ needs to override the methods it cares about. ### Environment {#Environment} -`::testing::Environment` +`testing::Environment` Represents a global test environment. See [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} -`::testing::ScopedTrace` +`testing::ScopedTrace` 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` @@ -453,7 +453,7 @@ ScopedTrace(const char* file, int line, const T& message) Example usage: ```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 @@ -464,7 +464,7 @@ See also [`SCOPED_TRACE`](#SCOPED_TRACE). ### Test {#Test} -`::testing::Test` +`testing::Test` The abstract class that all tests inherit from. `Test` is not copyable. @@ -552,7 +552,7 @@ after running each individual test. ### TestWithParam {#TestWithParam} -`::testing::TestWithParam` +`testing::TestWithParam` A convenience class which inherits from both [`Test`](#Test) and [`WithParamInterface`](#WithParamInterface). @@ -672,7 +672,7 @@ during execution of `SetUpTestSuite` and `TearDownTestSuite`. ### TestInfo {#TestInfo} -`::testing::TestInfo` +`testing::TestInfo` Stores information about a test. @@ -751,7 +751,7 @@ Returns the result of the test. See [`TestResult`](#TestResult). ### TestParamInfo {#TestParamInfo} -`::testing::TestParamInfo` +`testing::TestParamInfo` Describes a parameter to a value-parameterized test. The type `T` is the type of the parameter. @@ -761,7 +761,7 @@ and its integer index respectively. ### UnitTest {#UnitTest} -`::testing::UnitTest` +`testing::UnitTest` This class contains information about the test program. @@ -929,7 +929,7 @@ GoogleTest. See [`TestEventListeners`](#TestEventListeners). ### TestEventListener {#TestEventListener} -`::testing::TestEventListener` +`testing::TestEventListener` The interface for tracing execution of tests. The methods below are listed in the order the corresponding events are fired. @@ -1027,7 +1027,7 @@ Fired after all test activities have ended. ### TestEventListeners {#TestEventListeners} -`::testing::TestEventListeners` +`testing::TestEventListeners` 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} -`::testing::TestPartResult` +`testing::TestPartResult` A copyable object representing the result of a test part (i.e. an assertion or an explicit `FAIL()`, `ADD_FAILURE()`, or `SUCCESS()`). @@ -1154,7 +1154,7 @@ Returns true if and only if the test part failed. ### TestProperty {#TestProperty} -`::testing::TestProperty` +`testing::TestProperty` A copyable object representing a user-specified test property which can be output as a key/value string pair. @@ -1181,7 +1181,7 @@ Sets a new value, overriding the previous one. ### TestResult {#TestResult} -`::testing::TestResult` +`testing::TestResult` Contains information about the result of a single test. @@ -1262,20 +1262,20 @@ range, aborts the program. ### TimeInMillis {#TimeInMillis} -`::testing::TimeInMillis` +`testing::TimeInMillis` An integer type representing time in milliseconds. ### Types {#Types} -`::testing::Types` +`testing::Types` 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: ``` -::testing::Types +testing::Types ``` See [Typed Tests](../advanced.md#typed-tests) and @@ -1284,7 +1284,7 @@ information. ### WithParamInterface {#WithParamInterface} -`::testing::WithParamInterface` +`testing::WithParamInterface` The pure interface class that all value-parameterized tests inherit from. @@ -1310,9 +1310,9 @@ tests. ### InitGoogleTest {#InitGoogleTest} -`void ::testing::InitGoogleTest(int* argc, char** argv)` \ -`void ::testing::InitGoogleTest(int* argc, wchar_t** argv)` \ -`void ::testing::InitGoogleTest()` +`void testing::InitGoogleTest(int* argc, char** argv)` \ +`void testing::InitGoogleTest(int* argc, wchar_t** argv)` \ +`void testing::InitGoogleTest()` Initializes GoogleTest. This must be called before calling [`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} -`Environment* ::testing::AddGlobalTestEnvironment(Environment* env)` +`Environment* testing::AddGlobalTestEnvironment(Environment* env)` Adds a test environment to the test program. Must be called before [`RUN_ALL_TESTS()`](#RUN_ALL_TESTS) is called. See @@ -1342,7 +1342,7 @@ See also [`Environment`](#Environment). ```cpp template -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* file, int line, Factory factory) ``` @@ -1381,27 +1381,27 @@ an all-caps name. ### AssertionSuccess {#AssertionSuccess} -`AssertionResult ::testing::AssertionSuccess()` +`AssertionResult testing::AssertionSuccess()` Creates a successful assertion result. See [`AssertionResult`](#AssertionResult). ### AssertionFailure {#AssertionFailure} -`AssertionResult ::testing::AssertionFailure()` +`AssertionResult testing::AssertionFailure()` Creates a failed assertion result. Use the `<<` operator to store a failure message: ```cpp -::testing::AssertionFailure() << "My failure message"; +testing::AssertionFailure() << "My failure message"; ``` See [`AssertionResult`](#AssertionResult). ### StaticAssertTypeEq {#StaticAssertTypeEq} -`::testing::StaticAssertTypeEq()` +`testing::StaticAssertTypeEq()` Compile-time assertion for type equality. Compiles if and only if `T1` and `T2` 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} -`std::string ::testing::PrintToString(x)` +`std::string testing::PrintToString(x)` Prints any value `x` using GoogleTest's value printer. @@ -1420,7 +1420,7 @@ for more information. ### PrintToStringParamName {#PrintToStringParamName} -`std::string ::testing::PrintToStringParamName(TestParamInfo& info)` +`std::string testing::PrintToStringParamName(TestParamInfo& info)` A built-in parameterized test name generator which returns the result of [`PrintToString`](#PrintToString) called on `info.param`. Does not work when the