Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
c0563458
Unverified
Commit
c0563458
authored
Feb 23, 2018
by
Gennadiy Civil
Committed by
GitHub
Feb 23, 2018
Browse files
Merge pull request #1473 from gennadiycivil/master
merging unitests
parents
70e1aad7
b7e0294c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
62 deletions
+63
-62
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+63
-62
No files found.
googletest/test/gtest_unittest.cc
View file @
c0563458
...
@@ -5454,7 +5454,8 @@ TEST_F(SetUpTestCaseTest, Test2) {
...
@@ -5454,7 +5454,8 @@ TEST_F(SetUpTestCaseTest, Test2) {
EXPECT_STREQ
(
"123"
,
shared_resource_
);
EXPECT_STREQ
(
"123"
,
shared_resource_
);
}
}
// The InitGoogleTestTest test case tests testing::InitGoogleTest().
// The ParseFlagsTest test case tests ParseGoogleTestFlagsOnly.
// The Flags struct stores a copy of all Google Test flags.
// The Flags struct stores a copy of all Google Test flags.
struct
Flags
{
struct
Flags
{
...
@@ -5540,8 +5541,8 @@ struct Flags {
...
@@ -5540,8 +5541,8 @@ struct Flags {
return
flags
;
return
flags
;
}
}
// Creates a Flags struct where the gtest_random_seed flag has
// Creates a Flags struct where the gtest_random_seed flag has
the given
//
the given
value.
// value.
static
Flags
RandomSeed
(
Int32
random_seed
)
{
static
Flags
RandomSeed
(
Int32
random_seed
)
{
Flags
flags
;
Flags
flags
;
flags
.
random_seed
=
random_seed
;
flags
.
random_seed
=
random_seed
;
...
@@ -5556,8 +5557,8 @@ struct Flags {
...
@@ -5556,8 +5557,8 @@ struct Flags {
return
flags
;
return
flags
;
}
}
// Creates a Flags struct where the gtest_shuffle flag has
// Creates a Flags struct where the gtest_shuffle flag has
the given
//
the given
value.
// value.
static
Flags
Shuffle
(
bool
shuffle
)
{
static
Flags
Shuffle
(
bool
shuffle
)
{
Flags
flags
;
Flags
flags
;
flags
.
shuffle
=
shuffle
;
flags
.
shuffle
=
shuffle
;
...
@@ -5605,8 +5606,8 @@ struct Flags {
...
@@ -5605,8 +5606,8 @@ struct Flags {
bool
throw_on_failure
;
bool
throw_on_failure
;
};
};
// Fixture for testing
Init
GoogleTest().
// Fixture for testing
Parse
GoogleTest
FlagsOnly
().
class
InitGoogleTest
Test
:
public
Test
{
class
ParseFlags
Test
:
public
Test
{
protected:
protected:
// Clears the flags before each test.
// Clears the flags before each test.
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
...
@@ -5667,16 +5668,16 @@ class InitGoogleTestTest : public Test {
...
@@ -5667,16 +5668,16 @@ class InitGoogleTestTest : public Test {
const
bool
saved_help_flag
=
::
testing
::
internal
::
g_help_flag
;
const
bool
saved_help_flag
=
::
testing
::
internal
::
g_help_flag
;
::
testing
::
internal
::
g_help_flag
=
false
;
::
testing
::
internal
::
g_help_flag
=
false
;
#if GTEST_HAS_STREAM_REDIRECTION
#
if GTEST_HAS_STREAM_REDIRECTION
CaptureStdout
();
CaptureStdout
();
#endif
#
endif
// Parses the command line.
// Parses the command line.
internal
::
ParseGoogleTestFlagsOnly
(
&
argc1
,
const_cast
<
CharType
**>
(
argv1
));
internal
::
ParseGoogleTestFlagsOnly
(
&
argc1
,
const_cast
<
CharType
**>
(
argv1
));
#if GTEST_HAS_STREAM_REDIRECTION
#
if GTEST_HAS_STREAM_REDIRECTION
const
std
::
string
captured_stdout
=
GetCapturedStdout
();
const
std
::
string
captured_stdout
=
GetCapturedStdout
();
#endif
#
endif
// Verifies the flag values.
// Verifies the flag values.
CheckFlags
(
expected
);
CheckFlags
(
expected
);
...
@@ -5689,7 +5690,7 @@ class InitGoogleTestTest : public Test {
...
@@ -5689,7 +5690,7 @@ class InitGoogleTestTest : public Test {
// help message for the flags it recognizes.
// help message for the flags it recognizes.
EXPECT_EQ
(
should_print_help
,
::
testing
::
internal
::
g_help_flag
);
EXPECT_EQ
(
should_print_help
,
::
testing
::
internal
::
g_help_flag
);
#if GTEST_HAS_STREAM_REDIRECTION
#
if GTEST_HAS_STREAM_REDIRECTION
const
char
*
const
expected_help_fragment
=
const
char
*
const
expected_help_fragment
=
"This program contains tests written using"
;
"This program contains tests written using"
;
if
(
should_print_help
)
{
if
(
should_print_help
)
{
...
@@ -5698,7 +5699,7 @@ class InitGoogleTestTest : public Test {
...
@@ -5698,7 +5699,7 @@ class InitGoogleTestTest : public Test {
EXPECT_PRED_FORMAT2
(
IsNotSubstring
,
EXPECT_PRED_FORMAT2
(
IsNotSubstring
,
expected_help_fragment
,
captured_stdout
);
expected_help_fragment
,
captured_stdout
);
}
}
#endif // GTEST_HAS_STREAM_REDIRECTION
#
endif // GTEST_HAS_STREAM_REDIRECTION
::
testing
::
internal
::
g_help_flag
=
saved_help_flag
;
::
testing
::
internal
::
g_help_flag
=
saved_help_flag
;
}
}
...
@@ -5706,14 +5707,14 @@ class InitGoogleTestTest : public Test {
...
@@ -5706,14 +5707,14 @@ class InitGoogleTestTest : public Test {
// This macro wraps TestParsingFlags s.t. the user doesn't need
// This macro wraps TestParsingFlags s.t. the user doesn't need
// to specify the array sizes.
// to specify the array sizes.
#define GTEST_TEST_PARSING_FLAGS_(argv1, argv2, expected, should_print_help) \
#
define GTEST_TEST_PARSING_FLAGS_(argv1, argv2, expected, should_print_help) \
TestParsingFlags(sizeof(argv1)/sizeof(*argv1) - 1, argv1, \
TestParsingFlags(sizeof(argv1)/sizeof(*argv1) - 1, argv1, \
sizeof(argv2)/sizeof(*argv2) - 1, argv2, \
sizeof(argv2)/sizeof(*argv2) - 1, argv2, \
expected, should_print_help)
expected, should_print_help)
};
};
// Tests parsing an empty command line.
// Tests parsing an empty command line.
TEST_F
(
InitGoogleTest
Test
,
Empty
)
{
TEST_F
(
ParseFlags
Test
,
Empty
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
NULL
NULL
};
};
...
@@ -5726,7 +5727,7 @@ TEST_F(InitGoogleTestTest, Empty) {
...
@@ -5726,7 +5727,7 @@ TEST_F(InitGoogleTestTest, Empty) {
}
}
// Tests parsing a command line that has no flag.
// Tests parsing a command line that has no flag.
TEST_F
(
InitGoogleTest
Test
,
NoFlag
)
{
TEST_F
(
ParseFlags
Test
,
NoFlag
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
NULL
NULL
...
@@ -5741,7 +5742,7 @@ TEST_F(InitGoogleTestTest, NoFlag) {
...
@@ -5741,7 +5742,7 @@ TEST_F(InitGoogleTestTest, NoFlag) {
}
}
// Tests parsing a bad --gtest_filter flag.
// Tests parsing a bad --gtest_filter flag.
TEST_F
(
InitGoogleTest
Test
,
FilterBad
)
{
TEST_F
(
ParseFlags
Test
,
FilterBad
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_filter"
,
"--gtest_filter"
,
...
@@ -5758,7 +5759,7 @@ TEST_F(InitGoogleTestTest, FilterBad) {
...
@@ -5758,7 +5759,7 @@ TEST_F(InitGoogleTestTest, FilterBad) {
}
}
// Tests parsing an empty --gtest_filter flag.
// Tests parsing an empty --gtest_filter flag.
TEST_F
(
InitGoogleTest
Test
,
FilterEmpty
)
{
TEST_F
(
ParseFlags
Test
,
FilterEmpty
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_filter="
,
"--gtest_filter="
,
...
@@ -5774,7 +5775,7 @@ TEST_F(InitGoogleTestTest, FilterEmpty) {
...
@@ -5774,7 +5775,7 @@ TEST_F(InitGoogleTestTest, FilterEmpty) {
}
}
// Tests parsing a non-empty --gtest_filter flag.
// Tests parsing a non-empty --gtest_filter flag.
TEST_F
(
InitGoogleTest
Test
,
FilterNonEmpty
)
{
TEST_F
(
ParseFlags
Test
,
FilterNonEmpty
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_filter=abc"
,
"--gtest_filter=abc"
,
...
@@ -5790,7 +5791,7 @@ TEST_F(InitGoogleTestTest, FilterNonEmpty) {
...
@@ -5790,7 +5791,7 @@ TEST_F(InitGoogleTestTest, FilterNonEmpty) {
}
}
// Tests parsing --gtest_break_on_failure.
// Tests parsing --gtest_break_on_failure.
TEST_F
(
InitGoogleTest
Test
,
BreakOnFailureWithoutValue
)
{
TEST_F
(
ParseFlags
Test
,
BreakOnFailureWithoutValue
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_break_on_failure"
,
"--gtest_break_on_failure"
,
...
@@ -5806,7 +5807,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureWithoutValue) {
...
@@ -5806,7 +5807,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureWithoutValue) {
}
}
// Tests parsing --gtest_break_on_failure=0.
// Tests parsing --gtest_break_on_failure=0.
TEST_F
(
InitGoogleTest
Test
,
BreakOnFailureFalse_0
)
{
TEST_F
(
ParseFlags
Test
,
BreakOnFailureFalse_0
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_break_on_failure=0"
,
"--gtest_break_on_failure=0"
,
...
@@ -5822,7 +5823,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureFalse_0) {
...
@@ -5822,7 +5823,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureFalse_0) {
}
}
// Tests parsing --gtest_break_on_failure=f.
// Tests parsing --gtest_break_on_failure=f.
TEST_F
(
InitGoogleTest
Test
,
BreakOnFailureFalse_f
)
{
TEST_F
(
ParseFlags
Test
,
BreakOnFailureFalse_f
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_break_on_failure=f"
,
"--gtest_break_on_failure=f"
,
...
@@ -5838,7 +5839,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureFalse_f) {
...
@@ -5838,7 +5839,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureFalse_f) {
}
}
// Tests parsing --gtest_break_on_failure=F.
// Tests parsing --gtest_break_on_failure=F.
TEST_F
(
InitGoogleTest
Test
,
BreakOnFailureFalse_F
)
{
TEST_F
(
ParseFlags
Test
,
BreakOnFailureFalse_F
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_break_on_failure=F"
,
"--gtest_break_on_failure=F"
,
...
@@ -5855,7 +5856,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureFalse_F) {
...
@@ -5855,7 +5856,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureFalse_F) {
// Tests parsing a --gtest_break_on_failure flag that has a "true"
// Tests parsing a --gtest_break_on_failure flag that has a "true"
// definition.
// definition.
TEST_F
(
InitGoogleTest
Test
,
BreakOnFailureTrue
)
{
TEST_F
(
ParseFlags
Test
,
BreakOnFailureTrue
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_break_on_failure=1"
,
"--gtest_break_on_failure=1"
,
...
@@ -5871,7 +5872,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureTrue) {
...
@@ -5871,7 +5872,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureTrue) {
}
}
// Tests parsing --gtest_catch_exceptions.
// Tests parsing --gtest_catch_exceptions.
TEST_F
(
InitGoogleTest
Test
,
CatchExceptions
)
{
TEST_F
(
ParseFlags
Test
,
CatchExceptions
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_catch_exceptions"
,
"--gtest_catch_exceptions"
,
...
@@ -5887,7 +5888,7 @@ TEST_F(InitGoogleTestTest, CatchExceptions) {
...
@@ -5887,7 +5888,7 @@ TEST_F(InitGoogleTestTest, CatchExceptions) {
}
}
// Tests parsing --gtest_death_test_use_fork.
// Tests parsing --gtest_death_test_use_fork.
TEST_F
(
InitGoogleTest
Test
,
DeathTestUseFork
)
{
TEST_F
(
ParseFlags
Test
,
DeathTestUseFork
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_death_test_use_fork"
,
"--gtest_death_test_use_fork"
,
...
@@ -5904,7 +5905,7 @@ TEST_F(InitGoogleTestTest, DeathTestUseFork) {
...
@@ -5904,7 +5905,7 @@ TEST_F(InitGoogleTestTest, DeathTestUseFork) {
// Tests having the same flag twice with different values. The
// Tests having the same flag twice with different values. The
// expected behavior is that the one coming last takes precedence.
// expected behavior is that the one coming last takes precedence.
TEST_F
(
InitGoogleTest
Test
,
DuplicatedFlags
)
{
TEST_F
(
ParseFlags
Test
,
DuplicatedFlags
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_filter=a"
,
"--gtest_filter=a"
,
...
@@ -5921,7 +5922,7 @@ TEST_F(InitGoogleTestTest, DuplicatedFlags) {
...
@@ -5921,7 +5922,7 @@ TEST_F(InitGoogleTestTest, DuplicatedFlags) {
}
}
// Tests having an unrecognized flag on the command line.
// Tests having an unrecognized flag on the command line.
TEST_F
(
InitGoogleTest
Test
,
UnrecognizedFlag
)
{
TEST_F
(
ParseFlags
Test
,
UnrecognizedFlag
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_break_on_failure"
,
"--gtest_break_on_failure"
,
...
@@ -5943,7 +5944,7 @@ TEST_F(InitGoogleTestTest, UnrecognizedFlag) {
...
@@ -5943,7 +5944,7 @@ TEST_F(InitGoogleTestTest, UnrecognizedFlag) {
}
}
// Tests having a --gtest_list_tests flag
// Tests having a --gtest_list_tests flag
TEST_F
(
InitGoogleTest
Test
,
ListTestsFlag
)
{
TEST_F
(
ParseFlags
Test
,
ListTestsFlag
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_list_tests"
,
"--gtest_list_tests"
,
...
@@ -5959,7 +5960,7 @@ TEST_F(InitGoogleTestTest, ListTestsFlag) {
...
@@ -5959,7 +5960,7 @@ TEST_F(InitGoogleTestTest, ListTestsFlag) {
}
}
// Tests having a --gtest_list_tests flag with a "true" value
// Tests having a --gtest_list_tests flag with a "true" value
TEST_F
(
InitGoogleTest
Test
,
ListTestsTrue
)
{
TEST_F
(
ParseFlags
Test
,
ListTestsTrue
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_list_tests=1"
,
"--gtest_list_tests=1"
,
...
@@ -5975,7 +5976,7 @@ TEST_F(InitGoogleTestTest, ListTestsTrue) {
...
@@ -5975,7 +5976,7 @@ TEST_F(InitGoogleTestTest, ListTestsTrue) {
}
}
// Tests having a --gtest_list_tests flag with a "false" value
// Tests having a --gtest_list_tests flag with a "false" value
TEST_F
(
InitGoogleTest
Test
,
ListTestsFalse
)
{
TEST_F
(
ParseFlags
Test
,
ListTestsFalse
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_list_tests=0"
,
"--gtest_list_tests=0"
,
...
@@ -5991,7 +5992,7 @@ TEST_F(InitGoogleTestTest, ListTestsFalse) {
...
@@ -5991,7 +5992,7 @@ TEST_F(InitGoogleTestTest, ListTestsFalse) {
}
}
// Tests parsing --gtest_list_tests=f.
// Tests parsing --gtest_list_tests=f.
TEST_F
(
InitGoogleTest
Test
,
ListTestsFalse_f
)
{
TEST_F
(
ParseFlags
Test
,
ListTestsFalse_f
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_list_tests=f"
,
"--gtest_list_tests=f"
,
...
@@ -6007,7 +6008,7 @@ TEST_F(InitGoogleTestTest, ListTestsFalse_f) {
...
@@ -6007,7 +6008,7 @@ TEST_F(InitGoogleTestTest, ListTestsFalse_f) {
}
}
// Tests parsing --gtest_list_tests=F.
// Tests parsing --gtest_list_tests=F.
TEST_F
(
InitGoogleTest
Test
,
ListTestsFalse_F
)
{
TEST_F
(
ParseFlags
Test
,
ListTestsFalse_F
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_list_tests=F"
,
"--gtest_list_tests=F"
,
...
@@ -6023,7 +6024,7 @@ TEST_F(InitGoogleTestTest, ListTestsFalse_F) {
...
@@ -6023,7 +6024,7 @@ TEST_F(InitGoogleTestTest, ListTestsFalse_F) {
}
}
// Tests parsing --gtest_output (invalid).
// Tests parsing --gtest_output (invalid).
TEST_F
(
InitGoogleTest
Test
,
OutputEmpty
)
{
TEST_F
(
ParseFlags
Test
,
OutputEmpty
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_output"
,
"--gtest_output"
,
...
@@ -6040,7 +6041,7 @@ TEST_F(InitGoogleTestTest, OutputEmpty) {
...
@@ -6040,7 +6041,7 @@ TEST_F(InitGoogleTestTest, OutputEmpty) {
}
}
// Tests parsing --gtest_output=xml
// Tests parsing --gtest_output=xml
TEST_F
(
InitGoogleTest
Test
,
OutputXml
)
{
TEST_F
(
ParseFlags
Test
,
OutputXml
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_output=xml"
,
"--gtest_output=xml"
,
...
@@ -6056,7 +6057,7 @@ TEST_F(InitGoogleTestTest, OutputXml) {
...
@@ -6056,7 +6057,7 @@ TEST_F(InitGoogleTestTest, OutputXml) {
}
}
// Tests parsing --gtest_output=xml:file
// Tests parsing --gtest_output=xml:file
TEST_F
(
InitGoogleTest
Test
,
OutputXmlFile
)
{
TEST_F
(
ParseFlags
Test
,
OutputXmlFile
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_output=xml:file"
,
"--gtest_output=xml:file"
,
...
@@ -6072,7 +6073,7 @@ TEST_F(InitGoogleTestTest, OutputXmlFile) {
...
@@ -6072,7 +6073,7 @@ TEST_F(InitGoogleTestTest, OutputXmlFile) {
}
}
// Tests parsing --gtest_output=xml:directory/path/
// Tests parsing --gtest_output=xml:directory/path/
TEST_F
(
InitGoogleTest
Test
,
OutputXmlDirectory
)
{
TEST_F
(
ParseFlags
Test
,
OutputXmlDirectory
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_output=xml:directory/path/"
,
"--gtest_output=xml:directory/path/"
,
...
@@ -6089,7 +6090,7 @@ TEST_F(InitGoogleTestTest, OutputXmlDirectory) {
...
@@ -6089,7 +6090,7 @@ TEST_F(InitGoogleTestTest, OutputXmlDirectory) {
}
}
// Tests having a --gtest_print_time flag
// Tests having a --gtest_print_time flag
TEST_F
(
InitGoogleTest
Test
,
PrintTimeFlag
)
{
TEST_F
(
ParseFlags
Test
,
PrintTimeFlag
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_print_time"
,
"--gtest_print_time"
,
...
@@ -6105,7 +6106,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFlag) {
...
@@ -6105,7 +6106,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFlag) {
}
}
// Tests having a --gtest_print_time flag with a "true" value
// Tests having a --gtest_print_time flag with a "true" value
TEST_F
(
InitGoogleTest
Test
,
PrintTimeTrue
)
{
TEST_F
(
ParseFlags
Test
,
PrintTimeTrue
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_print_time=1"
,
"--gtest_print_time=1"
,
...
@@ -6121,7 +6122,7 @@ TEST_F(InitGoogleTestTest, PrintTimeTrue) {
...
@@ -6121,7 +6122,7 @@ TEST_F(InitGoogleTestTest, PrintTimeTrue) {
}
}
// Tests having a --gtest_print_time flag with a "false" value
// Tests having a --gtest_print_time flag with a "false" value
TEST_F
(
InitGoogleTest
Test
,
PrintTimeFalse
)
{
TEST_F
(
ParseFlags
Test
,
PrintTimeFalse
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_print_time=0"
,
"--gtest_print_time=0"
,
...
@@ -6137,7 +6138,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFalse) {
...
@@ -6137,7 +6138,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFalse) {
}
}
// Tests parsing --gtest_print_time=f.
// Tests parsing --gtest_print_time=f.
TEST_F
(
InitGoogleTest
Test
,
PrintTimeFalse_f
)
{
TEST_F
(
ParseFlags
Test
,
PrintTimeFalse_f
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_print_time=f"
,
"--gtest_print_time=f"
,
...
@@ -6153,7 +6154,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFalse_f) {
...
@@ -6153,7 +6154,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFalse_f) {
}
}
// Tests parsing --gtest_print_time=F.
// Tests parsing --gtest_print_time=F.
TEST_F
(
InitGoogleTest
Test
,
PrintTimeFalse_F
)
{
TEST_F
(
ParseFlags
Test
,
PrintTimeFalse_F
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_print_time=F"
,
"--gtest_print_time=F"
,
...
@@ -6169,7 +6170,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFalse_F) {
...
@@ -6169,7 +6170,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFalse_F) {
}
}
// Tests parsing --gtest_random_seed=number
// Tests parsing --gtest_random_seed=number
TEST_F
(
InitGoogleTest
Test
,
RandomSeed
)
{
TEST_F
(
ParseFlags
Test
,
RandomSeed
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_random_seed=1000"
,
"--gtest_random_seed=1000"
,
...
@@ -6185,7 +6186,7 @@ TEST_F(InitGoogleTestTest, RandomSeed) {
...
@@ -6185,7 +6186,7 @@ TEST_F(InitGoogleTestTest, RandomSeed) {
}
}
// Tests parsing --gtest_repeat=number
// Tests parsing --gtest_repeat=number
TEST_F
(
InitGoogleTest
Test
,
Repeat
)
{
TEST_F
(
ParseFlags
Test
,
Repeat
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_repeat=1000"
,
"--gtest_repeat=1000"
,
...
@@ -6201,7 +6202,7 @@ TEST_F(InitGoogleTestTest, Repeat) {
...
@@ -6201,7 +6202,7 @@ TEST_F(InitGoogleTestTest, Repeat) {
}
}
// Tests having a --gtest_also_run_disabled_tests flag
// Tests having a --gtest_also_run_disabled_tests flag
TEST_F
(
InitGoogleTest
Test
,
AlsoRunDisabledTestsFlag
)
{
TEST_F
(
ParseFlags
Test
,
AlsoRunDisabledTestsFlag
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_also_run_disabled_tests"
,
"--gtest_also_run_disabled_tests"
,
...
@@ -6218,7 +6219,7 @@ TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFlag) {
...
@@ -6218,7 +6219,7 @@ TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFlag) {
}
}
// Tests having a --gtest_also_run_disabled_tests flag with a "true" value
// Tests having a --gtest_also_run_disabled_tests flag with a "true" value
TEST_F
(
InitGoogleTest
Test
,
AlsoRunDisabledTestsTrue
)
{
TEST_F
(
ParseFlags
Test
,
AlsoRunDisabledTestsTrue
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_also_run_disabled_tests=1"
,
"--gtest_also_run_disabled_tests=1"
,
...
@@ -6235,7 +6236,7 @@ TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsTrue) {
...
@@ -6235,7 +6236,7 @@ TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsTrue) {
}
}
// Tests having a --gtest_also_run_disabled_tests flag with a "false" value
// Tests having a --gtest_also_run_disabled_tests flag with a "false" value
TEST_F
(
InitGoogleTest
Test
,
AlsoRunDisabledTestsFalse
)
{
TEST_F
(
ParseFlags
Test
,
AlsoRunDisabledTestsFalse
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_also_run_disabled_tests=0"
,
"--gtest_also_run_disabled_tests=0"
,
...
@@ -6252,7 +6253,7 @@ TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFalse) {
...
@@ -6252,7 +6253,7 @@ TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFalse) {
}
}
// Tests parsing --gtest_shuffle.
// Tests parsing --gtest_shuffle.
TEST_F
(
InitGoogleTest
Test
,
ShuffleWithoutValue
)
{
TEST_F
(
ParseFlags
Test
,
ShuffleWithoutValue
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_shuffle"
,
"--gtest_shuffle"
,
...
@@ -6268,7 +6269,7 @@ TEST_F(InitGoogleTestTest, ShuffleWithoutValue) {
...
@@ -6268,7 +6269,7 @@ TEST_F(InitGoogleTestTest, ShuffleWithoutValue) {
}
}
// Tests parsing --gtest_shuffle=0.
// Tests parsing --gtest_shuffle=0.
TEST_F
(
InitGoogleTest
Test
,
ShuffleFalse_0
)
{
TEST_F
(
ParseFlags
Test
,
ShuffleFalse_0
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_shuffle=0"
,
"--gtest_shuffle=0"
,
...
@@ -6283,9 +6284,8 @@ TEST_F(InitGoogleTestTest, ShuffleFalse_0) {
...
@@ -6283,9 +6284,8 @@ TEST_F(InitGoogleTestTest, ShuffleFalse_0) {
GTEST_TEST_PARSING_FLAGS_
(
argv
,
argv2
,
Flags
::
Shuffle
(
false
),
false
);
GTEST_TEST_PARSING_FLAGS_
(
argv
,
argv2
,
Flags
::
Shuffle
(
false
),
false
);
}
}
// Tests parsing a --gtest_shuffle flag that has a "true"
// Tests parsing a --gtest_shuffle flag that has a "true" definition.
// definition.
TEST_F
(
ParseFlagsTest
,
ShuffleTrue
)
{
TEST_F
(
InitGoogleTestTest
,
ShuffleTrue
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_shuffle=1"
,
"--gtest_shuffle=1"
,
...
@@ -6301,7 +6301,7 @@ TEST_F(InitGoogleTestTest, ShuffleTrue) {
...
@@ -6301,7 +6301,7 @@ TEST_F(InitGoogleTestTest, ShuffleTrue) {
}
}
// Tests parsing --gtest_stack_trace_depth=number.
// Tests parsing --gtest_stack_trace_depth=number.
TEST_F
(
InitGoogleTest
Test
,
StackTraceDepth
)
{
TEST_F
(
ParseFlags
Test
,
StackTraceDepth
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_stack_trace_depth=5"
,
"--gtest_stack_trace_depth=5"
,
...
@@ -6316,7 +6316,7 @@ TEST_F(InitGoogleTestTest, StackTraceDepth) {
...
@@ -6316,7 +6316,7 @@ TEST_F(InitGoogleTestTest, StackTraceDepth) {
GTEST_TEST_PARSING_FLAGS_
(
argv
,
argv2
,
Flags
::
StackTraceDepth
(
5
),
false
);
GTEST_TEST_PARSING_FLAGS_
(
argv
,
argv2
,
Flags
::
StackTraceDepth
(
5
),
false
);
}
}
TEST_F
(
InitGoogleTest
Test
,
StreamResultTo
)
{
TEST_F
(
ParseFlags
Test
,
StreamResultTo
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_stream_result_to=localhost:1234"
,
"--gtest_stream_result_to=localhost:1234"
,
...
@@ -6333,7 +6333,7 @@ TEST_F(InitGoogleTestTest, StreamResultTo) {
...
@@ -6333,7 +6333,7 @@ TEST_F(InitGoogleTestTest, StreamResultTo) {
}
}
// Tests parsing --gtest_throw_on_failure.
// Tests parsing --gtest_throw_on_failure.
TEST_F
(
InitGoogleTest
Test
,
ThrowOnFailureWithoutValue
)
{
TEST_F
(
ParseFlags
Test
,
ThrowOnFailureWithoutValue
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_throw_on_failure"
,
"--gtest_throw_on_failure"
,
...
@@ -6349,7 +6349,7 @@ TEST_F(InitGoogleTestTest, ThrowOnFailureWithoutValue) {
...
@@ -6349,7 +6349,7 @@ TEST_F(InitGoogleTestTest, ThrowOnFailureWithoutValue) {
}
}
// Tests parsing --gtest_throw_on_failure=0.
// Tests parsing --gtest_throw_on_failure=0.
TEST_F
(
InitGoogleTest
Test
,
ThrowOnFailureFalse_0
)
{
TEST_F
(
ParseFlags
Test
,
ThrowOnFailureFalse_0
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_throw_on_failure=0"
,
"--gtest_throw_on_failure=0"
,
...
@@ -6366,7 +6366,7 @@ TEST_F(InitGoogleTestTest, ThrowOnFailureFalse_0) {
...
@@ -6366,7 +6366,7 @@ TEST_F(InitGoogleTestTest, ThrowOnFailureFalse_0) {
// Tests parsing a --gtest_throw_on_failure flag that has a "true"
// Tests parsing a --gtest_throw_on_failure flag that has a "true"
// definition.
// definition.
TEST_F
(
InitGoogleTest
Test
,
ThrowOnFailureTrue
)
{
TEST_F
(
ParseFlags
Test
,
ThrowOnFailureTrue
)
{
const
char
*
argv
[]
=
{
const
char
*
argv
[]
=
{
"foo.exe"
,
"foo.exe"
,
"--gtest_throw_on_failure=1"
,
"--gtest_throw_on_failure=1"
,
...
@@ -6381,9 +6381,9 @@ TEST_F(InitGoogleTestTest, ThrowOnFailureTrue) {
...
@@ -6381,9 +6381,9 @@ TEST_F(InitGoogleTestTest, ThrowOnFailureTrue) {
GTEST_TEST_PARSING_FLAGS_
(
argv
,
argv2
,
Flags
::
ThrowOnFailure
(
true
),
false
);
GTEST_TEST_PARSING_FLAGS_
(
argv
,
argv2
,
Flags
::
ThrowOnFailure
(
true
),
false
);
}
}
#if GTEST_OS_WINDOWS
#
if GTEST_OS_WINDOWS
// Tests parsing wide strings.
// Tests parsing wide strings.
TEST_F
(
InitGoogleTest
Test
,
WideStrings
)
{
TEST_F
(
ParseFlags
Test
,
WideStrings
)
{
const
wchar_t
*
argv
[]
=
{
const
wchar_t
*
argv
[]
=
{
L"foo.exe"
,
L"foo.exe"
,
L"--gtest_filter=Foo*"
,
L"--gtest_filter=Foo*"
,
...
@@ -6409,10 +6409,10 @@ TEST_F(InitGoogleTestTest, WideStrings) {
...
@@ -6409,10 +6409,10 @@ TEST_F(InitGoogleTestTest, WideStrings) {
# endif // GTEST_OS_WINDOWS
# endif // GTEST_OS_WINDOWS
#if GTEST_USE_OWN_FLAGFILE_FLAG_
#if GTEST_USE_OWN_FLAGFILE_FLAG_
class
FlagfileTest
:
public
InitGoogleTest
Test
{
class
FlagfileTest
:
public
ParseFlags
Test
{
public:
public:
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
InitGoogleTest
Test
::
SetUp
();
ParseFlags
Test
::
SetUp
();
testdata_path_
.
Set
(
internal
::
FilePath
(
testdata_path_
.
Set
(
internal
::
FilePath
(
testing
::
TempDir
()
+
internal
::
GetCurrentExecutableName
().
string
()
+
testing
::
TempDir
()
+
internal
::
GetCurrentExecutableName
().
string
()
+
...
@@ -6423,7 +6423,7 @@ class FlagfileTest : public InitGoogleTestTest {
...
@@ -6423,7 +6423,7 @@ class FlagfileTest : public InitGoogleTestTest {
virtual
void
TearDown
()
{
virtual
void
TearDown
()
{
testing
::
internal
::
posix
::
RmDir
(
testdata_path_
.
c_str
());
testing
::
internal
::
posix
::
RmDir
(
testdata_path_
.
c_str
());
InitGoogleTest
Test
::
TearDown
();
ParseFlags
Test
::
TearDown
();
}
}
internal
::
FilePath
CreateFlagfile
(
const
char
*
contents
)
{
internal
::
FilePath
CreateFlagfile
(
const
char
*
contents
)
{
...
@@ -6562,6 +6562,7 @@ TEST_F(CurrentTestInfoTest, WorksForSecondTestInATestCase) {
...
@@ -6562,6 +6562,7 @@ TEST_F(CurrentTestInfoTest, WorksForSecondTestInATestCase) {
}
// namespace testing
}
// namespace testing
// These two lines test that we can define tests in a namespace that
// These two lines test that we can define tests in a namespace that
// has the name "testing" and is nested in another namespace.
// has the name "testing" and is nested in another namespace.
namespace
my_namespace
{
namespace
my_namespace
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment