mirror of
https://github.com/google/googletest.git
synced 2025-11-09 22:53:36 -05:00
Running clang-format over all of GoogleTest
A few tests are examining code locations and looking af the resulting line numbers to verify that GoogleTest shows those to users correctly. Some of those locations change when clang-format is run. For those locations, I've wrapped portions in: // clang-format off ... // clang-format on There may be other locations that are currently not tickled by running clang-format. PiperOrigin-RevId: 434844712 Change-Id: I3a9f0a6f39eff741c576b6de389bef9b1d11139d
This commit is contained in:
committed by
Copybara-Service
parent
8a422b8398
commit
b007c54f29
@@ -145,7 +145,7 @@ class Foo {
|
||||
|
||||
std::string Binary(const std::string& str, char c) const { return str + c; }
|
||||
|
||||
int Ternary(int x, bool y, char z) { return value_ + x + y*z; }
|
||||
int Ternary(int x, bool y, char z) { return value_ + x + y * z; }
|
||||
|
||||
int SumOf4(int a, int b, int c, int d) const {
|
||||
return a + b + c + d + value_;
|
||||
@@ -291,8 +291,7 @@ TEST(InvokeTest, FunctionWithUnusedParameters) {
|
||||
std::make_tuple(10, 2, 5.6, std::string("hi"));
|
||||
EXPECT_EQ(12, a1.Perform(dummy));
|
||||
|
||||
Action<int(int, int, bool, int*)> a2 =
|
||||
Invoke(SumOfFirst2);
|
||||
Action<int(int, int, bool, int*)> a2 = Invoke(SumOfFirst2);
|
||||
EXPECT_EQ(
|
||||
23, a2.Perform(std::make_tuple(20, 3, true, static_cast<int*>(nullptr))));
|
||||
}
|
||||
@@ -303,8 +302,7 @@ TEST(InvokeTest, MethodWithUnusedParameters) {
|
||||
Action<int(std::string, bool, int, int)> a1 = Invoke(&foo, &Foo::SumOfLast2);
|
||||
EXPECT_EQ(12, a1.Perform(std::make_tuple(CharPtr("hi"), true, 10, 2)));
|
||||
|
||||
Action<int(char, double, int, int)> a2 =
|
||||
Invoke(&foo, &Foo::SumOfLast2);
|
||||
Action<int(char, double, int, int)> a2 = Invoke(&foo, &Foo::SumOfLast2);
|
||||
EXPECT_EQ(23, a2.Perform(std::make_tuple('a', 2.5, 20, 3)));
|
||||
}
|
||||
|
||||
@@ -362,7 +360,8 @@ TEST(InvokeMethodTest, MethodThatTakes4Arguments) {
|
||||
// Tests using Invoke() with a 5-argument method.
|
||||
TEST(InvokeMethodTest, MethodThatTakes5Arguments) {
|
||||
Foo foo;
|
||||
Action<int(int, int, int, int, int)> a = Invoke(&foo, &Foo::SumOf5); // NOLINT
|
||||
Action<int(int, int, int, int, int)> a =
|
||||
Invoke(&foo, &Foo::SumOf5); // NOLINT
|
||||
EXPECT_EQ(12345, a.Perform(std::make_tuple(10000, 2000, 300, 40, 5)));
|
||||
}
|
||||
|
||||
@@ -523,15 +522,12 @@ TEST(SetArgRefereeActionTest, WorksWithExtraArguments) {
|
||||
// the bool provided to the constructor to true when destroyed.
|
||||
class DeletionTester {
|
||||
public:
|
||||
explicit DeletionTester(bool* is_deleted)
|
||||
: is_deleted_(is_deleted) {
|
||||
explicit DeletionTester(bool* is_deleted) : is_deleted_(is_deleted) {
|
||||
// Make sure the bit is set to false.
|
||||
*is_deleted_ = false;
|
||||
}
|
||||
|
||||
~DeletionTester() {
|
||||
*is_deleted_ = true;
|
||||
}
|
||||
~DeletionTester() { *is_deleted_ = true; }
|
||||
|
||||
private:
|
||||
bool* is_deleted_;
|
||||
@@ -540,7 +536,7 @@ class DeletionTester {
|
||||
TEST(DeleteArgActionTest, OneArg) {
|
||||
bool is_deleted = false;
|
||||
DeletionTester* t = new DeletionTester(&is_deleted);
|
||||
const Action<void(DeletionTester*)> a1 = DeleteArg<0>(); // NOLINT
|
||||
const Action<void(DeletionTester*)> a1 = DeleteArg<0>(); // NOLINT
|
||||
EXPECT_FALSE(is_deleted);
|
||||
a1.Perform(std::make_tuple(t));
|
||||
EXPECT_TRUE(is_deleted);
|
||||
@@ -549,8 +545,9 @@ TEST(DeleteArgActionTest, OneArg) {
|
||||
TEST(DeleteArgActionTest, TenArgs) {
|
||||
bool is_deleted = false;
|
||||
DeletionTester* t = new DeletionTester(&is_deleted);
|
||||
const Action<void(bool, int, int, const char*, bool,
|
||||
int, int, int, int, DeletionTester*)> a1 = DeleteArg<9>();
|
||||
const Action<void(bool, int, int, const char*, bool, int, int, int, int,
|
||||
DeletionTester*)>
|
||||
a1 = DeleteArg<9>();
|
||||
EXPECT_FALSE(is_deleted);
|
||||
a1.Perform(std::make_tuple(true, 5, 6, CharPtr("hi"), false, 7, 8, 9, 10, t));
|
||||
EXPECT_TRUE(is_deleted);
|
||||
@@ -608,7 +605,7 @@ TEST(ThrowActionTest, Times0) {
|
||||
// pointed to by the N-th (0-based) argument to values in range [first, last).
|
||||
TEST(SetArrayArgumentTest, SetsTheNthArray) {
|
||||
using MyFunction = void(bool, int*, char*);
|
||||
int numbers[] = { 1, 2, 3 };
|
||||
int numbers[] = {1, 2, 3};
|
||||
Action<MyFunction> a = SetArrayArgument<1>(numbers, numbers + 3);
|
||||
|
||||
int n[4] = {};
|
||||
@@ -644,7 +641,7 @@ TEST(SetArrayArgumentTest, SetsTheNthArray) {
|
||||
// Tests SetArrayArgument<N>(first, last) where first == last.
|
||||
TEST(SetArrayArgumentTest, SetsTheNthArrayWithEmptyRange) {
|
||||
using MyFunction = void(bool, int*);
|
||||
int numbers[] = { 1, 2, 3 };
|
||||
int numbers[] = {1, 2, 3};
|
||||
Action<MyFunction> a = SetArrayArgument<1>(numbers, numbers);
|
||||
|
||||
int n[4] = {};
|
||||
@@ -660,10 +657,10 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithEmptyRange) {
|
||||
// (but not equal) to the argument type.
|
||||
TEST(SetArrayArgumentTest, SetsTheNthArrayWithConvertibleType) {
|
||||
using MyFunction = void(bool, int*);
|
||||
char chars[] = { 97, 98, 99 };
|
||||
char chars[] = {97, 98, 99};
|
||||
Action<MyFunction> a = SetArrayArgument<1>(chars, chars + 3);
|
||||
|
||||
int codes[4] = { 111, 222, 333, 444 };
|
||||
int codes[4] = {111, 222, 333, 444};
|
||||
int* pcodes = codes;
|
||||
a.Perform(std::make_tuple(true, pcodes));
|
||||
EXPECT_EQ(97, codes[0]);
|
||||
|
||||
Reference in New Issue
Block a user