grpc
third_party
protobuf
third_party
googletest
googletest
test
protobuf/third_party/googletest/googletest/test/googletest-env-var-test_.cc
Go to the documentation of this file.
1
// Copyright 2008, Google Inc.
2
// All rights reserved.
3
//
4
// Redistribution and use in source and binary forms, with or without
5
// modification, are permitted provided that the following conditions are
6
// met:
7
//
8
// * Redistributions of source code must retain the above copyright
9
// notice, this list of conditions and the following disclaimer.
10
// * Redistributions in binary form must reproduce the above
11
// copyright notice, this list of conditions and the following disclaimer
12
// in the documentation and/or other materials provided with the
13
// distribution.
14
// * Neither the name of Google Inc. nor the names of its
15
// contributors may be used to endorse or promote products derived from
16
// this software without specific prior written permission.
17
//
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30
31
// A helper program for testing that Google Test parses the environment
32
// variables correctly.
33
34
#include <iostream>
35
36
#include "gtest/gtest.h"
37
#include "src/gtest-internal-inl.h"
38
39
using ::std::cout;
40
41
namespace
testing
{
42
43
// The purpose of this is to make the test more realistic by ensuring
44
// that the UnitTest singleton is created before main() is entered.
45
// We don't actual run the TEST itself.
46
TEST
(GTestEnvVarTest,
Dummy
) {
47
}
48
49
void
PrintFlag
(
const
char
*
flag
) {
50
if
(strcmp(
flag
,
"break_on_failure"
) == 0) {
51
cout <<
GTEST_FLAG
(break_on_failure);
52
return
;
53
}
54
55
if
(strcmp(
flag
,
"catch_exceptions"
) == 0) {
56
cout <<
GTEST_FLAG
(catch_exceptions);
57
return
;
58
}
59
60
if
(strcmp(
flag
,
"color"
) == 0) {
61
cout <<
GTEST_FLAG
(color);
62
return
;
63
}
64
65
if
(strcmp(
flag
,
"death_test_style"
) == 0) {
66
cout <<
GTEST_FLAG
(death_test_style);
67
return
;
68
}
69
70
if
(strcmp(
flag
,
"death_test_use_fork"
) == 0) {
71
cout <<
GTEST_FLAG
(death_test_use_fork);
72
return
;
73
}
74
75
if
(strcmp(
flag
,
"filter"
) == 0) {
76
cout <<
GTEST_FLAG
(filter);
77
return
;
78
}
79
80
if
(strcmp(
flag
,
"output"
) == 0) {
81
cout <<
GTEST_FLAG
(
output
);
82
return
;
83
}
84
85
if
(strcmp(
flag
,
"print_time"
) == 0) {
86
cout <<
GTEST_FLAG
(print_time);
87
return
;
88
}
89
90
if
(strcmp(
flag
,
"repeat"
) == 0) {
91
cout <<
GTEST_FLAG
(repeat);
92
return
;
93
}
94
95
if
(strcmp(
flag
,
"stack_trace_depth"
) == 0) {
96
cout <<
GTEST_FLAG
(stack_trace_depth);
97
return
;
98
}
99
100
if
(strcmp(
flag
,
"throw_on_failure"
) == 0) {
101
cout <<
GTEST_FLAG
(throw_on_failure);
102
return
;
103
}
104
105
cout <<
"Invalid flag name "
<<
flag
106
<<
". Valid names are break_on_failure, color, filter, etc.\n"
;
107
exit(1);
108
}
109
110
}
// namespace testing
111
112
int
main
(
int
argc,
char
** argv) {
113
testing::InitGoogleTest
(&argc, argv);
114
115
if
(argc != 2) {
116
cout <<
"Usage: googletest-env-var-test_ NAME_OF_FLAG\n"
;
117
return
1;
118
}
119
120
testing::PrintFlag
(argv[1]);
121
return
0;
122
}
flag
uint32_t flag
Definition:
ssl_versions.cc:162
testing
Definition:
aws_request_signer_test.cc:25
gmock_output_test.output
output
Definition:
bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
testing::gmock_generated_actions_test::Dummy
int Dummy(bool flag)
Definition:
bloaty/third_party/googletest/googlemock/test/gmock-generated-actions_test.cc:492
main
int main(int argc, char **argv)
Definition:
protobuf/third_party/googletest/googletest/test/googletest-env-var-test_.cc:112
GTEST_FLAG
#define GTEST_FLAG(name)
Definition:
bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:2169
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition:
bloaty/third_party/googletest/googletest/src/gtest.cc:6106
testing::PrintFlag
void PrintFlag(const char *flag)
Definition:
bloaty/third_party/googletest/googletest/test/googletest-env-var-test_.cc:49
testing::TEST
TEST(GrpcAwsRequestSignerTest, AWSOfficialExample)
Definition:
aws_request_signer_test.cc:68
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:40