Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include "gtest/gtest.h"
00036
00037 #include <iostream>
00038
00039 #define GTEST_IMPLEMENTATION_ 1
00040 #include "src/gtest-internal-inl.h"
00041 #undef GTEST_IMPLEMENTATION_
00042
00043 using ::std::cout;
00044
00045 namespace testing {
00046
00047
00048
00049
00050 TEST(GTestEnvVarTest, Dummy) {
00051 }
00052
00053 void PrintFlag(const char* flag) {
00054 if (strcmp(flag, "break_on_failure") == 0) {
00055 cout << GTEST_FLAG(break_on_failure);
00056 return;
00057 }
00058
00059 if (strcmp(flag, "catch_exceptions") == 0) {
00060 cout << GTEST_FLAG(catch_exceptions);
00061 return;
00062 }
00063
00064 if (strcmp(flag, "color") == 0) {
00065 cout << GTEST_FLAG(color);
00066 return;
00067 }
00068
00069 if (strcmp(flag, "death_test_style") == 0) {
00070 cout << GTEST_FLAG(death_test_style);
00071 return;
00072 }
00073
00074 if (strcmp(flag, "death_test_use_fork") == 0) {
00075 cout << GTEST_FLAG(death_test_use_fork);
00076 return;
00077 }
00078
00079 if (strcmp(flag, "filter") == 0) {
00080 cout << GTEST_FLAG(filter);
00081 return;
00082 }
00083
00084 if (strcmp(flag, "output") == 0) {
00085 cout << GTEST_FLAG(output);
00086 return;
00087 }
00088
00089 if (strcmp(flag, "print_time") == 0) {
00090 cout << GTEST_FLAG(print_time);
00091 return;
00092 }
00093
00094 if (strcmp(flag, "repeat") == 0) {
00095 cout << GTEST_FLAG(repeat);
00096 return;
00097 }
00098
00099 if (strcmp(flag, "stack_trace_depth") == 0) {
00100 cout << GTEST_FLAG(stack_trace_depth);
00101 return;
00102 }
00103
00104 if (strcmp(flag, "throw_on_failure") == 0) {
00105 cout << GTEST_FLAG(throw_on_failure);
00106 return;
00107 }
00108
00109 cout << "Invalid flag name " << flag
00110 << ". Valid names are break_on_failure, color, filter, etc.\n";
00111 exit(1);
00112 }
00113
00114 }
00115
00116 int main(int argc, char** argv) {
00117 testing::InitGoogleTest(&argc, argv);
00118
00119 if (argc != 2) {
00120 cout << "Usage: gtest_env_var_test_ NAME_OF_FLAG\n";
00121 return 1;
00122 }
00123
00124 testing::PrintFlag(argv[1]);
00125 return 0;
00126 }