mirror of
https://github.com/google/googletest.git
synced 2025-12-22 03:24:56 +08:00
Merge branch 'google:main' into master
This commit is contained in:
commit
ba5f9b5e54
@ -17,7 +17,7 @@ See [Supported Platforms](platforms.md) for more information about platforms
|
|||||||
compatible with GoogleTest.
|
compatible with GoogleTest.
|
||||||
|
|
||||||
If you don't already have Bazel installed, see the
|
If you don't already have Bazel installed, see the
|
||||||
[Bazel installation guide](https://docs.bazel.build/versions/master/install.html).
|
[Bazel installation guide](https://docs.bazel.build/versions/main/install.html).
|
||||||
|
|
||||||
{: .callout .note}
|
{: .callout .note}
|
||||||
Note: The terminal commands in this tutorial show a Unix shell prompt, but the
|
Note: The terminal commands in this tutorial show a Unix shell prompt, but the
|
||||||
@ -26,7 +26,7 @@ commands work on the Windows command line as well.
|
|||||||
## Set up a Bazel workspace
|
## Set up a Bazel workspace
|
||||||
|
|
||||||
A
|
A
|
||||||
[Bazel workspace](https://docs.bazel.build/versions/master/build-ref.html#workspace)
|
[Bazel workspace](https://docs.bazel.build/versions/main/build-ref.html#workspace)
|
||||||
is a directory on your filesystem that you use to manage source files for the
|
is a directory on your filesystem that you use to manage source files for the
|
||||||
software you want to build. Each workspace directory has a text file named
|
software you want to build. Each workspace directory has a text file named
|
||||||
`WORKSPACE` which may be empty, or may contain references to external
|
`WORKSPACE` which may be empty, or may contain references to external
|
||||||
@ -40,9 +40,9 @@ $ mkdir my_workspace && cd my_workspace
|
|||||||
|
|
||||||
Next, you’ll create the `WORKSPACE` file to specify dependencies. A common and
|
Next, you’ll create the `WORKSPACE` file to specify dependencies. A common and
|
||||||
recommended way to depend on GoogleTest is to use a
|
recommended way to depend on GoogleTest is to use a
|
||||||
[Bazel external dependency](https://docs.bazel.build/versions/master/external.html)
|
[Bazel external dependency](https://docs.bazel.build/versions/main/external.html)
|
||||||
via the
|
via the
|
||||||
[`http_archive` rule](https://docs.bazel.build/versions/master/repo/http.html#http_archive).
|
[`http_archive` rule](https://docs.bazel.build/versions/main/repo/http.html#http_archive).
|
||||||
To do this, in the root directory of your workspace (`my_workspace/`), create a
|
To do this, in the root directory of your workspace (`my_workspace/`), create a
|
||||||
file named `WORKSPACE` with the following contents:
|
file named `WORKSPACE` with the following contents:
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ This `cc_test` rule declares the C++ test binary you want to build, and links to
|
|||||||
GoogleTest (`//:gtest_main`) using the prefix you specified in the `WORKSPACE`
|
GoogleTest (`//:gtest_main`) using the prefix you specified in the `WORKSPACE`
|
||||||
file (`@com_google_googletest`). For more information about Bazel `BUILD` files,
|
file (`@com_google_googletest`). For more information about Bazel `BUILD` files,
|
||||||
see the
|
see the
|
||||||
[Bazel C++ Tutorial](https://docs.bazel.build/versions/master/tutorial/cpp.html).
|
[Bazel C++ Tutorial](https://docs.bazel.build/versions/main/tutorial/cpp.html).
|
||||||
|
|
||||||
Now you can build and run your test:
|
Now you can build and run your test:
|
||||||
|
|
||||||
|
|||||||
@ -264,10 +264,10 @@ void ExpectationBase::UntypedTimes(const Cardinality& a_cardinality) {
|
|||||||
".Times() cannot appear "
|
".Times() cannot appear "
|
||||||
"more than once in an EXPECT_CALL().");
|
"more than once in an EXPECT_CALL().");
|
||||||
} else {
|
} else {
|
||||||
ExpectSpecProperty(last_clause_ < kTimes,
|
ExpectSpecProperty(
|
||||||
".Times() cannot appear after "
|
last_clause_ < kTimes,
|
||||||
".InSequence(), .WillOnce(), .WillRepeatedly(), "
|
".Times() may only appear *before* .InSequence(), .WillOnce(), "
|
||||||
"or .RetiresOnSaturation().");
|
".WillRepeatedly(), or .RetiresonSaturation(), not after.");
|
||||||
}
|
}
|
||||||
last_clause_ = kTimes;
|
last_clause_ = kTimes;
|
||||||
|
|
||||||
|
|||||||
@ -390,7 +390,7 @@ TEST(ExpectCallSyntaxTest, TimesMustBeBeforeInSequence) {
|
|||||||
EXPECT_CALL(a, DoA(1))
|
EXPECT_CALL(a, DoA(1))
|
||||||
.InSequence(s)
|
.InSequence(s)
|
||||||
.Times(1);
|
.Times(1);
|
||||||
}, ".Times() cannot appear after ");
|
}, ".Times() may only appear *before* ");
|
||||||
|
|
||||||
a.DoA(1);
|
a.DoA(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user