Compare commits
44 Commits
release-1.
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3709903661 | ||
|
|
812e986e88 | ||
|
|
66973e30d6 | ||
|
|
61e953e8c3 | ||
|
|
9623aed82c | ||
|
|
62f8d28c0b | ||
|
|
87d23e45f0 | ||
|
|
3d8064999c | ||
|
|
44a041b711 | ||
|
|
40e72a8a83 | ||
|
|
4984c93490 | ||
|
|
0af0709b02 | ||
|
|
3c7868a9a8 | ||
|
|
f0048c1bea | ||
|
|
44c88653fc | ||
|
|
a4e6314a0b | ||
|
|
a5391b50a2 | ||
|
|
cd3e4016ea | ||
|
|
886cafd4a3 | ||
|
|
3750499433 | ||
|
|
ad99ca1446 | ||
|
|
4b83461e97 | ||
|
|
c946ae6019 | ||
|
|
a32fc79c9a | ||
|
|
650d5bf3ba | ||
|
|
b593ccbbbe | ||
|
|
bbab127250 | ||
|
|
2456258bb1 | ||
|
|
fe186c3829 | ||
|
|
53e0dc4041 | ||
|
|
0efb17dc54 | ||
|
|
31306c5832 | ||
|
|
92764e9c93 | ||
|
|
3bcc7a2173 | ||
|
|
635aff1664 | ||
|
|
7b3b36fde4 | ||
|
|
a369436e2a | ||
|
|
fab8c18a00 | ||
|
|
5145e0fb20 | ||
|
|
2051d2ccc7 | ||
|
|
0fb58d70eb | ||
|
|
04f025dd57 | ||
|
|
3e1e473ccd | ||
|
|
389508e355 |
24
CHANGES
24
CHANGES
@@ -1,3 +1,27 @@
|
||||
Changes for 1.3.0:
|
||||
|
||||
* New feature: death tests on Windows, Cygwin, and Mac.
|
||||
* New feature: ability to use Google Test assertions in other testing
|
||||
frameworks.
|
||||
* New feature: ability to run disabled test via
|
||||
--gtest_also_run_disabled_tests.
|
||||
* New feature: the --help flag for printing the usage.
|
||||
* New feature: access to Google Test flag values in user code.
|
||||
* New feature: a script that packs Google Test into one .h and one
|
||||
.cc file for easy deployment.
|
||||
* New feature: support for distributing test functions to multiple
|
||||
machines (requires support from the test runner).
|
||||
* Bug fixes and implementation clean-up.
|
||||
|
||||
Changes for 1.2.1:
|
||||
|
||||
* Compatibility fixes for Linux IA-64 and IBM z/OS.
|
||||
* Added support for using Boost and other TR1 implementations.
|
||||
* Changes to the build scripts to support upcoming release of Google C++
|
||||
Mocking Framework.
|
||||
* Added Makefile to the distribution package.
|
||||
* Improved build instructions in README.
|
||||
|
||||
Changes for 1.2.0:
|
||||
|
||||
* New feature: value-parameterized tests.
|
||||
|
||||
@@ -10,6 +10,7 @@ Chandler Carruth <chandlerc@google.com>
|
||||
Chris Prince <cprince@google.com>
|
||||
Chris Taylor <taylorc@google.com>
|
||||
Dan Egnor <egnor@google.com>
|
||||
Eric Roman <eroman@chromium.org>
|
||||
Jeffrey Yasskin <jyasskin@google.com>
|
||||
Jói Sigurðsson <joi@google.com>
|
||||
Keir Mierle <mierle@gmail.com>
|
||||
|
||||
28
Makefile.am
28
Makefile.am
@@ -9,9 +9,12 @@ EXTRA_DIST = \
|
||||
include/gtest/gtest-param-test.h.pump \
|
||||
include/gtest/internal/gtest-type-util.h.pump \
|
||||
include/gtest/internal/gtest-param-util-generated.h.pump \
|
||||
make/Makefile \
|
||||
scons/SConscript \
|
||||
scripts/fuse_gtest_files.py \
|
||||
scripts/gen_gtest_pred_impl.py \
|
||||
src/gtest-all.cc
|
||||
scripts/test/Makefile \
|
||||
test/gtest_all_test.cc
|
||||
|
||||
# MSVC project files
|
||||
EXTRA_DIST += \
|
||||
@@ -260,6 +263,13 @@ check_PROGRAMS += test/gtest-test-part_test
|
||||
test_gtest_test_part_test_SOURCES = test/gtest-test-part_test.cc
|
||||
test_gtest_test_part_test_LDADD = lib/libgtest_main.la
|
||||
|
||||
TESTS += test/gtest_throw_on_failure_ex_test
|
||||
check_PROGRAMS += test/gtest_throw_on_failure_ex_test
|
||||
test_gtest_throw_on_failure_ex_test_SOURCES = \
|
||||
test/gtest_throw_on_failure_ex_test.cc \
|
||||
src/gtest-all.cc
|
||||
test_gtest_throw_on_failure_ex_test_CXXFLAGS = $(AM_CXXFLAGS) -fexceptions
|
||||
|
||||
TESTS += test/gtest-typed-test_test
|
||||
check_PROGRAMS += test/gtest-typed-test_test
|
||||
test_gtest_typed_test_test_SOURCES = test/gtest-typed-test_test.cc \
|
||||
@@ -270,7 +280,7 @@ test_gtest_typed_test_test_LDADD = lib/libgtest_main.la
|
||||
TESTS += test/gtest_unittest
|
||||
check_PROGRAMS += test/gtest_unittest
|
||||
test_gtest_unittest_SOURCES = test/gtest_unittest.cc
|
||||
test_gtest_unittest_LDADD = lib/libgtest.la
|
||||
test_gtest_unittest_LDADD = lib/libgtest_main.la
|
||||
|
||||
# The following tests depend on the presence of a Python installation and are
|
||||
# keyed off of it. TODO(chandlerc@google.com): While we currently only attempt
|
||||
@@ -310,6 +320,12 @@ test_gtest_filter_unittest__LDADD = lib/libgtest.la
|
||||
check_SCRIPTS += test/gtest_filter_unittest.py
|
||||
TESTS += test/gtest_filter_unittest.py
|
||||
|
||||
check_PROGRAMS += test/gtest_help_test_
|
||||
test_gtest_help_test__SOURCES = test/gtest_help_test_.cc
|
||||
test_gtest_help_test__LDADD = lib/libgtest_main.la
|
||||
check_SCRIPTS += test/gtest_help_test.py
|
||||
TESTS += test/gtest_help_test.py
|
||||
|
||||
check_PROGRAMS += test/gtest_list_tests_unittest_
|
||||
test_gtest_list_tests_unittest__SOURCES = test/gtest_list_tests_unittest_.cc
|
||||
test_gtest_list_tests_unittest__LDADD = lib/libgtest.la
|
||||
@@ -324,6 +340,14 @@ EXTRA_DIST += test/gtest_output_test_golden_lin.txt \
|
||||
test/gtest_output_test_golden_win.txt
|
||||
TESTS += test/gtest_output_test.py
|
||||
|
||||
check_PROGRAMS += test/gtest_throw_on_failure_test_
|
||||
test_gtest_throw_on_failure_test__SOURCES = \
|
||||
test/gtest_throw_on_failure_test_.cc \
|
||||
src/gtest-all.cc
|
||||
test_gtest_throw_on_failure_test__CXXFLAGS = $(AM_CXXFLAGS) -fno-exceptions
|
||||
check_SCRIPTS += test/gtest_throw_on_failure_test.py
|
||||
TESTS += test/gtest_throw_on_failure_test.py
|
||||
|
||||
check_PROGRAMS += test/gtest_uninitialized_test_
|
||||
test_gtest_uninitialized_test__SOURCES = test/gtest_uninitialized_test_.cc
|
||||
test_gtest_uninitialized_test__LDADD = lib/libgtest.la
|
||||
|
||||
129
README
129
README
@@ -68,26 +68,33 @@ much more active and have the latest features, but the latter provides much
|
||||
more stability and predictability. Choose whichever fits your needs best, and
|
||||
proceed with the following Subversion commands:
|
||||
|
||||
$ svn checkout http://googletest.googlecode.com/svn/trunk/ gtest-svn
|
||||
svn checkout http://googletest.googlecode.com/svn/trunk/ gtest-svn
|
||||
|
||||
or for a release version X.Y.*'s branch:
|
||||
|
||||
$ svn checkout http://googletest.googlecode.com/svn/branches/release-X.Y/ gtest-X.Y-svn
|
||||
svn checkout http://googletest.googlecode.com/svn/branches/release-X.Y/ \
|
||||
gtest-X.Y-svn
|
||||
|
||||
Next you will need to prepare the GNU Autotools build system, if you
|
||||
are using Linux, Mac OS X, or Cygwin. Enter the target directory of
|
||||
the checkout command you used ('gtest-svn' or 'gtest-X.Y-svn' above)
|
||||
and proceed with the following commands:
|
||||
and proceed with the following command:
|
||||
|
||||
$ aclocal-1.9 # Where "1.9" must match the following automake command.
|
||||
$ libtoolize -c # Use "glibtoolize -c" instead on Mac OS X.
|
||||
$ autoheader
|
||||
$ automake-1.9 -ac # See Automake version requirements above.
|
||||
$ autoconf
|
||||
autoreconf -fvi
|
||||
|
||||
While this is a bit complicated, it will most often be automatically re-run by
|
||||
your "make" invocations, so in practice you shouldn't need to worry too much.
|
||||
Once you have completed these steps, you are ready to build the library.
|
||||
Once you have completed this step, you are ready to build the library. Note
|
||||
that you should only need to complete this step once. The subsequent `make'
|
||||
invocations will automatically re-generate the bits of the build system that
|
||||
need to be changed.
|
||||
|
||||
If your system uses older versions of the autotools, the above command will
|
||||
fail. You may need to explicitly specify a version to use. For instance, if you
|
||||
have both GNU Automake 1.4 and 1.9 installed and `automake' would invoke the
|
||||
1.4, use instead:
|
||||
|
||||
AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf -fvi
|
||||
|
||||
Make sure you're using the same version of automake and aclocal.
|
||||
|
||||
### Source Package: ###
|
||||
Google Test is also released in source packages which can be downloaded from
|
||||
@@ -101,9 +108,9 @@ Once downloaded expand the archive using whichever tools you prefer for that
|
||||
type. This will always result in a new directory with the name "gtest-X.Y.Z"
|
||||
which contains all of the source code. Here are some examples in Linux:
|
||||
|
||||
$ tar -xvzf gtest-X.Y.Z.tar.gz
|
||||
$ tar -xvjf gtest-X.Y.Z.tar.bz2
|
||||
$ unzip gtest-X.Y.Z.zip
|
||||
tar -xvzf gtest-X.Y.Z.tar.gz
|
||||
tar -xvjf gtest-X.Y.Z.tar.bz2
|
||||
unzip gtest-X.Y.Z.zip
|
||||
|
||||
Building the Source
|
||||
-------------------
|
||||
@@ -120,9 +127,9 @@ either approach by simply substituting the shell variable SRCDIR with "." for
|
||||
building inside the source directory, and the relative path to the source
|
||||
directory otherwise.
|
||||
|
||||
$ ${SRCDIR}/configure # Standard GNU configure script, --help for more info
|
||||
$ make # Standard makefile following GNU conventions
|
||||
$ make check # Builds and runs all tests - all should pass
|
||||
${SRCDIR}/configure # Standard GNU configure script, --help for more info
|
||||
make # Standard makefile following GNU conventions
|
||||
make check # Builds and runs all tests - all should pass
|
||||
|
||||
Other programs will only be able to use Google Test's functionality if you
|
||||
install it in a location which they can access, in Linux this is typically
|
||||
@@ -130,22 +137,31 @@ under '/usr/local'. The following command will install all of the Google Test
|
||||
libraries, public headers, and utilities necessary for other programs and
|
||||
libraries to leverage it:
|
||||
|
||||
$ sudo make install # Not necessary, but allows use by other programs
|
||||
sudo make install # Not necessary, but allows use by other programs
|
||||
|
||||
TODO(chandlerc@google.com): This section needs to be expanded when the
|
||||
'gtest-config' script is finished and Autoconf macro's are provided (or not
|
||||
provided) in order to properly reflect the process for other programs to
|
||||
locate, include, and link against Google Test.
|
||||
Should you need to remove Google Test from your system after having installed
|
||||
it, run the following command, and it will back out its changes. However, note
|
||||
carefully that you must run this command on the *same* Google Test build that
|
||||
you ran the install from, or the results are not predictable. If you install
|
||||
Google Test on your system, and are working from a VCS checkout, make sure you
|
||||
run this *before* updating your checkout of the source in order to uninstall
|
||||
the same version which you installed.
|
||||
|
||||
Finally, should you need to remove Google Test from your system after having
|
||||
installed it, run the following command, and it will back out its changes.
|
||||
However, note carefully that you must run this command on the *same* Google
|
||||
Test build that you ran the install from, or the results are not predictable.
|
||||
If you install Google Test on your system, and are working from a VCS checkout,
|
||||
make sure you run this *before* updating your checkout of the source in order
|
||||
to uninstall the same version which you installed.
|
||||
sudo make uninstall # Must be run against the exact same build as "install"
|
||||
|
||||
$ sudo make uninstall # Must be run against the exact same build as "install"
|
||||
Your project can build against Google Test simply by leveraging the
|
||||
'gtest-config' script. This script can be invoked directly out of the 'scripts'
|
||||
subdirectory of the build tree, and it will be installed in the binary
|
||||
directory specified during the 'configure'. Here are some examples of its use,
|
||||
see 'gtest-config --help' for more detailed information.
|
||||
|
||||
gtest-config --min-version=1.0 || echo "Insufficient Google Test version."
|
||||
|
||||
g++ $(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp
|
||||
g++ $(gtest-config --ldflags --libs) -o foo foo.o
|
||||
|
||||
# When using a built but not installed Google Test:
|
||||
g++ $(../../my_gtest_build/scripts/gtest-config ...) ...
|
||||
|
||||
### Windows ###
|
||||
Open the gtest.sln file in the msvc/ folder using Visual Studio, and
|
||||
@@ -158,7 +174,7 @@ target. The universal binary framework will end up in your selected build
|
||||
directory (selected in the Xcode "Preferences..." -> "Building" pane and
|
||||
defaults to xcode/build). Alternatively, at the command line, enter:
|
||||
|
||||
$ xcodebuild
|
||||
xcodebuild
|
||||
|
||||
This will build the "Release" configuration of the gtest.framework, but you can
|
||||
select the "Debug" configuration with a command line option. See the
|
||||
@@ -170,31 +186,32 @@ if you see some errors. Xcode reports all test failures (even the intentional
|
||||
ones) as errors. However, you should see a "Build succeeded" message at the end
|
||||
of the build log. To run all of the tests from the command line, enter:
|
||||
|
||||
$ xcodebuid -target Check
|
||||
xcodebuid -target Check
|
||||
|
||||
It is also possible to build and execute individual tests within Xcode. Each
|
||||
test has its own Xcode "Target" and Xcode "Executable". To build any of the
|
||||
tests, change the active target and the active executable to the test of
|
||||
interest and then build and run.
|
||||
|
||||
NOTE: Several tests use a Python script to run the test executable. They require
|
||||
a separate custom "Xcode Executable" to run the Python script within Xcode.
|
||||
These "Xcode Executables" are named with "run_" prepended to the test name.
|
||||
Also, the gtest_xml_outfiles_test requres two executable tests to be built.
|
||||
These executables are built in separate targets with a trailing underscore in
|
||||
the name.
|
||||
NOTE: Several tests use a Python script to run the test executable. These can be
|
||||
run from Xcode by creating a "Custom Executable". For example, to run the Python
|
||||
script which executes the gtest_color_test, select the Project->New Custom
|
||||
Executable... menu item. When prompted, set the "Executable Name" to something
|
||||
like "run_gtest_color_test" and set the "Executable Path" to the path of the
|
||||
gtest_color_test.py script. Finally, choose "Run" from the Run menu and check
|
||||
the Console for the results.
|
||||
|
||||
Individual tests can be built from the command line using:
|
||||
|
||||
$ xcodebuild -target <test_name>
|
||||
xcodebuild -target <test_name>
|
||||
|
||||
These tests can be executed from the command line by moving to the build
|
||||
directory and then (in bash)
|
||||
|
||||
$ export DYLD_FRAMEWORK_PATH=`pwd`
|
||||
$ ./<test_name> # (if it is not a python test, e.g. ./gtest_unittest)
|
||||
OR
|
||||
$ ./<test_name>.py # (if it is a python test, e.g. ./gtest_color_test.py)
|
||||
export DYLD_FRAMEWORK_PATH=`pwd`
|
||||
./<test_name> # (if it is not a python test, e.g. ./gtest_unittest)
|
||||
# OR
|
||||
./<test_name>.py # (if it is a python test, e.g. ./gtest_color_test.py)
|
||||
|
||||
To use the gtest.framework for your own tests, first, add the framework to Xcode
|
||||
project. Next, create a new executable target and add the framework to the
|
||||
@@ -208,16 +225,34 @@ in the "Variables to be set in the environment:" list, where you replace
|
||||
when you run your executable, it will load the framework and your test will
|
||||
run as expected.
|
||||
|
||||
### Using GNU Make ###
|
||||
The make/ directory contains a Makefile that you can use to build
|
||||
Google Test on systems where GNU make is available (e.g. Linux, Mac OS
|
||||
X, and Cygwin). It doesn't try to build Google Test's own tests.
|
||||
Instead, it just builds the Google Test library and a sample test.
|
||||
You can use it as a starting point for your own Makefile.
|
||||
|
||||
If the default settings are correct for your environment, the
|
||||
following commands should succeed:
|
||||
|
||||
cd ${SRCDIR}/make
|
||||
make
|
||||
./sample1_unittest
|
||||
|
||||
If you see errors, try to tweak the contents of make/Makefile to make
|
||||
them go away. There are instructions in make/Makefile on how to do
|
||||
it.
|
||||
|
||||
### Using Your Own Build System ###
|
||||
If none of the build solutions we provide works for you, or if you
|
||||
prefer your own build system, you just need to compile
|
||||
src/gtest-all.cc into a library and link your tests with it. Assuming
|
||||
a Linux-like system and gcc, something like the following will do:
|
||||
|
||||
$ cd ${SRCDIR}
|
||||
$ g++ -I. -I./include -c src/gtest-all.cc
|
||||
$ ar -rv libgtest.a gtest-all.o
|
||||
$ g++ -I. -I./include path/to/your_test.cc libgtest.a -o your_test
|
||||
cd ${SRCDIR}
|
||||
g++ -I. -I./include -c src/gtest-all.cc
|
||||
ar -rv libgtest.a gtest-all.o
|
||||
g++ -I. -I./include path/to/your_test.cc libgtest.a -o your_test
|
||||
|
||||
Regenerating Source Files
|
||||
-------------------------
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
# "[1.0.1]"). It also asumes that there won't be any closing parenthesis
|
||||
# between "AC_INIT(" and the closing ")" including comments and strings.
|
||||
AC_INIT([Google C++ Testing Framework],
|
||||
[1.2.0],
|
||||
[1.3.0],
|
||||
[googletestframework@googlegroups.com],
|
||||
[gtest])
|
||||
|
||||
# Provide various options to initialize the Autoconf and configure processes.
|
||||
AC_PREREQ([2.59])
|
||||
AC_CONFIG_SRCDIR([./COPYING])
|
||||
AC_CONFIG_AUX_DIR([config_aux])
|
||||
AC_CONFIG_HEADERS([config_aux/config.h])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_HEADERS([build-aux/config.h])
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_CONFIG_FILES([scripts/gtest-config], [chmod +x scripts/gtest-config])
|
||||
|
||||
@@ -31,7 +31,6 @@ AC_PROG_LIBTOOL
|
||||
# HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's
|
||||
# version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env"
|
||||
# hashbang.
|
||||
#AM_PATH_PYTHON([2.3],,[:])
|
||||
PYTHON= # We *do not* allow the user to specify a python interpreter
|
||||
AC_PATH_PROG([PYTHON],[python],[:])
|
||||
AS_IF([test "$PYTHON" != ":"],
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace testing {
|
||||
// after forking.
|
||||
GTEST_DECLARE_string_(death_test_style);
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// The following macros are useful for writing death tests.
|
||||
|
||||
@@ -86,6 +86,57 @@ GTEST_DECLARE_string_(death_test_style);
|
||||
//
|
||||
// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
|
||||
//
|
||||
// On the regular expressions used in death tests:
|
||||
//
|
||||
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
|
||||
// which uses the POSIX extended regex syntax.
|
||||
//
|
||||
// On other platforms (e.g. Windows), we only support a simple regex
|
||||
// syntax implemented as part of Google Test. This limited
|
||||
// implementation should be enough most of the time when writing
|
||||
// death tests; though it lacks many features you can find in PCRE
|
||||
// or POSIX extended regex syntax. For example, we don't support
|
||||
// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
|
||||
// repetition count ("x{5,7}"), among others.
|
||||
//
|
||||
// Below is the syntax that we do support. We chose it to be a
|
||||
// subset of both PCRE and POSIX extended regex, so it's easy to
|
||||
// learn wherever you come from. In the following: 'A' denotes a
|
||||
// literal character, period (.), or a single \\ escape sequence;
|
||||
// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
|
||||
// natural numbers.
|
||||
//
|
||||
// c matches any literal character c
|
||||
// \\d matches any decimal digit
|
||||
// \\D matches any character that's not a decimal digit
|
||||
// \\f matches \f
|
||||
// \\n matches \n
|
||||
// \\r matches \r
|
||||
// \\s matches any ASCII whitespace, including \n
|
||||
// \\S matches any character that's not a whitespace
|
||||
// \\t matches \t
|
||||
// \\v matches \v
|
||||
// \\w matches any letter, _, or decimal digit
|
||||
// \\W matches any character that \\w doesn't match
|
||||
// \\c matches any literal character c, which must be a punctuation
|
||||
// . matches any single character except \n
|
||||
// A? matches 0 or 1 occurrences of A
|
||||
// A* matches 0 or many occurrences of A
|
||||
// A+ matches 1 or many occurrences of A
|
||||
// ^ matches the beginning of a string (not that of each line)
|
||||
// $ matches the end of a string (not that of each line)
|
||||
// xy matches x followed by y
|
||||
//
|
||||
// If you accidentally use PCRE or POSIX extended regex features
|
||||
// not implemented by us, you will get a run-time failure. In that
|
||||
// case, please try to rewrite your regular expression within the
|
||||
// above syntax.
|
||||
//
|
||||
// This implementation is *not* meant to be as highly tuned or robust
|
||||
// as a compiled regex library, but should perform well enough for a
|
||||
// death test, which already incurs significant overhead by launching
|
||||
// a child process.
|
||||
//
|
||||
// Known caveats:
|
||||
//
|
||||
// A "threadsafe" style death test obtains the path to the test
|
||||
@@ -133,6 +184,7 @@ class ExitedWithCode {
|
||||
const int exit_code_;
|
||||
};
|
||||
|
||||
#if !GTEST_OS_WINDOWS
|
||||
// Tests that an exit code describes an exit due to termination by a
|
||||
// given signal.
|
||||
class KilledBySignal {
|
||||
@@ -142,6 +194,7 @@ class KilledBySignal {
|
||||
private:
|
||||
const int signum_;
|
||||
};
|
||||
#endif // !GTEST_OS_WINDOWS
|
||||
|
||||
// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
|
||||
// The death testing framework causes this to have interesting semantics,
|
||||
|
||||
@@ -102,7 +102,7 @@ class Message {
|
||||
}
|
||||
|
||||
~Message() { delete ss_; }
|
||||
#ifdef GTEST_OS_SYMBIAN
|
||||
#if GTEST_OS_SYMBIAN
|
||||
// Streams a value (either a pointer or not) to this object.
|
||||
template <typename T>
|
||||
inline Message& operator <<(const T& value) {
|
||||
@@ -187,7 +187,7 @@ class Message {
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef GTEST_OS_SYMBIAN
|
||||
#if GTEST_OS_SYMBIAN
|
||||
// These are needed as the Nokia Symbian Compiler cannot decide between
|
||||
// const T& and const T* in a function template. The Nokia compiler _can_
|
||||
// decide between class template specializations for T and T*, so a
|
||||
|
||||
@@ -151,14 +151,11 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-internal.h>
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
#include <gtest/internal/gtest-param-util-generated.h>
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#include <tr1/tuple>
|
||||
#endif // GTEST_HAS_COMBINE
|
||||
|
||||
namespace testing {
|
||||
|
||||
@@ -1188,7 +1185,7 @@ inline internal::ParamGenerator<bool> Bool() {
|
||||
return Values(false, true);
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// Combine() allows the user to combine two or more sequences to produce
|
||||
// values of a Cartesian product of those sequences' elements.
|
||||
//
|
||||
|
||||
@@ -152,14 +152,11 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-internal.h>
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
#include <gtest/internal/gtest-param-util-generated.h>
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#include <tr1/tuple>
|
||||
#endif // GTEST_HAS_COMBINE
|
||||
|
||||
namespace testing {
|
||||
|
||||
@@ -347,7 +344,7 @@ inline internal::ParamGenerator<bool> Bool() {
|
||||
return Values(false, true);
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// Combine() allows the user to combine two or more sequences to produce
|
||||
// values of a Cartesian product of those sequences' elements.
|
||||
//
|
||||
|
||||
@@ -151,7 +151,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
||||
|
||||
// Implements typed tests.
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST
|
||||
#if GTEST_HAS_TYPED_TEST
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
@@ -186,7 +186,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
||||
|
||||
// Implements type-parameterized tests.
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
|
||||
@@ -93,16 +93,58 @@
|
||||
|
||||
namespace testing {
|
||||
|
||||
// The upper limit for valid stack trace depths.
|
||||
const int kMaxStackTraceDepth = 100;
|
||||
// Declares the flags.
|
||||
|
||||
// This flag temporary enables the disabled tests.
|
||||
GTEST_DECLARE_bool_(also_run_disabled_tests);
|
||||
|
||||
// This flag brings the debugger on an assertion failure.
|
||||
GTEST_DECLARE_bool_(break_on_failure);
|
||||
|
||||
// This flag controls whether Google Test catches all test-thrown exceptions
|
||||
// and logs them as failures.
|
||||
GTEST_DECLARE_bool_(catch_exceptions);
|
||||
|
||||
// This flag enables using colors in terminal output. Available values are
|
||||
// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
|
||||
// to let Google Test decide.
|
||||
GTEST_DECLARE_string_(color);
|
||||
|
||||
// This flag sets up the filter to select by name using a glob pattern
|
||||
// the tests to run. If the filter is not given all tests are executed.
|
||||
GTEST_DECLARE_string_(filter);
|
||||
|
||||
// This flag causes the Google Test to list tests. None of the tests listed
|
||||
// are actually run if the flag is provided.
|
||||
GTEST_DECLARE_bool_(list_tests);
|
||||
|
||||
// This flag controls whether Google Test emits a detailed XML report to a file
|
||||
// in addition to its normal textual output.
|
||||
GTEST_DECLARE_string_(output);
|
||||
|
||||
// This flags control whether Google Test prints the elapsed time for each
|
||||
// test.
|
||||
GTEST_DECLARE_bool_(print_time);
|
||||
|
||||
// This flag sets how many times the tests are repeated. The default value
|
||||
// is 1. If the value is -1 the tests are repeating forever.
|
||||
GTEST_DECLARE_int32_(repeat);
|
||||
|
||||
// This flag controls whether Google Test includes Google Test internal
|
||||
// stack frames in failure stack traces.
|
||||
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
||||
|
||||
// This flag specifies the maximum number of stack frames to be
|
||||
// printed in a failure message.
|
||||
GTEST_DECLARE_int32_(stack_trace_depth);
|
||||
|
||||
// This flag controls whether Google Test includes Google Test internal
|
||||
// stack frames in failure stack traces.
|
||||
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
||||
// When this flag is specified, a failed assertion will throw an
|
||||
// exception if exceptions are enabled, or exit the program with a
|
||||
// non-zero code otherwise.
|
||||
GTEST_DECLARE_bool_(throw_on_failure);
|
||||
|
||||
// The upper limit for valid stack trace depths.
|
||||
const int kMaxStackTraceDepth = 100;
|
||||
|
||||
namespace internal {
|
||||
|
||||
@@ -353,7 +395,7 @@ class TestInfo {
|
||||
// Returns the result of the test.
|
||||
const internal::TestResult* result() const;
|
||||
private:
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
friend class internal::DefaultDeathTestFactory;
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
friend class internal::TestInfoImpl;
|
||||
@@ -484,7 +526,7 @@ class UnitTest {
|
||||
// or NULL if no test is running.
|
||||
const TestInfo* current_test_info() const;
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// Returns the ParameterizedTestCaseRegistry object used to keep track of
|
||||
// value-parameterized tests and instantiate and register them.
|
||||
internal::ParameterizedTestCaseRegistry& parameterized_test_registry();
|
||||
@@ -614,10 +656,20 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
|
||||
const char* actual_expression,
|
||||
const T1& expected,
|
||||
const T2& actual) {
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
#pragma warning(disable:4389) // Temporarily disables warning on
|
||||
// signed/unsigned mismatch.
|
||||
#endif
|
||||
|
||||
if (expected == actual) {
|
||||
return AssertionSuccess();
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop) // Restores the warning state.
|
||||
#endif
|
||||
|
||||
return EqFailure(expected_expression,
|
||||
actual_expression,
|
||||
FormatForComparisonFailureMessage(expected, actual),
|
||||
@@ -688,7 +740,7 @@ class EqHelper<true> {
|
||||
template <typename T1, typename T2>
|
||||
static AssertionResult Compare(const char* expected_expression,
|
||||
const char* actual_expression,
|
||||
const T1& expected,
|
||||
const T1& /* expected */,
|
||||
T2* actual) {
|
||||
// We already know that 'expected' is a null pointer.
|
||||
return CmpHelperEQ(expected_expression, actual_expression,
|
||||
@@ -893,7 +945,7 @@ class AssertHelper {
|
||||
|
||||
} // namespace internal
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// The abstract base class that all value-parameterized tests inherit from.
|
||||
//
|
||||
// This class adds support for accessing the test parameter value via
|
||||
@@ -1187,7 +1239,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
double val1, double val2);
|
||||
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
// Macros that test for HRESULT failure and success, these are only useful
|
||||
// on Windows, and rely on Windows SDK macros and APIs to compile.
|
||||
@@ -1242,6 +1294,52 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
|
||||
__FILE__, __LINE__, ::testing::Message() << (message))
|
||||
|
||||
namespace internal {
|
||||
|
||||
// This template is declared, but intentionally undefined.
|
||||
template <typename T1, typename T2>
|
||||
struct StaticAssertTypeEqHelper;
|
||||
|
||||
template <typename T>
|
||||
struct StaticAssertTypeEqHelper<T, T> {};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// Compile-time assertion for type equality.
|
||||
// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
|
||||
// the same type. The value it returns is not interesting.
|
||||
//
|
||||
// Instead of making StaticAssertTypeEq a class template, we make it a
|
||||
// function template that invokes a helper class template. This
|
||||
// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
|
||||
// defining objects of that type.
|
||||
//
|
||||
// CAVEAT:
|
||||
//
|
||||
// When used inside a method of a class template,
|
||||
// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
|
||||
// instantiated. For example, given:
|
||||
//
|
||||
// template <typename T> class Foo {
|
||||
// public:
|
||||
// void Bar() { testing::StaticAssertTypeEq<int, T>(); }
|
||||
// };
|
||||
//
|
||||
// the code:
|
||||
//
|
||||
// void Test1() { Foo<bool> foo; }
|
||||
//
|
||||
// will NOT generate a compiler error, as Foo<bool>::Bar() is never
|
||||
// actually instantiated. Instead, you need:
|
||||
//
|
||||
// void Test2() { Foo<bool> foo; foo.Bar(); }
|
||||
//
|
||||
// to cause a compiler error.
|
||||
template <typename T1, typename T2>
|
||||
bool StaticAssertTypeEq() {
|
||||
internal::StaticAssertTypeEqHelper<T1, T2>();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Defines a test.
|
||||
//
|
||||
@@ -1269,7 +1367,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
// value, as it always calls GetTypeId<>() from the Google Test
|
||||
// framework.
|
||||
#define TEST(test_case_name, test_name)\
|
||||
GTEST_TEST_(test_case_name, test_name,\
|
||||
GTEST_TEST_(test_case_name, test_name, \
|
||||
::testing::Test, ::testing::internal::GetTestTypeId())
|
||||
|
||||
|
||||
@@ -1300,7 +1398,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
// }
|
||||
|
||||
#define TEST_F(test_fixture, test_name)\
|
||||
GTEST_TEST_(test_fixture, test_name, test_fixture,\
|
||||
GTEST_TEST_(test_fixture, test_name, test_fixture, \
|
||||
::testing::internal::GetTypeId<test_fixture>())
|
||||
|
||||
// Use this macro in main() to run all tests. It returns 0 if all
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
|
||||
#include <gtest/internal/gtest-internal.h>
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST && GTEST_OS_WINDOWS
|
||||
#include <io.h>
|
||||
#endif // GTEST_HAS_DEATH_TEST && GTEST_OS_WINDOWS
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
@@ -46,9 +50,10 @@ GTEST_DECLARE_string_(internal_run_death_test);
|
||||
|
||||
// Names of the flags (needed for parsing Google Test flags).
|
||||
const char kDeathTestStyleFlag[] = "death_test_style";
|
||||
const char kDeathTestUseFork[] = "death_test_use_fork";
|
||||
const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// DeathTest is a class that hides much of the complexity of the
|
||||
// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
|
||||
@@ -120,7 +125,12 @@ class DeathTest {
|
||||
// the last death test.
|
||||
static const char* LastMessage();
|
||||
|
||||
static void set_last_death_test_message(const String& message);
|
||||
|
||||
private:
|
||||
// A string containing a description of the outcome of the last death test.
|
||||
static String last_death_test_message_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
|
||||
};
|
||||
|
||||
@@ -166,7 +176,7 @@ bool ExitedUnsuccessfully(int exit_status);
|
||||
case ::testing::internal::DeathTest::EXECUTE_TEST: { \
|
||||
::testing::internal::DeathTest::ReturnSentinel \
|
||||
gtest_sentinel(gtest_dt); \
|
||||
{ statement; } \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
|
||||
break; \
|
||||
} \
|
||||
@@ -178,14 +188,42 @@ bool ExitedUnsuccessfully(int exit_status);
|
||||
// The symbol "fail" here expands to something into which a message
|
||||
// can be streamed.
|
||||
|
||||
// A struct representing the parsed contents of the
|
||||
// A class representing the parsed contents of the
|
||||
// --gtest_internal_run_death_test flag, as it existed when
|
||||
// RUN_ALL_TESTS was called.
|
||||
struct InternalRunDeathTestFlag {
|
||||
String file;
|
||||
int line;
|
||||
int index;
|
||||
int status_fd;
|
||||
class InternalRunDeathTestFlag {
|
||||
public:
|
||||
InternalRunDeathTestFlag(const String& file,
|
||||
int line,
|
||||
int index,
|
||||
int status_fd)
|
||||
: file_(file), line_(line), index_(index), status_fd_(status_fd) {}
|
||||
|
||||
~InternalRunDeathTestFlag() {
|
||||
if (status_fd_ >= 0)
|
||||
// Suppress MSVC complaints about POSIX functions.
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif // _MSC_VER
|
||||
close(status_fd_);
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
}
|
||||
|
||||
String file() const { return file_; }
|
||||
int line() const { return line_; }
|
||||
int index() const { return index_; }
|
||||
int status_fd() const { return status_fd_; }
|
||||
|
||||
private:
|
||||
String file_;
|
||||
int line_;
|
||||
int index_;
|
||||
int status_fd_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
|
||||
};
|
||||
|
||||
// Returns a newly created InternalRunDeathTestFlag object with fields
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
// This header file declares classes and functions used internally by
|
||||
// Google Test. They are subject to change without notice.
|
||||
//
|
||||
// This file is #included in testing/base/internal/gtest-internal.h
|
||||
// This file is #included in <gtest/internal/gtest-internal.h>.
|
||||
// Do not include this header file separately!
|
||||
|
||||
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
|
||||
@@ -93,6 +93,12 @@ class FilePath {
|
||||
int number,
|
||||
const char* extension);
|
||||
|
||||
// Given directory = "dir", relative_path = "test.xml",
|
||||
// returns "dir/test.xml".
|
||||
// On Windows, uses \ as the separator rather than /.
|
||||
static FilePath ConcatPaths(const FilePath& directory,
|
||||
const FilePath& relative_path);
|
||||
|
||||
// Returns a pathname for a file that does not currently exist. The pathname
|
||||
// will be directory/base_name.extension or
|
||||
// directory/base_name_<number>.extension if directory/base_name.extension
|
||||
@@ -164,6 +170,9 @@ class FilePath {
|
||||
// root directory per disk drive.)
|
||||
bool IsRootDirectory() const;
|
||||
|
||||
// Returns true if pathname describes an absolute path.
|
||||
bool IsAbsolutePath() const;
|
||||
|
||||
private:
|
||||
// Replaces multiple consecutive separators with a single separator.
|
||||
// For example, "bar///foo" becomes "bar/foo". Does not eliminate other
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_OS_LINUX
|
||||
#if GTEST_OS_LINUX
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -546,7 +546,7 @@ class TestFactoryImpl : public TestFactoryBase {
|
||||
virtual Test* CreateTest() { return new TestClass; }
|
||||
};
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
// Predicate-formatters for implementing the HRESULT checking macros
|
||||
// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
|
||||
@@ -600,7 +600,7 @@ TestInfo* MakeAndRegisterTestInfo(
|
||||
TearDownTestCaseFunc tear_down_tc,
|
||||
TestFactoryBase* factory);
|
||||
|
||||
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P)
|
||||
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
// State of the definition of a type-parameterized test case.
|
||||
class TypedTestCasePState {
|
||||
@@ -616,6 +616,7 @@ class TypedTestCasePState {
|
||||
fprintf(stderr, "%s Test %s must be defined before "
|
||||
"REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
|
||||
FormatFileLocation(file, line).c_str(), test_name, case_name);
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
defined_test_names_.insert(test_name);
|
||||
@@ -748,6 +749,9 @@ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, int skip_count);
|
||||
// Returns the number of failed test parts in the given test result object.
|
||||
int GetFailedPartCount(const TestResult* result);
|
||||
|
||||
// A helper for suppressing warnings on unreachable code in some macros.
|
||||
bool AlwaysTrue();
|
||||
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
@@ -764,12 +768,18 @@ int GetFailedPartCount(const TestResult* result);
|
||||
#define GTEST_SUCCESS_(message) \
|
||||
GTEST_MESSAGE_(message, ::testing::TPRT_SUCCESS)
|
||||
|
||||
// Suppresses MSVC warnings 4072 (unreachable code) for the code following
|
||||
// statement if it returns or throws (or doesn't return or throw in some
|
||||
// situations).
|
||||
#define GTEST_HIDE_UNREACHABLE_CODE_(statement) \
|
||||
if (::testing::internal::AlwaysTrue()) { statement; }
|
||||
|
||||
#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (const char* gtest_msg = "") { \
|
||||
bool gtest_caught_expected = false; \
|
||||
try { \
|
||||
statement; \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
} \
|
||||
catch (expected_exception const&) { \
|
||||
gtest_caught_expected = true; \
|
||||
@@ -793,7 +803,7 @@ int GetFailedPartCount(const TestResult* result);
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (const char* gtest_msg = "") { \
|
||||
try { \
|
||||
statement; \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
} \
|
||||
catch (...) { \
|
||||
gtest_msg = "Expected: " #statement " doesn't throw an exception.\n" \
|
||||
@@ -809,7 +819,7 @@ int GetFailedPartCount(const TestResult* result);
|
||||
if (const char* gtest_msg = "") { \
|
||||
bool gtest_caught_any = false; \
|
||||
try { \
|
||||
statement; \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
} \
|
||||
catch (...) { \
|
||||
gtest_caught_any = true; \
|
||||
@@ -835,7 +845,7 @@ int GetFailedPartCount(const TestResult* result);
|
||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||
if (const char* gtest_msg = "") { \
|
||||
::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
|
||||
{ statement; } \
|
||||
GTEST_HIDE_UNREACHABLE_CODE_(statement); \
|
||||
if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
|
||||
gtest_msg = "Expected: " #statement " doesn't generate new fatal " \
|
||||
"failures in the current thread.\n" \
|
||||
|
||||
@@ -46,11 +46,7 @@
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#include <tr1/tuple>
|
||||
#endif // GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
|
||||
@@ -2663,7 +2659,7 @@ class ValueArray50 {
|
||||
const T50 v50_;
|
||||
};
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
// Generates values from the Cartesian product of values produced
|
||||
|
||||
@@ -47,11 +47,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#include <tr1/tuple>
|
||||
#endif // GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
|
||||
@@ -96,7 +92,7 @@ $for j [[
|
||||
|
||||
]]
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
// Generates values from the Cartesian product of values produced
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#if GTEST_HAS_RTTI
|
||||
#include <typeinfo>
|
||||
|
||||
@@ -40,42 +40,38 @@
|
||||
// control Google Test's behavior. If the user doesn't define a macro
|
||||
// in this list, Google Test will define it.
|
||||
//
|
||||
// GTEST_HAS_STD_STRING - Define it to 1/0 to indicate that
|
||||
// std::string does/doesn't work (Google Test can
|
||||
// be used where std::string is unavailable).
|
||||
// GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
|
||||
// is/isn't available.
|
||||
// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
|
||||
// is/isn't available (some systems define
|
||||
// ::string, which is different to std::string).
|
||||
// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
|
||||
// std::wstring does/doesn't work (Google Test can
|
||||
// be used where std::wstring is unavailable).
|
||||
// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
|
||||
// is/isn't available (some systems define
|
||||
// ::wstring, which is different to std::wstring).
|
||||
// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
|
||||
// enabled.
|
||||
// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
|
||||
// is/isn't available.
|
||||
// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
|
||||
// enabled.
|
||||
// GTEST_HAS_STD_STRING - Define it to 1/0 to indicate that
|
||||
// std::string does/doesn't work (Google Test can
|
||||
// be used where std::string is unavailable).
|
||||
// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
|
||||
// std::wstring does/doesn't work (Google Test can
|
||||
// be used where std::wstring is unavailable).
|
||||
// GTEST_HAS_TR1_TUPLE 1 - Define it to 1/0 to indicate tr1::tuple
|
||||
// is/isn't available.
|
||||
|
||||
// This header defines the following utilities:
|
||||
//
|
||||
// Macros indicating the name of the Google C++ Testing Framework project:
|
||||
// GTEST_NAME - a string literal of the project name.
|
||||
// GTEST_FLAG_PREFIX - a string literal of the prefix all Google
|
||||
// Test flag names share.
|
||||
// GTEST_FLAG_PREFIX_UPPER - a string literal of the prefix all Google
|
||||
// Test flag names share, in upper case.
|
||||
//
|
||||
// Macros indicating the current platform:
|
||||
// GTEST_OS_CYGWIN - defined iff compiled on Cygwin.
|
||||
// GTEST_OS_LINUX - defined iff compiled on Linux.
|
||||
// GTEST_OS_MAC - defined iff compiled on Mac OS X.
|
||||
// GTEST_OS_SOLARIS - defined iff compiled on Sun Solaris.
|
||||
// GTEST_OS_SYMBIAN - defined iff compiled for Symbian.
|
||||
// GTEST_OS_WINDOWS - defined iff compiled on Windows.
|
||||
// GTEST_OS_ZOS - defined iff compiled on IBM z/OS.
|
||||
// Macros indicating the current platform (defined to 1 if compiled on
|
||||
// the given platform; otherwise undefined):
|
||||
// GTEST_OS_CYGWIN - Cygwin
|
||||
// GTEST_OS_LINUX - Linux
|
||||
// GTEST_OS_MAC - Mac OS X
|
||||
// GTEST_OS_SOLARIS - Sun Solaris
|
||||
// GTEST_OS_SYMBIAN - Symbian
|
||||
// GTEST_OS_WINDOWS - Windows
|
||||
// GTEST_OS_ZOS - z/OS
|
||||
//
|
||||
// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
|
||||
// most stable support. Since core members of the Google Test project
|
||||
@@ -84,17 +80,19 @@
|
||||
// googletestframework@googlegroups.com (patches for fixing them are
|
||||
// even more welcome!).
|
||||
//
|
||||
// Note that it is possible that none of the GTEST_OS_ macros are defined.
|
||||
// Note that it is possible that none of the GTEST_OS_* macros are defined.
|
||||
//
|
||||
// Macros indicating available Google Test features:
|
||||
// GTEST_HAS_COMBINE - defined iff Combine construct is supported
|
||||
// in value-parameterized tests.
|
||||
// GTEST_HAS_DEATH_TEST - defined iff death tests are supported.
|
||||
// GTEST_HAS_PARAM_TEST - defined iff value-parameterized tests are
|
||||
// supported.
|
||||
// GTEST_HAS_TYPED_TEST - defined iff typed tests are supported.
|
||||
// GTEST_HAS_TYPED_TEST_P - defined iff type-parameterized tests are
|
||||
// supported.
|
||||
// Macros indicating available Google Test features (defined to 1 if
|
||||
// the corresponding feature is supported; otherwise undefined):
|
||||
// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
|
||||
// tests)
|
||||
// GTEST_HAS_DEATH_TEST - death tests
|
||||
// GTEST_HAS_PARAM_TEST - value-parameterized tests
|
||||
// GTEST_HAS_TYPED_TEST - typed tests
|
||||
// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
|
||||
// GTEST_USES_POSIX_RE - enhanced POSIX regex is used.
|
||||
// GTEST_USES_SIMPLE_RE - our own simple regex is used;
|
||||
// the above two are mutually exclusive.
|
||||
//
|
||||
// Macros for basic C++ coding:
|
||||
// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
|
||||
@@ -153,9 +151,11 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream> // Used for GTEST_CHECK_
|
||||
|
||||
#define GTEST_NAME "Google Test"
|
||||
#define GTEST_FLAG_PREFIX "gtest_"
|
||||
#define GTEST_FLAG_PREFIX_UPPER "GTEST_"
|
||||
#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
|
||||
#define GTEST_FLAG_PREFIX_ "gtest_"
|
||||
#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
|
||||
#define GTEST_NAME_ "Google Test"
|
||||
#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
|
||||
|
||||
// Determines the version of gcc that is used to compile this.
|
||||
#ifdef __GNUC__
|
||||
@@ -166,47 +166,74 @@
|
||||
|
||||
// Determines the platform on which Google Test is compiled.
|
||||
#ifdef __CYGWIN__
|
||||
#define GTEST_OS_CYGWIN
|
||||
#define GTEST_OS_CYGWIN 1
|
||||
#elif __SYMBIAN32__
|
||||
#define GTEST_OS_SYMBIAN
|
||||
#define GTEST_OS_SYMBIAN 1
|
||||
#elif defined _MSC_VER
|
||||
// TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean
|
||||
// both "The OS is Windows" and "The compiler is MSVC". These
|
||||
// meanings really should be separated in order to better support
|
||||
// Windows compilers other than MSVC.
|
||||
#define GTEST_OS_WINDOWS
|
||||
#define GTEST_OS_WINDOWS 1
|
||||
#elif defined __APPLE__
|
||||
#define GTEST_OS_MAC
|
||||
#define GTEST_OS_MAC 1
|
||||
#elif defined __linux__
|
||||
#define GTEST_OS_LINUX
|
||||
#define GTEST_OS_LINUX 1
|
||||
#elif defined __MVS__
|
||||
#define GTEST_OS_ZOS
|
||||
#define GTEST_OS_ZOS 1
|
||||
#elif defined(__sun) && defined(__SVR4)
|
||||
#define GTEST_OS_SOLARIS
|
||||
#define GTEST_OS_SOLARIS 1
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
|
||||
|
||||
// On some platforms, <regex.h> needs someone to define size_t, and
|
||||
// won't compile otherwise. We can #include it here as we already
|
||||
// included <stdlib.h>, which is guaranteed to define size_t through
|
||||
// <stddef.h>.
|
||||
#include <regex.h> // NOLINT
|
||||
#define GTEST_USES_POSIX_RE 1
|
||||
|
||||
#else
|
||||
|
||||
// <regex.h> may not be available on this platform. Use our own
|
||||
// simple regex implementation instead.
|
||||
#define GTEST_USES_SIMPLE_RE 1
|
||||
|
||||
#endif // GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
|
||||
|
||||
// Defines GTEST_HAS_EXCEPTIONS to 1 if exceptions are enabled, or 0
|
||||
// otherwise.
|
||||
|
||||
#ifdef _MSC_VER // Compiled by MSVC?
|
||||
// Assumes that exceptions are enabled by default.
|
||||
#ifndef _HAS_EXCEPTIONS // MSVC uses this macro to enable exceptions.
|
||||
#define _HAS_EXCEPTIONS 1
|
||||
#endif // _HAS_EXCEPTIONS
|
||||
#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
|
||||
#else // The compiler is not MSVC.
|
||||
// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled. For
|
||||
// other compilers, we assume exceptions are disabled to be
|
||||
// conservative.
|
||||
#if defined(__GNUC__) && __EXCEPTIONS
|
||||
#define GTEST_HAS_EXCEPTIONS 1
|
||||
#else
|
||||
#define GTEST_HAS_EXCEPTIONS 0
|
||||
#endif // defined(__GNUC__) && __EXCEPTIONS
|
||||
#endif // _MSC_VER
|
||||
|
||||
// Determines whether ::std::string and ::string are available.
|
||||
|
||||
#ifndef GTEST_HAS_STD_STRING
|
||||
// The user didn't tell us whether ::std::string is available, so we
|
||||
// need to figure it out.
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
// Assumes that exceptions are enabled by default.
|
||||
#ifndef _HAS_EXCEPTIONS
|
||||
#define _HAS_EXCEPTIONS 1
|
||||
#endif // _HAS_EXCEPTIONS
|
||||
// GTEST_HAS_EXCEPTIONS is non-zero iff exceptions are enabled. It is
|
||||
// always defined, while _HAS_EXCEPTIONS is defined only on Windows.
|
||||
#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
|
||||
// On Windows, we can use ::std::string if the compiler version is VS
|
||||
// 2005 or above, or if exceptions are enabled.
|
||||
#define GTEST_HAS_STD_STRING ((_MSC_VER >= 1400) || GTEST_HAS_EXCEPTIONS)
|
||||
#else // We are on Linux or Mac OS.
|
||||
#define GTEST_HAS_EXCEPTIONS 0
|
||||
// need to figure it out. The only environment that we know
|
||||
// ::std::string is not available is MSVC 7.1 or lower with exceptions
|
||||
// disabled.
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1400) && !GTEST_HAS_EXCEPTIONS
|
||||
#define GTEST_HAS_STD_STRING 0
|
||||
#else
|
||||
#define GTEST_HAS_STD_STRING 1
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#endif
|
||||
#endif // GTEST_HAS_STD_STRING
|
||||
|
||||
#ifndef GTEST_HAS_GLOBAL_STRING
|
||||
@@ -223,20 +250,22 @@
|
||||
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
|
||||
// is available.
|
||||
|
||||
#if defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS)
|
||||
// At least some versions of cygwin don't support ::std::wstring.
|
||||
#if GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
|
||||
// Cygwin 1.5 and below doesn't support ::std::wstring.
|
||||
// Cygwin 1.7 might add wstring support; this should be updated when clear.
|
||||
// Solaris' libc++ doesn't support it either.
|
||||
#define GTEST_HAS_STD_WSTRING 0
|
||||
#else
|
||||
#define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING
|
||||
#endif // defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS)
|
||||
#endif // GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
|
||||
|
||||
#endif // GTEST_HAS_STD_WSTRING
|
||||
|
||||
#ifndef GTEST_HAS_GLOBAL_WSTRING
|
||||
// The user didn't tell us whether ::wstring is available, so we need
|
||||
// to figure it out.
|
||||
#define GTEST_HAS_GLOBAL_WSTRING GTEST_HAS_GLOBAL_STRING
|
||||
#define GTEST_HAS_GLOBAL_WSTRING \
|
||||
(GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
|
||||
#endif // GTEST_HAS_GLOBAL_WSTRING
|
||||
|
||||
#if GTEST_HAS_STD_STRING || GTEST_HAS_GLOBAL_STRING || \
|
||||
@@ -290,19 +319,13 @@
|
||||
// Determines whether <pthread.h> is available.
|
||||
#ifndef GTEST_HAS_PTHREAD
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC)
|
||||
#define GTEST_HAS_PTHREAD 1
|
||||
#else
|
||||
#define GTEST_HAS_PTHREAD 0
|
||||
#endif // GTEST_OS_LINUX || GTEST_OS_MAC
|
||||
|
||||
#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
|
||||
#endif // GTEST_HAS_PTHREAD
|
||||
|
||||
// Determines whether <tr1/tuple> is available. If you have <tr1/tuple>
|
||||
// Determines whether tr1/tuple is available. If you have tr1/tuple
|
||||
// on your platform, define GTEST_HAS_TR1_TUPLE=1 for both the Google
|
||||
// Test project and your tests. If you would like Google Test to detect
|
||||
// <tr1/tuple> on your platform automatically, please open an issue
|
||||
// tr1/tuple on your platform automatically, please open an issue
|
||||
// ticket at http://code.google.com/p/googletest.
|
||||
#ifndef GTEST_HAS_TR1_TUPLE
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
@@ -315,25 +338,58 @@
|
||||
#endif // __GNUC__
|
||||
#endif // GTEST_HAS_TR1_TUPLE
|
||||
|
||||
// To avoid conditional compilation everywhere, we make it
|
||||
// gtest-port.h's responsibility to #include the header implementing
|
||||
// tr1/tuple.
|
||||
#if GTEST_HAS_TR1_TUPLE
|
||||
#if defined(__GNUC__)
|
||||
// GCC implements tr1/tuple in the <tr1/tuple> header. This does not
|
||||
// conform to the TR1 spec, which requires the header to be <tuple>.
|
||||
#include <tr1/tuple>
|
||||
#else
|
||||
// If the compiler is not GCC, we assume the user is using a
|
||||
// spec-conforming TR1 implementation.
|
||||
#include <tuple>
|
||||
#endif // __GNUC__
|
||||
#endif // GTEST_HAS_TR1_TUPLE
|
||||
|
||||
// Determines whether clone(2) is supported.
|
||||
// Usually it will only be available on Linux, excluding
|
||||
// Linux on the Itanium architecture.
|
||||
// Also see http://linux.die.net/man/2/clone.
|
||||
#ifndef GTEST_HAS_CLONE
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
#if GTEST_OS_LINUX && !defined(__ia64__)
|
||||
#define GTEST_HAS_CLONE 1
|
||||
#else
|
||||
#define GTEST_HAS_CLONE 0
|
||||
#endif // GTEST_OS_LINUX && !defined(__ia64__)
|
||||
|
||||
#endif // GTEST_HAS_CLONE
|
||||
|
||||
// Determines whether to support death tests.
|
||||
#if GTEST_HAS_STD_STRING && defined(GTEST_OS_LINUX)
|
||||
#define GTEST_HAS_DEATH_TEST
|
||||
// On some platforms, <regex.h> needs someone to define size_t, and
|
||||
// won't compile otherwise. We can #include it here as we already
|
||||
// included <stdlib.h>, which is guaranteed to define size_t through
|
||||
// <stddef.h>.
|
||||
#include <regex.h>
|
||||
// Google Test does not support death tests for VC 7.1 and earlier for
|
||||
// these reasons:
|
||||
// 1. std::vector does not build in VC 7.1 when exceptions are disabled.
|
||||
// 2. std::string does not build in VC 7.1 when exceptions are disabled
|
||||
// (this is covered by GTEST_HAS_STD_STRING guard).
|
||||
// 3. abort() in a VC 7.1 application compiled as GUI in debug config
|
||||
// pops up a dialog window that cannot be suppressed programmatically.
|
||||
#if GTEST_HAS_STD_STRING && (GTEST_OS_LINUX || \
|
||||
GTEST_OS_MAC || \
|
||||
GTEST_OS_CYGWIN || \
|
||||
(GTEST_OS_WINDOWS && _MSC_VER >= 1400))
|
||||
#define GTEST_HAS_DEATH_TEST 1
|
||||
#include <vector>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#endif // GTEST_HAS_STD_STRING && defined(GTEST_OS_LINUX)
|
||||
#endif
|
||||
|
||||
// Determines whether to support value-parameterized tests.
|
||||
|
||||
#if defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
// TODO(vladl@google.com): get the implementation rid of vector and list
|
||||
// to compile on MSVC 7.1.
|
||||
#define GTEST_HAS_PARAM_TEST
|
||||
#define GTEST_HAS_PARAM_TEST 1
|
||||
#endif // defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
|
||||
// Determines whether to support type-driven tests.
|
||||
@@ -341,21 +397,19 @@
|
||||
// Typed tests need <typeinfo> and variadic macros, which gcc and VC
|
||||
// 8.0+ support.
|
||||
#if defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
#define GTEST_HAS_TYPED_TEST
|
||||
#define GTEST_HAS_TYPED_TEST_P
|
||||
#define GTEST_HAS_TYPED_TEST 1
|
||||
#define GTEST_HAS_TYPED_TEST_P 1
|
||||
#endif // defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
|
||||
// Determines whether to support Combine(). This only makes sense when
|
||||
// value-parameterized tests are enabled.
|
||||
#if defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE
|
||||
#define GTEST_HAS_COMBINE
|
||||
#endif // defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE
|
||||
#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
|
||||
#define GTEST_HAS_COMBINE 1
|
||||
#endif // GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
|
||||
|
||||
// Determines whether the system compiler uses UTF-16 for encoding wide strings.
|
||||
#if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_CYGWIN) || \
|
||||
defined(GTEST_OS_SYMBIAN)
|
||||
#define GTEST_WIDE_STRING_USES_UTF16_ 1
|
||||
#endif
|
||||
#define GTEST_WIDE_STRING_USES_UTF16_ \
|
||||
(GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN)
|
||||
|
||||
// Defines some utility macros.
|
||||
|
||||
@@ -456,8 +510,6 @@ class scoped_ptr {
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
|
||||
};
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Defines RE.
|
||||
|
||||
// A simple C++ wrapper for <regex.h>. It uses the POSIX Enxtended
|
||||
@@ -515,12 +567,16 @@ class RE {
|
||||
// String type here, in order to simplify dependencies between the
|
||||
// files.
|
||||
const char* pattern_;
|
||||
bool is_valid_;
|
||||
#if GTEST_USES_POSIX_RE
|
||||
regex_t full_regex_; // For FullMatch().
|
||||
regex_t partial_regex_; // For PartialMatch().
|
||||
bool is_valid_;
|
||||
};
|
||||
#else // GTEST_USES_SIMPLE_RE
|
||||
const char* full_pattern_; // For FullMatch();
|
||||
#endif
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(RE);
|
||||
};
|
||||
|
||||
// Defines logging utilities:
|
||||
// GTEST_LOG_() - logs messages at the specified severity level.
|
||||
@@ -549,14 +605,17 @@ inline void FlushInfoLog() { fflush(NULL); }
|
||||
// CaptureStderr - starts capturing stderr.
|
||||
// GetCapturedStderr - stops capturing stderr and returns the captured string.
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_STD_STRING
|
||||
void CaptureStderr();
|
||||
::std::string GetCapturedStderr();
|
||||
#endif // GTEST_HAS_STD_STRING
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// A copy of all command line arguments. Set by InitGoogleTest().
|
||||
extern ::std::vector<String> g_argvs;
|
||||
|
||||
void CaptureStderr();
|
||||
// GTEST_HAS_DEATH_TEST implies we have ::std::string.
|
||||
::std::string GetCapturedStderr();
|
||||
const ::std::vector<String>& GetArgvs();
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
@@ -640,10 +699,15 @@ struct is_pointer : public false_type {};
|
||||
template <typename T>
|
||||
struct is_pointer<T*> : public true_type {};
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
#define GTEST_PATH_SEP_ "\\"
|
||||
#else
|
||||
#define GTEST_PATH_SEP_ "/"
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
// Defines BiggestInt as the biggest signed integer type the compiler
|
||||
// supports.
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef __int64 BiggestInt;
|
||||
#else
|
||||
typedef long long BiggestInt; // NOLINT
|
||||
@@ -701,7 +765,7 @@ class TypeWithSize<4> {
|
||||
template <>
|
||||
class TypeWithSize<8> {
|
||||
public:
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef __int64 Int;
|
||||
typedef unsigned __int64 UInt;
|
||||
#else
|
||||
@@ -724,7 +788,7 @@ inline const char* GetEnv(const char* name) {
|
||||
#ifdef _WIN32_WCE // We are on Windows CE.
|
||||
// CE has no environment variables.
|
||||
return NULL;
|
||||
#elif defined(GTEST_OS_WINDOWS) // We are on Windows proper.
|
||||
#elif GTEST_OS_WINDOWS // We are on Windows proper.
|
||||
// MSVC 8 deprecates getenv(), so we want to suppress warning 4996
|
||||
// (deprecated function) there.
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
// Google Test. They are subject to change without notice. They should not used
|
||||
// by code external to Google Test.
|
||||
//
|
||||
// This header file is #included by testing/base/internal/gtest-internal.h.
|
||||
// This header file is #included by <gtest/internal/gtest-internal.h>.
|
||||
// It should not be #included by other files.
|
||||
|
||||
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
#include <gtest/internal/gtest-string.h>
|
||||
|
||||
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P)
|
||||
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <cxxabi.h>
|
||||
|
||||
@@ -45,7 +45,7 @@ $var n = 50 $$ Maximum length of type lists we want to support.
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
#include <gtest/internal/gtest-string.h>
|
||||
|
||||
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P)
|
||||
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <cxxabi.h>
|
||||
|
||||
63
m4/gtest.m4
63
m4/gtest.m4
@@ -12,10 +12,10 @@ AC_DEFUN([GTEST_LIB_CHECK],
|
||||
dnl Provide a flag to enable or disable Google Test usage.
|
||||
AC_ARG_ENABLE([gtest],
|
||||
[AS_HELP_STRING([--enable-gtest],
|
||||
[Enable tests using the Google C++ Testing Framework.]
|
||||
[(Default is enabled.)])],
|
||||
[Enable tests using the Google C++ Testing Framework.
|
||||
(Default is enabled.)])],
|
||||
[],
|
||||
[enable_gtest=check])
|
||||
[enable_gtest=])
|
||||
AC_ARG_VAR([GTEST_CONFIG],
|
||||
[The exact path of Google Test's 'gtest-config' script.])
|
||||
AC_ARG_VAR([GTEST_CPPFLAGS],
|
||||
@@ -29,33 +29,46 @@ AC_ARG_VAR([GTEST_LIBS],
|
||||
AC_ARG_VAR([GTEST_VERSION],
|
||||
[The version of Google Test available.])
|
||||
HAVE_GTEST="no"
|
||||
AS_IF([test "x$enable_gtest" != "xno"],
|
||||
[AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
|
||||
AS_IF([test -x "$GTEST_CONFIG"],
|
||||
[AS_IF([test "x$1" != "x"],
|
||||
[_min_version="--min-version=$1"
|
||||
AS_IF([test "x${enable_gtest}" != "xno"],
|
||||
[AC_MSG_CHECKING([for 'gtest-config'])
|
||||
AS_IF([test "x${enable_gtest}" != "xyes"],
|
||||
[AS_IF([test -x "${enable_gtest}/scripts/gtest-config"],
|
||||
[GTEST_CONFIG="${enable_gtest}/scripts/gtest-config"],
|
||||
[GTEST_CONFIG="${enable_gtest}/bin/gtest-config"])
|
||||
AS_IF([test -x "${GTEST_CONFIG}"], [],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([dnl
|
||||
Unable to locate either a built or installed Google Test.
|
||||
The specific location '${enable_gtest}' was provided for a built or installed
|
||||
Google Test, but no 'gtest-config' script could be found at this location.])
|
||||
])],
|
||||
[AC_PATH_PROG([GTEST_CONFIG], [gtest-config])])
|
||||
AS_IF([test -x "${GTEST_CONFIG}"],
|
||||
[AC_MSG_RESULT([${GTEST_CONFIG}])
|
||||
m4_ifval([$1],
|
||||
[_gtest_min_version="--min-version=$1"
|
||||
AC_MSG_CHECKING([for Google Test at least version >= $1])],
|
||||
[_min_version="--min-version=0"
|
||||
[_gtest_min_version="--min-version=0"
|
||||
AC_MSG_CHECKING([for Google Test])])
|
||||
AS_IF([$GTEST_CONFIG $_min_version],
|
||||
AS_IF([${GTEST_CONFIG} ${_gtest_min_version}],
|
||||
[AC_MSG_RESULT([yes])
|
||||
HAVE_GTEST="yes"],
|
||||
[AC_MSG_RESULT([no])])])
|
||||
AS_IF([test "x$HAVE_GTEST" = "xyes"],
|
||||
[GTEST_CPPFLAGS=$($GTEST_CONFIG --cppflags)
|
||||
GTEST_CXXFLAGS=$($GTEST_CONFIG --cxxflags)
|
||||
GTEST_LDFLAGS=$($GTEST_CONFIG --ldflags)
|
||||
GTEST_LIBS=$($GTEST_CONFIG --libs)
|
||||
GTEST_VERSION=$($GTEST_CONFIG --version)
|
||||
HAVE_GTEST='yes'],
|
||||
[AC_MSG_RESULT([no])])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
AS_IF([test "x${HAVE_GTEST}" = "xyes"],
|
||||
[GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags`
|
||||
GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags`
|
||||
GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
|
||||
GTEST_LIBS=`${GTEST_CONFIG} --libs`
|
||||
GTEST_VERSION=`${GTEST_CONFIG} --version`
|
||||
AC_DEFINE([HAVE_GTEST],[1],[Defined when Google Test is available.])],
|
||||
[AS_IF([test "x$enable_gtest" = "xyes"],
|
||||
[AC_MSG_ERROR([
|
||||
The Google C++ Testing Framework was explicitly enabled, but a viable version
|
||||
could not be found on the system.
|
||||
])])])])
|
||||
[AS_IF([test "x${enable_gtest}" = "xyes"],
|
||||
[AC_MSG_ERROR([dnl
|
||||
Google Test was enabled, but no viable version could be found.])
|
||||
])])])
|
||||
AC_SUBST([HAVE_GTEST])
|
||||
AM_CONDITIONAL([HAVE_GTEST],[test "x$HAVE_GTEST" = "xyes"])
|
||||
AS_IF([test "x$HAVE_GTEST" = "xyes"],
|
||||
[AS_IF([test "x$2" != "x"],[$2],[:])],
|
||||
[AS_IF([test "x$3" != "x"],[$3],[:])])
|
||||
[m4_ifval([$2], [$2])],
|
||||
[m4_ifval([$3], [$3])])
|
||||
])
|
||||
|
||||
78
make/Makefile
Normal file
78
make/Makefile
Normal file
@@ -0,0 +1,78 @@
|
||||
# A sample Makefile for building Google Test and using it in user
|
||||
# tests. Please tweak it to suit your environment and project. You
|
||||
# may want to move it to your project's root directory.
|
||||
#
|
||||
# SYNOPSIS:
|
||||
#
|
||||
# make [all] - makes everything.
|
||||
# make TARGET - makes the given target.
|
||||
# make clean - removes all files generated by make.
|
||||
|
||||
# Please tweak the following variable definitions as needed by your
|
||||
# project, except GTEST_HEADERS, which you can use in your own targets
|
||||
# but shouldn't modify.
|
||||
|
||||
# Points to the root of Google Test, relative to where this file is.
|
||||
# Remember to tweak this if you move this file.
|
||||
GTEST_DIR = ..
|
||||
|
||||
# Where to find user code.
|
||||
USER_DIR = ../samples
|
||||
|
||||
# Flags passed to the preprocessor.
|
||||
CPPFLAGS += -I$(GTEST_DIR) -I$(GTEST_DIR)/include
|
||||
|
||||
# Flags passed to the C++ compiler.
|
||||
CXXFLAGS += -g
|
||||
|
||||
# All tests produced by this Makefile. Remember to add new tests you
|
||||
# created to the list.
|
||||
TESTS = sample1_unittest
|
||||
|
||||
# All Google Test headers. Usually you shouldn't change this
|
||||
# definition.
|
||||
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
|
||||
$(GTEST_DIR)/include/gtest/internal/*.h
|
||||
|
||||
# House-keeping build targets.
|
||||
|
||||
all : $(TESTS)
|
||||
|
||||
clean :
|
||||
rm -f $(TESTS) gtest.a gtest_main.a *.o
|
||||
|
||||
# Builds gtest.a and gtest_main.a.
|
||||
|
||||
# Usually you shouldn't tweak such internal variables, indicated by a
|
||||
# trailing _.
|
||||
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
|
||||
|
||||
# For simplicity and to avoid depending on Google Test's
|
||||
# implementation details, the dependencies specified below are
|
||||
# conservative and not optimized. This is fine as Google Test
|
||||
# compiles fast and for ordinary users its source rarely changes.
|
||||
gtest-all.o : $(GTEST_SRCS_)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest-all.cc
|
||||
|
||||
gtest_main.o : $(GTEST_SRCS_)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest_main.cc
|
||||
|
||||
gtest.a : gtest-all.o
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
gtest_main.a : gtest-all.o gtest_main.o
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
# Builds a sample test. A test should link with either gtest.a or
|
||||
# gtest_main.a, depending on whether it defines its own main()
|
||||
# function.
|
||||
|
||||
sample1.o : $(USER_DIR)/sample1.cc $(USER_DIR)/sample1.h $(GTEST_HEADERS)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1.cc
|
||||
|
||||
sample1_unittest.o : $(USER_DIR)/sample1_unittest.cc \
|
||||
$(USER_DIR)/sample1.h $(GTEST_HEADERS)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1_unittest.cc
|
||||
|
||||
sample1_unittest : sample1.o sample1_unittest.o gtest_main.a
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@
|
||||
170
msvc/gtest.sln
Executable file → Normal file
170
msvc/gtest.sln
Executable file → Normal file
@@ -1,85 +1,85 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "gtest.vcproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_main", "gtest_main.vcproj", "{3AF54C8A-10BF-4332-9147-F68ED9862032}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_unittest", "gtest_unittest.vcproj", "{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_environment_test", "gtest_environment_test.vcproj", "{DF5FA93D-DC03-41A6-A18C-079198633450}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_prod_test", "gtest_prod_test.vcproj", "{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_color_test_", "gtest_color_test_.vcproj", "{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_env_var_test_", "gtest_env_var_test_.vcproj", "{569C6F70-F41C-47F3-A622-8A88DC43D452}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_output_test_", "gtest_output_test_.vcproj", "{A4903F73-ED6C-4972-863E-F7355EB0145E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_uninitialized_test_", "gtest_uninitialized_test_.vcproj", "{42B8A077-E162-4540-A688-246296ACAC1D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.ActiveCfg = Debug|Win32
|
||||
{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.Build.0 = Debug|Win32
|
||||
{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.ActiveCfg = Release|Win32
|
||||
{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.Build.0 = Release|Win32
|
||||
{3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.ActiveCfg = Debug|Win32
|
||||
{3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.Build.0 = Debug|Win32
|
||||
{3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.ActiveCfg = Release|Win32
|
||||
{3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.Build.0 = Release|Win32
|
||||
{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.ActiveCfg = Debug|Win32
|
||||
{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.Build.0 = Debug|Win32
|
||||
{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.ActiveCfg = Release|Win32
|
||||
{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.Build.0 = Release|Win32
|
||||
{DF5FA93D-DC03-41A6-A18C-079198633450}.Debug.ActiveCfg = Debug|Win32
|
||||
{DF5FA93D-DC03-41A6-A18C-079198633450}.Debug.Build.0 = Debug|Win32
|
||||
{DF5FA93D-DC03-41A6-A18C-079198633450}.Release.ActiveCfg = Release|Win32
|
||||
{DF5FA93D-DC03-41A6-A18C-079198633450}.Release.Build.0 = Release|Win32
|
||||
{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.ActiveCfg = Debug|Win32
|
||||
{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.Build.0 = Debug|Win32
|
||||
{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.ActiveCfg = Release|Win32
|
||||
{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.Build.0 = Release|Win32
|
||||
{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}.Debug.ActiveCfg = Debug|Win32
|
||||
{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}.Debug.Build.0 = Debug|Win32
|
||||
{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}.Release.ActiveCfg = Release|Win32
|
||||
{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}.Release.Build.0 = Release|Win32
|
||||
{569C6F70-F41C-47F3-A622-8A88DC43D452}.Debug.ActiveCfg = Debug|Win32
|
||||
{569C6F70-F41C-47F3-A622-8A88DC43D452}.Debug.Build.0 = Debug|Win32
|
||||
{569C6F70-F41C-47F3-A622-8A88DC43D452}.Release.ActiveCfg = Release|Win32
|
||||
{569C6F70-F41C-47F3-A622-8A88DC43D452}.Release.Build.0 = Release|Win32
|
||||
{A4903F73-ED6C-4972-863E-F7355EB0145E}.Debug.ActiveCfg = Debug|Win32
|
||||
{A4903F73-ED6C-4972-863E-F7355EB0145E}.Debug.Build.0 = Debug|Win32
|
||||
{A4903F73-ED6C-4972-863E-F7355EB0145E}.Release.ActiveCfg = Release|Win32
|
||||
{A4903F73-ED6C-4972-863E-F7355EB0145E}.Release.Build.0 = Release|Win32
|
||||
{42B8A077-E162-4540-A688-246296ACAC1D}.Debug.ActiveCfg = Debug|Win32
|
||||
{42B8A077-E162-4540-A688-246296ACAC1D}.Debug.Build.0 = Debug|Win32
|
||||
{42B8A077-E162-4540-A688-246296ACAC1D}.Release.ActiveCfg = Release|Win32
|
||||
{42B8A077-E162-4540-A688-246296ACAC1D}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "gtest.vcproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_main", "gtest_main.vcproj", "{3AF54C8A-10BF-4332-9147-F68ED9862032}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_unittest", "gtest_unittest.vcproj", "{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_environment_test", "gtest_environment_test.vcproj", "{DF5FA93D-DC03-41A6-A18C-079198633450}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_prod_test", "gtest_prod_test.vcproj", "{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_color_test_", "gtest_color_test_.vcproj", "{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_env_var_test_", "gtest_env_var_test_.vcproj", "{569C6F70-F41C-47F3-A622-8A88DC43D452}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_output_test_", "gtest_output_test_.vcproj", "{A4903F73-ED6C-4972-863E-F7355EB0145E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_uninitialized_test_", "gtest_uninitialized_test_.vcproj", "{42B8A077-E162-4540-A688-246296ACAC1D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.ActiveCfg = Debug|Win32
|
||||
{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.Build.0 = Debug|Win32
|
||||
{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.ActiveCfg = Release|Win32
|
||||
{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.Build.0 = Release|Win32
|
||||
{3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.ActiveCfg = Debug|Win32
|
||||
{3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.Build.0 = Debug|Win32
|
||||
{3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.ActiveCfg = Release|Win32
|
||||
{3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.Build.0 = Release|Win32
|
||||
{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.ActiveCfg = Debug|Win32
|
||||
{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.Build.0 = Debug|Win32
|
||||
{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.ActiveCfg = Release|Win32
|
||||
{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.Build.0 = Release|Win32
|
||||
{DF5FA93D-DC03-41A6-A18C-079198633450}.Debug.ActiveCfg = Debug|Win32
|
||||
{DF5FA93D-DC03-41A6-A18C-079198633450}.Debug.Build.0 = Debug|Win32
|
||||
{DF5FA93D-DC03-41A6-A18C-079198633450}.Release.ActiveCfg = Release|Win32
|
||||
{DF5FA93D-DC03-41A6-A18C-079198633450}.Release.Build.0 = Release|Win32
|
||||
{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.ActiveCfg = Debug|Win32
|
||||
{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.Build.0 = Debug|Win32
|
||||
{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.ActiveCfg = Release|Win32
|
||||
{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.Build.0 = Release|Win32
|
||||
{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}.Debug.ActiveCfg = Debug|Win32
|
||||
{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}.Debug.Build.0 = Debug|Win32
|
||||
{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}.Release.ActiveCfg = Release|Win32
|
||||
{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}.Release.Build.0 = Release|Win32
|
||||
{569C6F70-F41C-47F3-A622-8A88DC43D452}.Debug.ActiveCfg = Debug|Win32
|
||||
{569C6F70-F41C-47F3-A622-8A88DC43D452}.Debug.Build.0 = Debug|Win32
|
||||
{569C6F70-F41C-47F3-A622-8A88DC43D452}.Release.ActiveCfg = Release|Win32
|
||||
{569C6F70-F41C-47F3-A622-8A88DC43D452}.Release.Build.0 = Release|Win32
|
||||
{A4903F73-ED6C-4972-863E-F7355EB0145E}.Debug.ActiveCfg = Debug|Win32
|
||||
{A4903F73-ED6C-4972-863E-F7355EB0145E}.Debug.Build.0 = Debug|Win32
|
||||
{A4903F73-ED6C-4972-863E-F7355EB0145E}.Release.ActiveCfg = Release|Win32
|
||||
{A4903F73-ED6C-4972-863E-F7355EB0145E}.Release.Build.0 = Release|Win32
|
||||
{42B8A077-E162-4540-A688-246296ACAC1D}.Debug.ActiveCfg = Debug|Win32
|
||||
{42B8A077-E162-4540-A688-246296ACAC1D}.Debug.Build.0 = Debug|Win32
|
||||
{42B8A077-E162-4540-A688-246296ACAC1D}.Release.ActiveCfg = Release|Win32
|
||||
{42B8A077-E162-4540-A688-246296ACAC1D}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
474
msvc/gtest.vcproj
Executable file → Normal file
474
msvc/gtest.vcproj
Executable file → Normal file
@@ -1,237 +1,237 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest"
|
||||
ProjectGUID="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
ReferencesPath="">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/gtestd.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
ReferencesPath=""..\include";".."">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/gtest.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\src\gtest-death-test.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-filepath.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-test-part.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-port.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-typed-test.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-death-test-internal.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-death-test.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-filepath.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-internal-inl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-internal.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-message.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-port.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-spi.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-string.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest_pred_impl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest_prod.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest"
|
||||
ProjectGUID="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
ReferencesPath="">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/gtestd.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
ReferencesPath=""..\include";".."">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/gtest.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\src\gtest-death-test.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-filepath.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-test-part.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-port.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-typed-test.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-death-test-internal.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-death-test.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-filepath.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-internal-inl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-internal.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-message.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-port.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-spi.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-string.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest_pred_impl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest_prod.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
288
msvc/gtest_color_test_.vcproj
Executable file → Normal file
288
msvc/gtest_color_test_.vcproj
Executable file → Normal file
@@ -1,144 +1,144 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_color_test_"
|
||||
ProjectGUID="{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_color_test_.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_color_test_.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_color_test_.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_color_test_.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_color_test_"
|
||||
ProjectGUID="{ABC5A7E8-072C-4A2D-B186-19EA5394B9C6}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_color_test_.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_color_test_.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_color_test_.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_color_test_.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
288
msvc/gtest_env_var_test_.vcproj
Executable file → Normal file
288
msvc/gtest_env_var_test_.vcproj
Executable file → Normal file
@@ -1,144 +1,144 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_env_var_test_"
|
||||
ProjectGUID="{569C6F70-F41C-47F3-A622-8A88DC43D452}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_env_var_test_.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_env_var_test_.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_env_var_test_.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_env_var_test_.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_env_var_test_"
|
||||
ProjectGUID="{569C6F70-F41C-47F3-A622-8A88DC43D452}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_env_var_test_.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_env_var_test_.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_env_var_test_.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_env_var_test_.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
288
msvc/gtest_environment_test.vcproj
Executable file → Normal file
288
msvc/gtest_environment_test.vcproj
Executable file → Normal file
@@ -1,144 +1,144 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_environment_test"
|
||||
ProjectGUID="{DF5FA93D-DC03-41A6-A18C-079198633450}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_environment_test.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_unittest.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_environment_test.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_environment_test.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_environment_test"
|
||||
ProjectGUID="{DF5FA93D-DC03-41A6-A18C-079198633450}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_environment_test.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_unittest.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_environment_test.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_environment_test.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
330
msvc/gtest_main.vcproj
Executable file → Normal file
330
msvc/gtest_main.vcproj
Executable file → Normal file
@@ -1,165 +1,165 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_main"
|
||||
ProjectGUID="{3AF54C8A-10BF-4332-9147-F68ED9862032}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
ReferencesPath="">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/$(ProjectName)d.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
ReferencesPath=""..\include";".."">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/$(ProjectName).lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\src\gtest_main.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-death-test-internal.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-death-test.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-filepath.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-internal-inl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-internal.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-message.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-port.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-spi.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-string.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest_pred_impl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest_prod.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_main"
|
||||
ProjectGUID="{3AF54C8A-10BF-4332-9147-F68ED9862032}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
ReferencesPath="">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/$(ProjectName)d.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
ReferencesPath=""..\include";".."">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/$(ProjectName).lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\src\gtest_main.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-death-test-internal.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-death-test.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-filepath.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\gtest-internal-inl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-internal.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-message.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-port.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest-spi.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\internal\gtest-string.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest_pred_impl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\gtest\gtest_prod.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
294
msvc/gtest_output_test_.vcproj
Executable file → Normal file
294
msvc/gtest_output_test_.vcproj
Executable file → Normal file
@@ -1,147 +1,147 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_output_test_"
|
||||
ProjectGUID="{A4903F73-ED6C-4972-863E-F7355EB0145E}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_output_test_.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_output_test_.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_output_test_.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_output_test_.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
BasicRuntimeChecks="0"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_output_test_"
|
||||
ProjectGUID="{A4903F73-ED6C-4972-863E-F7355EB0145E}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_output_test_.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_output_test_.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_output_test_.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_output_test_.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
BasicRuntimeChecks="0"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
328
msvc/gtest_prod_test.vcproj
Executable file → Normal file
328
msvc/gtest_prod_test.vcproj
Executable file → Normal file
@@ -1,164 +1,164 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_prod_test"
|
||||
ProjectGUID="{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_prod_test.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_prod_test.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_prod_test.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{3AF54C8A-10BF-4332-9147-F68ED9862032}"
|
||||
Name="gtest_main"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_prod_test.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\test\production.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\test\production.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_prod_test"
|
||||
ProjectGUID="{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_prod_test.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_prod_test.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_prod_test.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{3AF54C8A-10BF-4332-9147-F68ED9862032}"
|
||||
Name="gtest_main"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_prod_test.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\test\production.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\test\production.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
288
msvc/gtest_uninitialized_test_.vcproj
Executable file → Normal file
288
msvc/gtest_uninitialized_test_.vcproj
Executable file → Normal file
@@ -1,144 +1,144 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_uninitialized_test_"
|
||||
ProjectGUID="{42B8A077-E162-4540-A688-246296ACAC1D}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_uninitialized_test_.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_uninitialized_test_.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_uninitialized_test_.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_uninitialized_test_.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_uninitialized_test_"
|
||||
ProjectGUID="{42B8A077-E162-4540-A688-246296ACAC1D}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_uninitialized_test_.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_uninitialized_test_.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_uninitialized_test_.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_uninitialized_test_.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
294
msvc/gtest_unittest.vcproj
Executable file → Normal file
294
msvc/gtest_unittest.vcproj
Executable file → Normal file
@@ -1,147 +1,147 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_unittest"
|
||||
ProjectGUID="{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_unittest.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_unittest.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_unittest.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}"
|
||||
Name="gtest"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_unittest.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
BasicRuntimeChecks="0"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gtest_unittest"
|
||||
ProjectGUID="{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_unittest.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gtest_unittest.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gtest_unittest.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{3AF54C8A-10BF-4332-9147-F68ED9862032}"
|
||||
Name="gtest_main"/>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\test\gtest_unittest.cc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
BasicRuntimeChecks="0"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..";"..\include""
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
@@ -74,7 +74,7 @@ class PrimeTableTest : public testing::Test {
|
||||
PrimeTable* const table_;
|
||||
};
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST
|
||||
#if GTEST_HAS_TYPED_TEST
|
||||
|
||||
using testing::Types;
|
||||
|
||||
@@ -137,7 +137,7 @@ TYPED_TEST(PrimeTableTest, CanGetNextPrime) {
|
||||
|
||||
#endif // GTEST_HAS_TYPED_TEST
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
using testing::Types;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
using ::testing::TestWithParam;
|
||||
using ::testing::Values;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
|
||||
// Suppose we want to introduce a new, improved implementation of PrimeTable
|
||||
// which combines speed of PrecalcPrimeTable and versatility of
|
||||
|
||||
@@ -102,38 +102,65 @@ env = env.Clone()
|
||||
env.Prepend(CPPPATH = ['..',
|
||||
'../include'])
|
||||
|
||||
# Sources shared by base library and library that includes main.
|
||||
gtest_sources = ['../src/gtest-all.cc']
|
||||
# Sources used by base library and library that includes main.
|
||||
gtest_source = '../src/gtest-all.cc'
|
||||
gtest_main_source = '../src/gtest_main.cc'
|
||||
|
||||
# gtest.lib to be used by most apps (if you have your own main
|
||||
# function)
|
||||
gtest = env.StaticLibrary(target='gtest',
|
||||
source=gtest_sources)
|
||||
source=[gtest_source])
|
||||
|
||||
# gtest_main.lib can be used if you just want a basic main function;
|
||||
# it is also used by the tests for Google Test itself.
|
||||
gtest_main = env.StaticLibrary(target='gtest_main',
|
||||
source=gtest_sources + ['../src/gtest_main.cc'])
|
||||
source=[gtest_source, gtest_main_source])
|
||||
|
||||
env_with_exceptions = env.Clone()
|
||||
platform = env_with_exceptions['PLATFORM']
|
||||
if platform == 'win32':
|
||||
env_with_exceptions.Append(CCFLAGS = ['/EHsc'])
|
||||
env_with_exceptions.Append(CPPDEFINES = '_HAS_EXCEPTIONS=1')
|
||||
|
||||
gtest_ex_obj = env_with_exceptions.Object(target='gtest_ex',
|
||||
source=gtest_source)
|
||||
gtest_main_ex_obj = env_with_exceptions.Object(target='gtest_main_ex',
|
||||
source=gtest_main_source)
|
||||
|
||||
gtest_ex_main = env_with_exceptions.StaticLibrary(
|
||||
target='gtest_ex_main',
|
||||
source=gtest_ex_obj + gtest_main_ex_obj)
|
||||
|
||||
# Install the libraries if needed.
|
||||
if 'LIB_OUTPUT' in env.Dictionary():
|
||||
env.Install('$LIB_OUTPUT', source=[gtest, gtest_main])
|
||||
env.Install('$LIB_OUTPUT', source=[gtest, gtest_main, gtest_ex_main])
|
||||
|
||||
|
||||
def GtestBinary(env, target, dir_prefix, gtest_lib, additional_sources=None):
|
||||
def ConstructSourceList(target, dir_prefix, additional_sources=None):
|
||||
"""Helper to create source file list for gtest binaries.
|
||||
|
||||
Args:
|
||||
target: The basename of the target's main source file.
|
||||
dir_prefix: The path to prefix the main source file.
|
||||
gtest_lib: The gtest lib to use.
|
||||
additional_sources: A list of additional source files in the target.
|
||||
"""
|
||||
source = [env.File('%s.cc' % target, env.Dir(dir_prefix))]
|
||||
if additional_sources:
|
||||
source += additional_sources
|
||||
return source
|
||||
|
||||
def GtestBinary(env, target, gtest_lib, sources):
|
||||
"""Helper to create gtest binaries: tests, samples, etc.
|
||||
|
||||
Args:
|
||||
env: The SCons construction environment to use to build.
|
||||
target: The basename of the target's main source file, also used as target
|
||||
name.
|
||||
dir_prefix: The path to prefix the main source file.
|
||||
gtest_lib: The gtest lib to use.
|
||||
sources: A list of source files in the target.
|
||||
"""
|
||||
source = [env.File('%s.cc' % target, env.Dir(dir_prefix))]
|
||||
if additional_sources:
|
||||
source += additional_sources
|
||||
unit_test = env.Program(target=target, source=source, LIBS=[gtest_lib])
|
||||
unit_test = env.Program(target=target, source=sources, LIBS=[gtest_lib])
|
||||
if 'EXE_OUTPUT' in env.Dictionary():
|
||||
env.Install('$EXE_OUTPUT', source=[unit_test])
|
||||
|
||||
@@ -144,8 +171,13 @@ def GtestUnitTest(env, target, gtest_lib, additional_sources=None):
|
||||
env: The SCons construction environment to use to build.
|
||||
target: The basename of the target unit test .cc file.
|
||||
gtest_lib: The gtest lib to use.
|
||||
additional_sources: A list of additional source files in the target.
|
||||
"""
|
||||
GtestBinary(env, target, "../test", gtest_lib, additional_sources)
|
||||
GtestBinary(env,
|
||||
target,
|
||||
gtest_lib,
|
||||
ConstructSourceList(target, "../test",
|
||||
additional_sources=additional_sources))
|
||||
|
||||
GtestUnitTest(env, 'gtest-filepath_test', gtest_main)
|
||||
GtestUnitTest(env, 'gtest-message_test', gtest_main)
|
||||
@@ -163,16 +195,28 @@ GtestUnitTest(env, 'gtest-typed-test_test', gtest_main,
|
||||
additional_sources=['../test/gtest-typed-test2_test.cc'])
|
||||
GtestUnitTest(env, 'gtest-param-test_test', gtest,
|
||||
additional_sources=['../test/gtest-param-test2_test.cc'])
|
||||
GtestUnitTest(env, 'gtest_unittest', gtest)
|
||||
GtestUnitTest(env, 'gtest_unittest', gtest_main)
|
||||
GtestUnitTest(env, 'gtest_output_test_', gtest)
|
||||
GtestUnitTest(env, 'gtest_color_test_', gtest)
|
||||
GtestUnitTest(env, 'gtest-linked_ptr_test', gtest_main)
|
||||
GtestUnitTest(env, 'gtest-port_test', gtest_main)
|
||||
GtestUnitTest(env, 'gtest-death-test_test', gtest_main)
|
||||
|
||||
gtest_unittest_ex_obj = env_with_exceptions.Object(
|
||||
target='gtest_unittest_ex',
|
||||
source='../test/gtest_unittest.cc')
|
||||
GtestBinary(env_with_exceptions,
|
||||
'gtest_ex_unittest',
|
||||
gtest_ex_main,
|
||||
gtest_unittest_ex_obj)
|
||||
|
||||
# TODO(wan@google.com) Add these unit tests:
|
||||
# - gtest_break_on_failure_unittest_
|
||||
# - gtest_filter_unittest_
|
||||
# - gtest_help_test_
|
||||
# - gtest_list_tests_unittest_
|
||||
# - gtest_throw_on_failure_ex_test
|
||||
# - gtest_throw_on_failure_test_
|
||||
# - gtest_xml_outfile1_test_
|
||||
# - gtest_xml_outfile2_test_
|
||||
# - gtest_xml_output_unittest_
|
||||
@@ -195,8 +239,13 @@ def GtestSample(env, target, gtest_lib, additional_sources=None):
|
||||
env: The SCons construction environment to use to build.
|
||||
target: The basename of the target unit test .cc file.
|
||||
gtest_lib: The gtest lib to use.
|
||||
additional_sources: A list of additional source files in the target.
|
||||
"""
|
||||
GtestBinary(env, target, "../samples", gtest_lib, additional_sources)
|
||||
GtestBinary(env,
|
||||
target,
|
||||
gtest_lib,
|
||||
ConstructSourceList(target, "../samples",
|
||||
additional_sources=additional_sources))
|
||||
|
||||
# Use the GTEST_BUILD_SAMPLES build variable to control building of samples.
|
||||
# In your SConstruct file, add
|
||||
|
||||
247
scripts/fuse_gtest_files.py
Executable file
247
scripts/fuse_gtest_files.py
Executable file
@@ -0,0 +1,247 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2009, Google Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
"""fuse_gtest_files.py v0.1.0
|
||||
Fuses Google Test source code into a .h file and a .cc file.
|
||||
|
||||
SYNOPSIS
|
||||
fuse_gtest_files.py [GTEST_ROOT_DIR] OUTPUT_DIR
|
||||
|
||||
Scans GTEST_ROOT_DIR for Google Test source code, and generates
|
||||
two files: OUTPUT_DIR/gtest/gtest.h and OUTPUT_DIR/gtest/gtest-all.cc.
|
||||
Then you can build your tests by adding OUTPUT_DIR to the include
|
||||
search path and linking with OUTPUT_DIR/gtest/gtest-all.cc. These
|
||||
two files contain everything you need to use Google Test. Hence
|
||||
you can "install" Google Test by copying them to wherever you want.
|
||||
|
||||
GTEST_ROOT_DIR can be omitted and defaults to the parent directory
|
||||
of the directory holding the fuse_gtest_files.py script.
|
||||
|
||||
EXAMPLES
|
||||
./fuse_gtest_files.py fused_gtest
|
||||
./fuse_gtest_files.py path/to/unpacked/gtest fused_gtest
|
||||
|
||||
This tool is experimental. In particular, it assumes that there is no
|
||||
conditional inclusion of Google Test headers. Please report any
|
||||
problems to googletestframework@googlegroups.com. You can read
|
||||
http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide for
|
||||
more information.
|
||||
"""
|
||||
|
||||
__author__ = 'wan@google.com (Zhanyong Wan)'
|
||||
|
||||
import os
|
||||
import re
|
||||
import sets
|
||||
import sys
|
||||
|
||||
# Regex for matching '#include <gtest/...>'.
|
||||
INCLUDE_GTEST_FILE_REGEX = re.compile(r'^\s*#\s*include\s*<(gtest/.+)>')
|
||||
|
||||
# Regex for matching '#include "src/..."'.
|
||||
INCLUDE_SRC_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(src/.+)"')
|
||||
|
||||
# Where to find the source files.
|
||||
GTEST_H_SEED = 'include/gtest/gtest.h'
|
||||
GTEST_SPI_H_SEED = 'include/gtest/gtest-spi.h'
|
||||
GTEST_ALL_CC_SEED = 'src/gtest-all.cc'
|
||||
|
||||
# Where to put the generated files.
|
||||
GTEST_H_OUTPUT = 'gtest/gtest.h'
|
||||
GTEST_ALL_CC_OUTPUT = 'gtest/gtest-all.cc'
|
||||
|
||||
|
||||
def GetGTestRootDir():
|
||||
"""Returns the absolute path to the Google Test root directory.
|
||||
|
||||
We assume that this script is in a sub-directory of the Google Test root.
|
||||
"""
|
||||
|
||||
my_path = sys.argv[0] # Path to this script.
|
||||
my_dir = os.path.dirname(my_path)
|
||||
if not my_dir:
|
||||
my_dir = '.'
|
||||
|
||||
return os.path.abspath(os.path.join(my_dir, '..'))
|
||||
|
||||
|
||||
def ValidateGTestRootDir(gtest_root):
|
||||
"""Makes sure gtest_root points to a valid gtest root directory.
|
||||
|
||||
The function aborts the program on failure.
|
||||
"""
|
||||
|
||||
def VerifyFileExists(relative_path):
|
||||
"""Verifies that the given file exists; aborts on failure.
|
||||
|
||||
relative_path is the file path relative to the gtest root.
|
||||
"""
|
||||
|
||||
if not os.path.isfile(os.path.join(gtest_root, relative_path)):
|
||||
print 'ERROR: Cannot find %s in directory %s.' % (relative_path,
|
||||
gtest_root)
|
||||
print ('Please either specify a valid Google Test root directory '
|
||||
'or omit it on the command line.')
|
||||
sys.exit(1)
|
||||
|
||||
VerifyFileExists(GTEST_H_SEED)
|
||||
VerifyFileExists(GTEST_ALL_CC_SEED)
|
||||
|
||||
|
||||
def ValidateOutputDir(output_dir):
|
||||
"""Makes sure output_dir points to a valid output directory.
|
||||
|
||||
The function aborts the program on failure.
|
||||
"""
|
||||
|
||||
def VerifyOutputFile(relative_path):
|
||||
"""Verifies that the given output file path is valid.
|
||||
|
||||
relative_path is relative to the output_dir directory.
|
||||
"""
|
||||
|
||||
# Makes sure the output file either doesn't exist or can be overwritten.
|
||||
output_file = os.path.join(output_dir, relative_path)
|
||||
if os.path.exists(output_file):
|
||||
print ('%s already exists in directory %s - overwrite it? (y/N) ' %
|
||||
(relative_path, output_dir))
|
||||
answer = sys.stdin.readline().strip()
|
||||
if answer not in ['y', 'Y']:
|
||||
print 'ABORTED.'
|
||||
sys.exit(1)
|
||||
|
||||
# Makes sure the directory holding the output file exists; creates
|
||||
# it and all its ancestors if necessary.
|
||||
parent_directory = os.path.dirname(output_file)
|
||||
if not os.path.isdir(parent_directory):
|
||||
os.makedirs(parent_directory)
|
||||
|
||||
VerifyOutputFile(GTEST_H_OUTPUT)
|
||||
VerifyOutputFile(GTEST_ALL_CC_OUTPUT)
|
||||
|
||||
|
||||
def FuseGTestH(gtest_root, output_dir):
|
||||
"""Scans folder gtest_root to generate gtest/gtest.h in output_dir."""
|
||||
|
||||
output_file = file(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
|
||||
processed_files = sets.Set() # Holds all gtest headers we've processed.
|
||||
|
||||
def ProcessFile(gtest_header_path):
|
||||
"""Processes the given gtest header file."""
|
||||
|
||||
# We don't process the same header twice.
|
||||
if gtest_header_path in processed_files:
|
||||
return
|
||||
|
||||
processed_files.add(gtest_header_path)
|
||||
|
||||
# Reads each line in the given gtest header.
|
||||
for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):
|
||||
m = INCLUDE_GTEST_FILE_REGEX.match(line)
|
||||
if m:
|
||||
# It's '#include <gtest/...>' - let's process it recursively.
|
||||
ProcessFile('include/' + m.group(1))
|
||||
else:
|
||||
# Otherwise we copy the line unchanged to the output file.
|
||||
output_file.write(line)
|
||||
|
||||
ProcessFile(GTEST_H_SEED)
|
||||
output_file.close()
|
||||
|
||||
|
||||
def FuseGTestAllCc(gtest_root, output_dir):
|
||||
"""Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir."""
|
||||
|
||||
output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
|
||||
processed_files = sets.Set()
|
||||
|
||||
def ProcessFile(gtest_source_file):
|
||||
"""Processes the given gtest source file."""
|
||||
|
||||
# We don't process the same #included file twice.
|
||||
if gtest_source_file in processed_files:
|
||||
return
|
||||
|
||||
processed_files.add(gtest_source_file)
|
||||
|
||||
# Reads each line in the given gtest source file.
|
||||
for line in file(os.path.join(gtest_root, gtest_source_file), 'r'):
|
||||
m = INCLUDE_GTEST_FILE_REGEX.match(line)
|
||||
if m:
|
||||
if 'include/' + m.group(1) == GTEST_SPI_H_SEED:
|
||||
# It's '#include <gtest/gtest-spi.h>'. This file is not
|
||||
# #included by <gtest/gtest.h>, so we need to process it.
|
||||
ProcessFile(GTEST_SPI_H_SEED)
|
||||
else:
|
||||
# It's '#include <gtest/foo.h>' where foo is not gtest-spi.
|
||||
# We treat it as '#include <gtest/gtest.h>', as all other
|
||||
# gtest headers are being fused into gtest.h and cannot be
|
||||
# #included directly.
|
||||
|
||||
# There is no need to #include <gtest/gtest.h> more than once.
|
||||
if not GTEST_H_SEED in processed_files:
|
||||
processed_files.add(GTEST_H_SEED)
|
||||
output_file.write('#include <%s>\n' % (GTEST_H_OUTPUT,))
|
||||
else:
|
||||
m = INCLUDE_SRC_FILE_REGEX.match(line)
|
||||
if m:
|
||||
# It's '#include "src/foo"' - let's process it recursively.
|
||||
ProcessFile(m.group(1))
|
||||
else:
|
||||
output_file.write(line)
|
||||
|
||||
ProcessFile(GTEST_ALL_CC_SEED)
|
||||
output_file.close()
|
||||
|
||||
|
||||
def FuseGTest(gtest_root, output_dir):
|
||||
ValidateGTestRootDir(gtest_root)
|
||||
ValidateOutputDir(output_dir)
|
||||
|
||||
FuseGTestH(gtest_root, output_dir)
|
||||
FuseGTestAllCc(gtest_root, output_dir)
|
||||
|
||||
|
||||
def main():
|
||||
argc = len(sys.argv)
|
||||
if argc == 2:
|
||||
# fuse_gtest_files.py OUTPUT_DIR
|
||||
FuseGTest(GetGTestRootDir(), sys.argv[1])
|
||||
elif argc == 3:
|
||||
# fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR
|
||||
FuseGTest(sys.argv[1], sys.argv[2])
|
||||
else:
|
||||
print __doc__
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,56 +1,61 @@
|
||||
#!/bin/sh
|
||||
|
||||
# These variables are automatically filled in by the configure script.
|
||||
prefix="@prefix@"
|
||||
exec_prefix="@exec_prefix@"
|
||||
libdir="@libdir@"
|
||||
includedir="@includedir@"
|
||||
name="@PACKAGE_TARNAME@"
|
||||
version="@PACKAGE_VERSION@"
|
||||
|
||||
gtest_ldflags="-L${libdir}"
|
||||
gtest_libs="-l${name}"
|
||||
gtest_cppflags="-I${includedir}"
|
||||
gtest_cxxflags=""
|
||||
|
||||
show_usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: gtest-config [OPTIONS...]
|
||||
EOF
|
||||
echo "Usage: gtest-config [OPTIONS...]"
|
||||
}
|
||||
|
||||
show_help()
|
||||
{
|
||||
show_usage
|
||||
cat <<EOF
|
||||
cat <<\EOF
|
||||
|
||||
The \`gtest-config' script provides access to the necessary compile and linking
|
||||
flags to connect with Google C++ Testing framework. The installation queries
|
||||
may only be issued one at a time, and may not be issued with any other types of
|
||||
queries. The version queries and compiler flag queries may be combined as
|
||||
desired but not mixed. Different version queries are always combined with "and"
|
||||
logical semantics, and only the last of any particular query is used and all
|
||||
previous ones ignored. All versions must be specified as a sequence of numbers
|
||||
separated by periods. Compiler flag queries output the union of the sets of
|
||||
flags when combined.
|
||||
The `gtest-config' script provides access to the necessary compile and linking
|
||||
flags to connect with Google C++ Testing Framework, both in a build prior to
|
||||
installation, and on the system proper after installation. The installation
|
||||
overrides may be issued in combination with any other queries, but will only
|
||||
affect installation queries if called on a built but not installed gtest. The
|
||||
installation queries may not be issued with any other types of queries, and
|
||||
only one installation query may be made at a time. The version queries and
|
||||
compiler flag queries may be combined as desired but not mixed. Different
|
||||
version queries are always combined with logical "and" semantics, and only the
|
||||
last of any particular query is used while all previous ones ignored. All
|
||||
versions must be specified as a sequence of numbers separated by periods.
|
||||
Compiler flag queries output the union of the sets of flags when combined.
|
||||
|
||||
Examples:
|
||||
gtest-config --min-version=1.0 || echo "Insufficient Google Test version."
|
||||
|
||||
gcc \$(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp
|
||||
gcc \$(gtest-config --ldflags --libs) -o foo foo.o
|
||||
|
||||
g++ $(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp
|
||||
g++ $(gtest-config --ldflags --libs) -o foo foo.o
|
||||
|
||||
# When using a built but not installed Google Test:
|
||||
g++ $(../../my_gtest_build/scripts/gtest-config ...) ...
|
||||
|
||||
# When using an installed Google Test, but with installation overrides:
|
||||
export GTEST_PREFIX="/opt"
|
||||
g++ $(gtest-config --libdir="/opt/lib64" ...) ...
|
||||
|
||||
Help:
|
||||
--usage brief usage information
|
||||
--help display this help message
|
||||
|
||||
Installation Overrides:
|
||||
--prefix=<dir> overrides the installation prefix
|
||||
--exec-prefix=<dir> overrides the executable installation prefix
|
||||
--libdir=<dir> overrides the library installation prefix
|
||||
--includedir=<dir> overrides the header file installation prefix
|
||||
|
||||
Installation Queries:
|
||||
--prefix installation prefix
|
||||
--exec-prefix executable installation prefix
|
||||
--libdir library installation directory
|
||||
--includedir header file installation directory
|
||||
--version the version of the INC installation
|
||||
--version the version of the Google Test installation
|
||||
|
||||
Version Queries:
|
||||
--min-version=VERSION return 0 if the version is at least VERSION
|
||||
@@ -68,11 +73,13 @@ EOF
|
||||
|
||||
# This function bounds our version with a min and a max. It uses some clever
|
||||
# POSIX-compliant variable expansion to portably do all the work in the shell
|
||||
# and avoid any dependency on a particular "sed" implementation. Notable is
|
||||
# that it will only ever compare the first 3 components of versions. Further
|
||||
# components will be cleanly stripped off. All versions must be unadorned, so
|
||||
# "v1.0" will *not* work. The minimum version must be in $1, and the max in
|
||||
# $2.
|
||||
# and avoid any dependency on a particular "sed" or "awk" implementation.
|
||||
# Notable is that it will only ever compare the first 3 components of versions.
|
||||
# Further components will be cleanly stripped off. All versions must be
|
||||
# unadorned, so "v1.0" will *not* work. The minimum version must be in $1, and
|
||||
# the max in $2. TODO(chandlerc@google.com): If this ever breaks, we should
|
||||
# investigate expanding this via autom4te from AS_VERSION_COMPARE rather than
|
||||
# continuing to maintain our own shell version.
|
||||
check_versions()
|
||||
{
|
||||
major_version=${version%%.*}
|
||||
@@ -140,13 +147,25 @@ fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--usage) show_usage; exit 0;;
|
||||
--help) show_help; exit 0;;
|
||||
--prefix) echo $prefix; exit 0;;
|
||||
--exec-prefix) echo $exec_prefix; exit 0;;
|
||||
--libdir) echo $libdir; exit 0;;
|
||||
--includedir) echo $includedir; exit 0;;
|
||||
--version) echo $version; exit 0;;
|
||||
--usage) show_usage; exit 0;;
|
||||
--help) show_help; exit 0;;
|
||||
|
||||
# Installation overrides
|
||||
--prefix=*) GTEST_PREFIX=${1#--prefix=};;
|
||||
--exec-prefix=*) GTEST_EXEC_PREFIX=${1#--exec-prefix=};;
|
||||
--libdir=*) GTEST_LIBDIR=${1#--libdir=};;
|
||||
--includedir=*) GTEST_INCLUDEDIR=${1#--includedir=};;
|
||||
|
||||
# Installation queries
|
||||
--prefix|--exec-prefix|--libdir|--includedir|--version)
|
||||
if test -n "${do_query}"; then
|
||||
show_usage
|
||||
exit 1
|
||||
fi
|
||||
do_query=${1#--}
|
||||
;;
|
||||
|
||||
# Version checking
|
||||
--min-version=*)
|
||||
do_check_versions=yes
|
||||
min_version=${1#--min-version=}
|
||||
@@ -159,17 +178,73 @@ while test $# -gt 0; do
|
||||
do_check_versions=yes
|
||||
exact_version=${1#--exact-version=}
|
||||
;;
|
||||
--cppflags) echo_cppflags=yes;;
|
||||
--cxxflags) echo_cxxflags=yes;;
|
||||
--ldflags) echo_ldflags=yes;;
|
||||
--libs) echo_libs=yes;;
|
||||
|
||||
# Compiler flag output
|
||||
--cppflags) echo_cppflags=yes;;
|
||||
--cxxflags) echo_cxxflags=yes;;
|
||||
--ldflags) echo_ldflags=yes;;
|
||||
--libs) echo_libs=yes;;
|
||||
|
||||
# Everything else is an error
|
||||
*) show_usage; exit 1;;
|
||||
*) show_usage; exit 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# These have defaults filled in by the configure script but can also be
|
||||
# overridden by environment variables or command line parameters.
|
||||
prefix="${GTEST_PREFIX:-@prefix@}"
|
||||
exec_prefix="${GTEST_EXEC_PREFIX:-@exec_prefix@}"
|
||||
libdir="${GTEST_LIBDIR:-@libdir@}"
|
||||
includedir="${GTEST_INCLUDEDIR:-@includedir@}"
|
||||
|
||||
# We try and detect if our binary is not located at its installed location. If
|
||||
# it's not, we provide variables pointing to the source and build tree rather
|
||||
# than to the install tree. This allows building against a just-built gtest
|
||||
# rather than an installed gtest.
|
||||
bindir="@bindir@"
|
||||
this_relative_bindir=`dirname $0`
|
||||
this_bindir=`cd ${this_relative_bindir}; pwd -P`
|
||||
if test "${this_bindir}" = "${this_bindir%${bindir}}"; then
|
||||
# The path to the script doesn't end in the bindir sequence from Autoconf,
|
||||
# assume that we are in a build tree.
|
||||
build_dir=`dirname ${this_bindir}`
|
||||
src_dir=`cd ${this_bindir}/@top_srcdir@; pwd -P`
|
||||
|
||||
# TODO(chandlerc@google.com): This is a dangerous dependency on libtool, we
|
||||
# should work to remove it, and/or remove libtool altogether, replacing it
|
||||
# with direct references to the library and a link path.
|
||||
gtest_libs="${build_dir}/lib/libgtest.la"
|
||||
gtest_ldflags=""
|
||||
|
||||
# We provide hooks to include from either the source or build dir, where the
|
||||
# build dir is always preferred. This will potentially allow us to write
|
||||
# build rules for generated headers and have them automatically be preferred
|
||||
# over provided versions.
|
||||
gtest_cppflags="-I${build_dir}/include -I${src_dir}/include"
|
||||
gtest_cxxflags=""
|
||||
else
|
||||
# We're using an installed gtest, although it may be staged under some
|
||||
# prefix. Assume (as our own libraries do) that we can resolve the prefix,
|
||||
# and are present in the dynamic link paths.
|
||||
gtest_ldflags="-L${libdir}"
|
||||
gtest_libs="-l${name}"
|
||||
gtest_cppflags="-I${includedir}"
|
||||
gtest_cxxflags=""
|
||||
fi
|
||||
|
||||
# Do an installation query if requested.
|
||||
if test -n "$do_query"; then
|
||||
case $do_query in
|
||||
prefix) echo $prefix; exit 0;;
|
||||
exec-prefix) echo $exec_prefix; exit 0;;
|
||||
libdir) echo $libdir; exit 0;;
|
||||
includedir) echo $includedir; exit 0;;
|
||||
version) echo $version; exit 0;;
|
||||
*) show_usage; exit 1;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Do a version check if requested.
|
||||
if test "$do_check_versions" = "yes"; then
|
||||
# Make sure we didn't receive a bad combination of parameters.
|
||||
|
||||
57
scripts/test/Makefile
Normal file
57
scripts/test/Makefile
Normal file
@@ -0,0 +1,57 @@
|
||||
# A Makefile for fusing Google Test and building a sample test against it.
|
||||
#
|
||||
# SYNOPSIS:
|
||||
#
|
||||
# make [all] - makes everything.
|
||||
# make TARGET - makes the given target.
|
||||
# make check - makes everything and runs the built sample test.
|
||||
# make clean - removes all files generated by make.
|
||||
|
||||
# Points to the root of fused Google Test, relative to where this file is.
|
||||
FUSED_GTEST_DIR = output
|
||||
|
||||
# Paths to the fused gtest files.
|
||||
FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h
|
||||
FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc
|
||||
|
||||
# Where to find the sample test.
|
||||
SAMPLE_DIR = ../../samples
|
||||
|
||||
# Where to find gtest_main.cc.
|
||||
GTEST_MAIN_CC = ../../src/gtest_main.cc
|
||||
|
||||
# Flags passed to the preprocessor.
|
||||
CPPFLAGS += -I$(FUSED_GTEST_DIR)
|
||||
|
||||
# Flags passed to the C++ compiler.
|
||||
CXXFLAGS += -g
|
||||
|
||||
all : sample1_unittest
|
||||
|
||||
check : all
|
||||
./sample1_unittest
|
||||
|
||||
clean :
|
||||
rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o
|
||||
|
||||
$(FUSED_GTEST_H) :
|
||||
../fuse_gtest_files.py $(FUSED_GTEST_DIR)
|
||||
|
||||
$(FUSED_GTEST_ALL_CC) :
|
||||
../fuse_gtest_files.py $(FUSED_GTEST_DIR)
|
||||
|
||||
gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc
|
||||
|
||||
gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC)
|
||||
|
||||
sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc
|
||||
|
||||
sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \
|
||||
$(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc
|
||||
|
||||
sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@
|
||||
1387
scripts/upload.py
Executable file
1387
scripts/upload.py
Executable file
File diff suppressed because it is too large
Load Diff
78
scripts/upload_gtest.py
Executable file
78
scripts/upload_gtest.py
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2009, Google Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
"""upload_gtest.py v0.1.0 -- uploads a Google Test patch for review.
|
||||
|
||||
This simple wrapper passes all command line flags and
|
||||
--cc=googletestframework@googlegroups.com to upload.py.
|
||||
|
||||
USAGE: upload_gtest.py [options for upload.py]
|
||||
"""
|
||||
|
||||
__author__ = 'wan@google.com (Zhanyong Wan)'
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
CC_FLAG = '--cc='
|
||||
GTEST_GROUP = 'googletestframework@googlegroups.com'
|
||||
|
||||
|
||||
def main():
|
||||
# Finds the path to upload.py, assuming it is in the same directory
|
||||
# as this file.
|
||||
my_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
upload_py_path = os.path.join(my_dir, 'upload.py')
|
||||
|
||||
# Adds Google Test discussion group to the cc line if it's not there
|
||||
# already.
|
||||
upload_py_argv = [upload_py_path]
|
||||
found_cc_flag = False
|
||||
for arg in sys.argv[1:]:
|
||||
if arg.startswith(CC_FLAG):
|
||||
found_cc_flag = True
|
||||
cc_line = arg[len(CC_FLAG):]
|
||||
cc_list = [addr for addr in cc_line.split(',') if addr]
|
||||
if GTEST_GROUP not in cc_list:
|
||||
cc_list.append(GTEST_GROUP)
|
||||
upload_py_argv.append(CC_FLAG + ','.join(cc_list))
|
||||
else:
|
||||
upload_py_argv.append(arg)
|
||||
|
||||
if not found_cc_flag:
|
||||
upload_py_argv.append(CC_FLAG + GTEST_GROUP)
|
||||
|
||||
# Invokes upload.py with the modified command line flags.
|
||||
os.execv(upload_py_path, upload_py_argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,21 +36,22 @@
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#include <windows.h>
|
||||
#elif defined(GTEST_OS_WINDOWS)
|
||||
#elif GTEST_OS_WINDOWS
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#include <sys/stat.h>
|
||||
#elif defined(GTEST_OS_SYMBIAN)
|
||||
#elif GTEST_OS_SYMBIAN
|
||||
// Symbian OpenC has PATH_MAX in sys/syslimits.h
|
||||
#include <sys/syslimits.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h> // NOLINT
|
||||
#include <unistd.h> // NOLINT
|
||||
#include <climits> // Some Linux distributions define PATH_MAX here.
|
||||
#endif // _WIN32_WCE or _WIN32
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#define GTEST_PATH_MAX_ _MAX_PATH
|
||||
#elif defined(PATH_MAX)
|
||||
#define GTEST_PATH_MAX_ PATH_MAX
|
||||
@@ -65,7 +66,7 @@
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
const char kPathSeparator = '\\';
|
||||
const char kPathSeparatorString[] = "\\";
|
||||
#ifdef _WIN32_WCE
|
||||
@@ -90,7 +91,7 @@ FilePath FilePath::GetCurrentDir() {
|
||||
// Windows CE doesn't have a current directory, so we just return
|
||||
// something reasonable.
|
||||
return FilePath(kCurrentDirectoryString);
|
||||
#elif defined(GTEST_OS_WINDOWS)
|
||||
#elif GTEST_OS_WINDOWS
|
||||
char cwd[GTEST_PATH_MAX_ + 1] = {};
|
||||
return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
|
||||
#else
|
||||
@@ -144,19 +145,28 @@ FilePath FilePath::MakeFileName(const FilePath& directory,
|
||||
const FilePath& base_name,
|
||||
int number,
|
||||
const char* extension) {
|
||||
FilePath dir(directory.RemoveTrailingPathSeparator());
|
||||
if (number == 0) {
|
||||
return FilePath(String::Format("%s%c%s.%s", dir.c_str(), kPathSeparator,
|
||||
base_name.c_str(), extension));
|
||||
}
|
||||
return FilePath(String::Format("%s%c%s_%d.%s", dir.c_str(), kPathSeparator,
|
||||
base_name.c_str(), number, extension));
|
||||
const FilePath file_name(
|
||||
(number == 0) ?
|
||||
String::Format("%s.%s", base_name.c_str(), extension) :
|
||||
String::Format("%s_%d.%s", base_name.c_str(), number, extension));
|
||||
return ConcatPaths(directory, file_name);
|
||||
}
|
||||
|
||||
// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml".
|
||||
// On Windows, uses \ as the separator rather than /.
|
||||
FilePath FilePath::ConcatPaths(const FilePath& directory,
|
||||
const FilePath& relative_path) {
|
||||
if (directory.IsEmpty())
|
||||
return relative_path;
|
||||
const FilePath dir(directory.RemoveTrailingPathSeparator());
|
||||
return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator,
|
||||
relative_path.c_str()));
|
||||
}
|
||||
|
||||
// Returns true if pathname describes something findable in the file-system,
|
||||
// either a file, directory, or whatever.
|
||||
bool FilePath::FileOrDirectoryExists() const {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef _WIN32_WCE
|
||||
LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
|
||||
const DWORD attributes = GetFileAttributes(unicode);
|
||||
@@ -176,7 +186,7 @@ bool FilePath::FileOrDirectoryExists() const {
|
||||
// that exists.
|
||||
bool FilePath::DirectoryExists() const {
|
||||
bool result = false;
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Don't strip off trailing separator if path is a root directory on
|
||||
// Windows (like "C:\\").
|
||||
const FilePath& path(IsRootDirectory() ? *this :
|
||||
@@ -205,15 +215,27 @@ bool FilePath::DirectoryExists() const {
|
||||
// Returns true if pathname describes a root directory. (Windows has one
|
||||
// root directory per disk drive.)
|
||||
bool FilePath::IsRootDirectory() const {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// TODO(wan@google.com): on Windows a network share like
|
||||
// \\server\share can be a root directory, although it cannot be the
|
||||
// current directory. Handle this properly.
|
||||
return pathname_.GetLength() == 3 && IsAbsolutePath();
|
||||
#else
|
||||
return pathname_ == kPathSeparatorString;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns true if pathname describes an absolute path.
|
||||
bool FilePath::IsAbsolutePath() const {
|
||||
const char* const name = pathname_.c_str();
|
||||
return pathname_.GetLength() == 3 &&
|
||||
#if GTEST_OS_WINDOWS
|
||||
return pathname_.GetLength() >= 3 &&
|
||||
((name[0] >= 'a' && name[0] <= 'z') ||
|
||||
(name[0] >= 'A' && name[0] <= 'Z')) &&
|
||||
name[1] == ':' &&
|
||||
name[2] == kPathSeparator;
|
||||
#else
|
||||
return pathname_ == kPathSeparatorString;
|
||||
return name[0] == kPathSeparator;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -264,7 +286,7 @@ bool FilePath::CreateDirectoriesRecursively() const {
|
||||
// directory for any reason, including if the parent directory does not
|
||||
// exist. Not named "CreateDirectory" because that's a macro on Windows.
|
||||
bool FilePath::CreateFolder() const {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef _WIN32_WCE
|
||||
FilePath removed_sep(this->RemoveTrailingPathSeparator());
|
||||
LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
|
||||
|
||||
@@ -37,20 +37,24 @@
|
||||
#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
|
||||
#define GTEST_SRC_GTEST_INTERNAL_INL_H_
|
||||
|
||||
// GTEST_IMPLEMENTATION is defined iff the current translation unit is
|
||||
// part of Google Test's implementation.
|
||||
#ifndef GTEST_IMPLEMENTATION
|
||||
// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
|
||||
// part of Google Test's implementation; otherwise it's undefined.
|
||||
#if !GTEST_IMPLEMENTATION_
|
||||
// A user is trying to include this from his code - just say no.
|
||||
#error "gtest-internal-inl.h is part of Google Test's internal implementation."
|
||||
#error "It must not be included except by Google Test itself."
|
||||
#endif // GTEST_IMPLEMENTATION
|
||||
#endif // GTEST_IMPLEMENTATION_
|
||||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h> // For strtoll/_strtoul64.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#include <windows.h> // NOLINT
|
||||
#if GTEST_OS_WINDOWS
|
||||
#include <windows.h> // For DWORD.
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
@@ -60,19 +64,10 @@ namespace testing {
|
||||
|
||||
// Declares the flags.
|
||||
//
|
||||
// We don't want the users to modify these flags in the code, but want
|
||||
// Google Test's own unit tests to be able to access them. Therefore we
|
||||
// declare them here as opposed to in gtest.h.
|
||||
GTEST_DECLARE_bool_(break_on_failure);
|
||||
GTEST_DECLARE_bool_(catch_exceptions);
|
||||
GTEST_DECLARE_string_(color);
|
||||
GTEST_DECLARE_string_(filter);
|
||||
GTEST_DECLARE_bool_(list_tests);
|
||||
GTEST_DECLARE_string_(output);
|
||||
GTEST_DECLARE_bool_(print_time);
|
||||
GTEST_DECLARE_int32_(repeat);
|
||||
GTEST_DECLARE_int32_(stack_trace_depth);
|
||||
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
||||
// We don't want the users to modify this flag in the code, but want
|
||||
// Google Test's own unit tests to be able to access it. Therefore we
|
||||
// declare it here as opposed to in gtest.h.
|
||||
GTEST_DECLARE_bool_(death_test_use_fork);
|
||||
|
||||
namespace internal {
|
||||
|
||||
@@ -81,6 +76,7 @@ namespace internal {
|
||||
extern const TypeId kTestTypeIdInGoogleTest;
|
||||
|
||||
// Names of the flags (needed for parsing Google Test flags).
|
||||
const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
|
||||
const char kBreakOnFailureFlag[] = "break_on_failure";
|
||||
const char kCatchExceptionsFlag[] = "catch_exceptions";
|
||||
const char kColorFlag[] = "color";
|
||||
@@ -89,6 +85,7 @@ const char kListTestsFlag[] = "list_tests";
|
||||
const char kOutputFlag[] = "output";
|
||||
const char kPrintTimeFlag[] = "print_time";
|
||||
const char kRepeatFlag[] = "repeat";
|
||||
const char kThrowOnFailureFlag[] = "throw_on_failure";
|
||||
|
||||
// This class saves the values of all Google Test flags in its c'tor, and
|
||||
// restores them in its d'tor.
|
||||
@@ -96,37 +93,45 @@ class GTestFlagSaver {
|
||||
public:
|
||||
// The c'tor.
|
||||
GTestFlagSaver() {
|
||||
also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
|
||||
break_on_failure_ = GTEST_FLAG(break_on_failure);
|
||||
catch_exceptions_ = GTEST_FLAG(catch_exceptions);
|
||||
color_ = GTEST_FLAG(color);
|
||||
death_test_style_ = GTEST_FLAG(death_test_style);
|
||||
death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
|
||||
filter_ = GTEST_FLAG(filter);
|
||||
internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
|
||||
list_tests_ = GTEST_FLAG(list_tests);
|
||||
output_ = GTEST_FLAG(output);
|
||||
print_time_ = GTEST_FLAG(print_time);
|
||||
repeat_ = GTEST_FLAG(repeat);
|
||||
throw_on_failure_ = GTEST_FLAG(throw_on_failure);
|
||||
}
|
||||
|
||||
// The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
|
||||
~GTestFlagSaver() {
|
||||
GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
|
||||
GTEST_FLAG(break_on_failure) = break_on_failure_;
|
||||
GTEST_FLAG(catch_exceptions) = catch_exceptions_;
|
||||
GTEST_FLAG(color) = color_;
|
||||
GTEST_FLAG(death_test_style) = death_test_style_;
|
||||
GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
|
||||
GTEST_FLAG(filter) = filter_;
|
||||
GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
|
||||
GTEST_FLAG(list_tests) = list_tests_;
|
||||
GTEST_FLAG(output) = output_;
|
||||
GTEST_FLAG(print_time) = print_time_;
|
||||
GTEST_FLAG(repeat) = repeat_;
|
||||
GTEST_FLAG(throw_on_failure) = throw_on_failure_;
|
||||
}
|
||||
private:
|
||||
// Fields for saving the original values of flags.
|
||||
bool also_run_disabled_tests_;
|
||||
bool break_on_failure_;
|
||||
bool catch_exceptions_;
|
||||
String color_;
|
||||
String death_test_style_;
|
||||
bool death_test_use_fork_;
|
||||
String filter_;
|
||||
String internal_run_death_test_;
|
||||
bool list_tests_;
|
||||
@@ -134,6 +139,7 @@ class GTestFlagSaver {
|
||||
bool print_time_;
|
||||
bool pretty_;
|
||||
internal::Int32 repeat_;
|
||||
bool throw_on_failure_;
|
||||
} GTEST_ATTRIBUTE_UNUSED_;
|
||||
|
||||
// Converts a Unicode code point to a narrow string in UTF-8 encoding.
|
||||
@@ -164,6 +170,32 @@ String WideStringToUtf8(const wchar_t* str, int num_chars);
|
||||
// Returns the number of active threads, or 0 when there is an error.
|
||||
size_t GetThreadCount();
|
||||
|
||||
// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
|
||||
// if the variable is present. If a file already exists at this location, this
|
||||
// function will write over it. If the variable is present, but the file cannot
|
||||
// be created, prints an error and exits.
|
||||
void WriteToShardStatusFileIfNeeded();
|
||||
|
||||
// Checks whether sharding is enabled by examining the relevant
|
||||
// environment variable values. If the variables are present,
|
||||
// but inconsistent (e.g., shard_index >= total_shards), prints
|
||||
// an error and exits. If in_subprocess_for_death_test, sharding is
|
||||
// disabled because it must only be applied to the original test
|
||||
// process. Otherwise, we could filter out death tests we intended to execute.
|
||||
bool ShouldShard(const char* total_shards_str, const char* shard_index_str,
|
||||
bool in_subprocess_for_death_test);
|
||||
|
||||
// Parses the environment variable var as an Int32. If it is unset,
|
||||
// returns default_val. If it is not an Int32, prints an error and
|
||||
// and aborts.
|
||||
Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
|
||||
|
||||
// Given the total number of shards, the shard index, and the test id,
|
||||
// returns true iff the test should be run on this shard. The test id is
|
||||
// some arbitrary but unique non-negative integer assigned to each test
|
||||
// method. Assumes that 0 <= shard_index < total_shards.
|
||||
bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id);
|
||||
|
||||
// List is a simple singly-linked list container.
|
||||
//
|
||||
// We cannot use std::list as Microsoft's implementation of STL has
|
||||
@@ -790,9 +822,10 @@ class UnitTestOptions {
|
||||
// Returns the output format, or "" for normal printed output.
|
||||
static String GetOutputFormat();
|
||||
|
||||
// Returns the name of the requested output file, or the default if none
|
||||
// was explicitly specified.
|
||||
static String GetOutputFile();
|
||||
// Returns the absolute path of the requested output file, or the
|
||||
// default (test_detail.xml in the original working directory) if
|
||||
// none was explicitly specified.
|
||||
static String GetAbsolutePathToOutputFile();
|
||||
|
||||
// Functions for processing the gtest_filter flag.
|
||||
|
||||
@@ -808,7 +841,7 @@ class UnitTestOptions {
|
||||
static bool FilterMatchesTest(const String &test_case_name,
|
||||
const String &test_name);
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Function for supporting the gtest_catch_exception flag.
|
||||
|
||||
// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
|
||||
@@ -891,6 +924,8 @@ class DefaultGlobalTestPartResultReporter
|
||||
|
||||
private:
|
||||
UnitTestImpl* const unit_test_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
|
||||
};
|
||||
|
||||
// This is the default per thread test part result reporter used in
|
||||
@@ -905,6 +940,8 @@ class DefaultPerThreadTestPartResultReporter
|
||||
|
||||
private:
|
||||
UnitTestImpl* const unit_test_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
|
||||
};
|
||||
|
||||
// The private implementation of the UnitTest class. We don't protect
|
||||
@@ -1066,7 +1103,7 @@ class UnitTestImpl {
|
||||
tear_down_tc)->AddTestInfo(test_info);
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// Returns ParameterizedTestCaseRegistry object used to keep track of
|
||||
// value-parameterized tests and instantiate and register them.
|
||||
internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
|
||||
@@ -1108,11 +1145,18 @@ class UnitTestImpl {
|
||||
ad_hoc_test_result_.Clear();
|
||||
}
|
||||
|
||||
enum ReactionToSharding {
|
||||
HONOR_SHARDING_PROTOCOL,
|
||||
IGNORE_SHARDING_PROTOCOL
|
||||
};
|
||||
|
||||
// Matches the full name of each test against the user-specified
|
||||
// filter to decide whether the test should run, then records the
|
||||
// result in each TestCase and TestInfo object.
|
||||
// If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
|
||||
// based on sharding variables in the environment.
|
||||
// Returns the number of tests that should run.
|
||||
int FilterTests();
|
||||
int FilterTests(ReactionToSharding shard_tests);
|
||||
|
||||
// Lists all the tests by name.
|
||||
void ListAllTests();
|
||||
@@ -1139,7 +1183,7 @@ class UnitTestImpl {
|
||||
return gtest_trace_stack_.pointer();
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
// Returns a pointer to the parsed --gtest_internal_run_death_test
|
||||
// flag, or NULL if that flag was not specified.
|
||||
// This information is useful only in a death test child process.
|
||||
@@ -1188,7 +1232,7 @@ class UnitTestImpl {
|
||||
|
||||
internal::List<TestCase*> test_cases_; // The list of TestCases.
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// ParameterizedTestRegistry object used to register value-parameterized
|
||||
// tests.
|
||||
internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
|
||||
@@ -1237,7 +1281,7 @@ class UnitTestImpl {
|
||||
// How long the test took to run, in milliseconds.
|
||||
TimeInMillis elapsed_time_;
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
// The decomposed components of the gtest_internal_run_death_test flag,
|
||||
// parsed when RUN_ALL_TESTS is called.
|
||||
internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
|
||||
@@ -1256,11 +1300,98 @@ inline UnitTestImpl* GetUnitTestImpl() {
|
||||
return UnitTest::GetInstance()->impl();
|
||||
}
|
||||
|
||||
// Internal helper functions for implementing the simple regular
|
||||
// expression matcher.
|
||||
bool IsInSet(char ch, const char* str);
|
||||
bool IsDigit(char ch);
|
||||
bool IsPunct(char ch);
|
||||
bool IsRepeat(char ch);
|
||||
bool IsWhiteSpace(char ch);
|
||||
bool IsWordChar(char ch);
|
||||
bool IsValidEscape(char ch);
|
||||
bool AtomMatchesChar(bool escaped, char pattern, char ch);
|
||||
bool ValidateRegex(const char* regex);
|
||||
bool MatchRegexAtHead(const char* regex, const char* str);
|
||||
bool MatchRepetitionAndRegexAtHead(
|
||||
bool escaped, char ch, char repeat, const char* regex, const char* str);
|
||||
bool MatchRegexAnywhere(const char* regex, const char* str);
|
||||
|
||||
// Parses the command line for Google Test flags, without initializing
|
||||
// other parts of Google Test.
|
||||
void ParseGoogleTestFlagsOnly(int* argc, char** argv);
|
||||
void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Returns the message describing the last system error, regardless of the
|
||||
// platform.
|
||||
String GetLastSystemErrorMessage();
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Provides leak-safe Windows kernel handle ownership.
|
||||
class AutoHandle {
|
||||
public:
|
||||
AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
|
||||
explicit AutoHandle(HANDLE handle) : handle_(handle) {}
|
||||
|
||||
~AutoHandle() { Reset(); }
|
||||
|
||||
HANDLE Get() const { return handle_; }
|
||||
void Reset() { Reset(INVALID_HANDLE_VALUE); }
|
||||
void Reset(HANDLE handle) {
|
||||
if (handle != handle_) {
|
||||
if (handle_ != INVALID_HANDLE_VALUE)
|
||||
::CloseHandle(handle_);
|
||||
handle_ = handle;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
HANDLE handle_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
|
||||
};
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
// Attempts to parse a string into a positive integer pointed to by the
|
||||
// number parameter. Returns true if that is possible.
|
||||
// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
|
||||
// it here.
|
||||
template <typename Integer>
|
||||
bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
|
||||
// Fail fast if the given string does not begin with a digit;
|
||||
// this bypasses strtoXXX's "optional leading whitespace and plus
|
||||
// or minus sign" semantics, which are undesirable here.
|
||||
if (str.empty() || !isdigit(str[0])) {
|
||||
return false;
|
||||
}
|
||||
errno = 0;
|
||||
|
||||
char* end;
|
||||
// BiggestConvertible is the largest integer type that system-provided
|
||||
// string-to-number conversion routines can return.
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef unsigned __int64 BiggestConvertible;
|
||||
const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
|
||||
#else
|
||||
typedef unsigned long long BiggestConvertible; // NOLINT
|
||||
const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
const bool parse_success = *end == '\0' && errno == 0;
|
||||
|
||||
// TODO(vladl@google.com): Convert this to compile time assertion when it is
|
||||
// available.
|
||||
GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
|
||||
|
||||
const Integer result = static_cast<Integer>(parsed);
|
||||
if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
|
||||
*number = result;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
|
||||
@@ -35,9 +35,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#include <regex.h>
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_OS_WINDOWS
|
||||
#include <io.h>
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#if GTEST_USES_SIMPLE_RE
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#include <windows.h> // For TerminateProcess()
|
||||
@@ -47,11 +54,26 @@
|
||||
#include <gtest/gtest-message.h>
|
||||
#include <gtest/internal/gtest-string.h>
|
||||
|
||||
// Indicates that this translation unit is part of Google Test's
|
||||
// implementation. It must come before gtest-internal-inl.h is
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Microsoft does not provide a definition of STDERR_FILENO.
|
||||
const int kStdErrFileno = 2;
|
||||
#else
|
||||
const int kStdErrFileno = STDERR_FILENO;
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#if GTEST_USES_POSIX_RE
|
||||
|
||||
// Implements RE. Currently only needed for death tests.
|
||||
|
||||
@@ -93,7 +115,13 @@ void RE::Init(const char* regex) {
|
||||
// previous expression returns false. Otherwise partial_regex_ may
|
||||
// not be properly initialized can may cause trouble when it's
|
||||
// freed.
|
||||
is_valid_ = (regcomp(&partial_regex_, regex, REG_EXTENDED) == 0) && is_valid_;
|
||||
//
|
||||
// Some implementation of POSIX regex (e.g. on at least some
|
||||
// versions of Cygwin) doesn't accept the empty string as a valid
|
||||
// regex. We change it to an equivalent form "()" to be safe.
|
||||
const char* const partial_regex = (*regex == '\0') ? "()" : regex;
|
||||
is_valid_ = (regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0)
|
||||
&& is_valid_;
|
||||
EXPECT_TRUE(is_valid_)
|
||||
<< "Regular expression \"" << regex
|
||||
<< "\" is not a valid POSIX Extended regular expression.";
|
||||
@@ -101,7 +129,262 @@ void RE::Init(const char* regex) {
|
||||
delete[] full_pattern;
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
#elif GTEST_USES_SIMPLE_RE
|
||||
|
||||
// Returns true iff ch appears anywhere in str (excluding the
|
||||
// terminating '\0' character).
|
||||
bool IsInSet(char ch, const char* str) {
|
||||
return ch != '\0' && strchr(str, ch) != NULL;
|
||||
}
|
||||
|
||||
// Returns true iff ch belongs to the given classification. Unlike
|
||||
// similar functions in <ctype.h>, these aren't affected by the
|
||||
// current locale.
|
||||
bool IsDigit(char ch) { return '0' <= ch && ch <= '9'; }
|
||||
bool IsPunct(char ch) {
|
||||
return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
|
||||
}
|
||||
bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
|
||||
bool IsWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
|
||||
bool IsWordChar(char ch) {
|
||||
return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
|
||||
('0' <= ch && ch <= '9') || ch == '_';
|
||||
}
|
||||
|
||||
// Returns true iff "\\c" is a supported escape sequence.
|
||||
bool IsValidEscape(char c) {
|
||||
return (IsPunct(c) || IsInSet(c, "dDfnrsStvwW"));
|
||||
}
|
||||
|
||||
// Returns true iff the given atom (specified by escaped and pattern)
|
||||
// matches ch. The result is undefined if the atom is invalid.
|
||||
bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
|
||||
if (escaped) { // "\\p" where p is pattern_char.
|
||||
switch (pattern_char) {
|
||||
case 'd': return IsDigit(ch);
|
||||
case 'D': return !IsDigit(ch);
|
||||
case 'f': return ch == '\f';
|
||||
case 'n': return ch == '\n';
|
||||
case 'r': return ch == '\r';
|
||||
case 's': return IsWhiteSpace(ch);
|
||||
case 'S': return !IsWhiteSpace(ch);
|
||||
case 't': return ch == '\t';
|
||||
case 'v': return ch == '\v';
|
||||
case 'w': return IsWordChar(ch);
|
||||
case 'W': return !IsWordChar(ch);
|
||||
}
|
||||
return IsPunct(pattern_char) && pattern_char == ch;
|
||||
}
|
||||
|
||||
return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
|
||||
}
|
||||
|
||||
// Helper function used by ValidateRegex() to format error messages.
|
||||
String FormatRegexSyntaxError(const char* regex, int index) {
|
||||
return (Message() << "Syntax error at index " << index
|
||||
<< " in simple regular expression \"" << regex << "\": ").GetString();
|
||||
}
|
||||
|
||||
// Generates non-fatal failures and returns false if regex is invalid;
|
||||
// otherwise returns true.
|
||||
bool ValidateRegex(const char* regex) {
|
||||
if (regex == NULL) {
|
||||
// TODO(wan@google.com): fix the source file location in the
|
||||
// assertion failures to match where the regex is used in user
|
||||
// code.
|
||||
ADD_FAILURE() << "NULL is not a valid simple regular expression.";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_valid = true;
|
||||
|
||||
// True iff ?, *, or + can follow the previous atom.
|
||||
bool prev_repeatable = false;
|
||||
for (int i = 0; regex[i]; i++) {
|
||||
if (regex[i] == '\\') { // An escape sequence
|
||||
i++;
|
||||
if (regex[i] == '\0') {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
|
||||
<< "'\\' cannot appear at the end.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsValidEscape(regex[i])) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
|
||||
<< "invalid escape sequence \"\\" << regex[i] << "\".";
|
||||
is_valid = false;
|
||||
}
|
||||
prev_repeatable = true;
|
||||
} else { // Not an escape sequence.
|
||||
const char ch = regex[i];
|
||||
|
||||
if (ch == '^' && i > 0) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'^' can only appear at the beginning.";
|
||||
is_valid = false;
|
||||
} else if (ch == '$' && regex[i + 1] != '\0') {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'$' can only appear at the end.";
|
||||
is_valid = false;
|
||||
} else if (IsInSet(ch, "()[]{}|")) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'" << ch << "' is unsupported.";
|
||||
is_valid = false;
|
||||
} else if (IsRepeat(ch) && !prev_repeatable) {
|
||||
ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
|
||||
<< "'" << ch << "' can only follow a repeatable token.";
|
||||
is_valid = false;
|
||||
}
|
||||
|
||||
prev_repeatable = !IsInSet(ch, "^$?*+");
|
||||
}
|
||||
}
|
||||
|
||||
return is_valid;
|
||||
}
|
||||
|
||||
// Matches a repeated regex atom followed by a valid simple regular
|
||||
// expression. The regex atom is defined as c if escaped is false,
|
||||
// or \c otherwise. repeat is the repetition meta character (?, *,
|
||||
// or +). The behavior is undefined if str contains too many
|
||||
// characters to be indexable by size_t, in which case the test will
|
||||
// probably time out anyway. We are fine with this limitation as
|
||||
// std::string has it too.
|
||||
bool MatchRepetitionAndRegexAtHead(
|
||||
bool escaped, char c, char repeat, const char* regex,
|
||||
const char* str) {
|
||||
const size_t min_count = (repeat == '+') ? 1 : 0;
|
||||
const size_t max_count = (repeat == '?') ? 1 :
|
||||
static_cast<size_t>(-1) - 1;
|
||||
// We cannot call numeric_limits::max() as it conflicts with the
|
||||
// max() macro on Windows.
|
||||
|
||||
for (size_t i = 0; i <= max_count; ++i) {
|
||||
// We know that the atom matches each of the first i characters in str.
|
||||
if (i >= min_count && MatchRegexAtHead(regex, str + i)) {
|
||||
// We have enough matches at the head, and the tail matches too.
|
||||
// Since we only care about *whether* the pattern matches str
|
||||
// (as opposed to *how* it matches), there is no need to find a
|
||||
// greedy match.
|
||||
return true;
|
||||
}
|
||||
if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i]))
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns true iff regex matches a prefix of str. regex must be a
|
||||
// valid simple regular expression and not start with "^", or the
|
||||
// result is undefined.
|
||||
bool MatchRegexAtHead(const char* regex, const char* str) {
|
||||
if (*regex == '\0') // An empty regex matches a prefix of anything.
|
||||
return true;
|
||||
|
||||
// "$" only matches the end of a string. Note that regex being
|
||||
// valid guarantees that there's nothing after "$" in it.
|
||||
if (*regex == '$')
|
||||
return *str == '\0';
|
||||
|
||||
// Is the first thing in regex an escape sequence?
|
||||
const bool escaped = *regex == '\\';
|
||||
if (escaped)
|
||||
++regex;
|
||||
if (IsRepeat(regex[1])) {
|
||||
// MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so
|
||||
// here's an indirect recursion. It terminates as the regex gets
|
||||
// shorter in each recursion.
|
||||
return MatchRepetitionAndRegexAtHead(
|
||||
escaped, regex[0], regex[1], regex + 2, str);
|
||||
} else {
|
||||
// regex isn't empty, isn't "$", and doesn't start with a
|
||||
// repetition. We match the first atom of regex with the first
|
||||
// character of str and recurse.
|
||||
return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) &&
|
||||
MatchRegexAtHead(regex + 1, str + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns true iff regex matches any substring of str. regex must be
|
||||
// a valid simple regular expression, or the result is undefined.
|
||||
//
|
||||
// The algorithm is recursive, but the recursion depth doesn't exceed
|
||||
// the regex length, so we won't need to worry about running out of
|
||||
// stack space normally. In rare cases the time complexity can be
|
||||
// exponential with respect to the regex length + the string length,
|
||||
// but usually it's must faster (often close to linear).
|
||||
bool MatchRegexAnywhere(const char* regex, const char* str) {
|
||||
if (regex == NULL || str == NULL)
|
||||
return false;
|
||||
|
||||
if (*regex == '^')
|
||||
return MatchRegexAtHead(regex + 1, str);
|
||||
|
||||
// A successful match can be anywhere in str.
|
||||
do {
|
||||
if (MatchRegexAtHead(regex, str))
|
||||
return true;
|
||||
} while (*str++ != '\0');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Implements the RE class.
|
||||
|
||||
RE::~RE() {
|
||||
free(const_cast<char*>(pattern_));
|
||||
free(const_cast<char*>(full_pattern_));
|
||||
}
|
||||
|
||||
// Returns true iff regular expression re matches the entire str.
|
||||
bool RE::FullMatch(const char* str, const RE& re) {
|
||||
return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);
|
||||
}
|
||||
|
||||
// Returns true iff regular expression re matches a substring of str
|
||||
// (including str itself).
|
||||
bool RE::PartialMatch(const char* str, const RE& re) {
|
||||
return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);
|
||||
}
|
||||
|
||||
// Initializes an RE from its string representation.
|
||||
void RE::Init(const char* regex) {
|
||||
pattern_ = full_pattern_ = NULL;
|
||||
if (regex != NULL) {
|
||||
#if GTEST_OS_WINDOWS
|
||||
pattern_ = _strdup(regex);
|
||||
#else
|
||||
pattern_ = strdup(regex);
|
||||
#endif
|
||||
}
|
||||
|
||||
is_valid_ = ValidateRegex(regex);
|
||||
if (!is_valid_) {
|
||||
// No need to calculate the full pattern when the regex is invalid.
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t len = strlen(regex);
|
||||
// Reserves enough bytes to hold the regular expression used for a
|
||||
// full match: we need space to prepend a '^', append a '$', and
|
||||
// terminate the string with '\0'.
|
||||
char* buffer = static_cast<char*>(malloc(len + 3));
|
||||
full_pattern_ = buffer;
|
||||
|
||||
if (*regex != '^')
|
||||
*buffer++ = '^'; // Makes sure full_pattern_ starts with '^'.
|
||||
|
||||
// We don't use snprintf or strncpy, as they trigger a warning when
|
||||
// compiled with VC++ 8.0.
|
||||
memcpy(buffer, regex, len);
|
||||
buffer += len;
|
||||
|
||||
if (len == 0 || regex[len - 1] != '$')
|
||||
*buffer++ = '$'; // Makes sure full_pattern_ ends with '$'.
|
||||
|
||||
*buffer = '\0';
|
||||
}
|
||||
|
||||
#endif // GTEST_USES_POSIX_RE
|
||||
|
||||
// Logs a message at the given severity level.
|
||||
void GTestLog(GTestLogSeverity severity, const char* file,
|
||||
@@ -112,11 +395,19 @@ void GTestLog(GTestLogSeverity severity, const char* file,
|
||||
severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]";
|
||||
fprintf(stderr, "\n%s %s:%d: %s\n", marker, file, line, msg);
|
||||
if (severity == GTEST_FATAL) {
|
||||
fflush(NULL); // abort() is not guaranteed to flush open file streams.
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_STD_STRING
|
||||
|
||||
// Disable Microsoft deprecation warnings for POSIX functions called from
|
||||
// this class (creat, dup, dup2, and close)
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif // _MSC_VER
|
||||
|
||||
// Defines the stderr capturer.
|
||||
|
||||
@@ -124,16 +415,26 @@ class CapturedStderr {
|
||||
public:
|
||||
// The ctor redirects stderr to a temporary file.
|
||||
CapturedStderr() {
|
||||
uncaptured_fd_ = dup(STDERR_FILENO);
|
||||
uncaptured_fd_ = dup(kStdErrFileno);
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
||||
char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
||||
|
||||
::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
|
||||
::GetTempFileNameA(temp_dir_path, "gtest_redir", 0, temp_file_path);
|
||||
const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
|
||||
filename_ = temp_file_path;
|
||||
#else
|
||||
// There's no guarantee that a test has write access to the
|
||||
// current directory, so we create the temporary file in the /tmp
|
||||
// directory instead.
|
||||
char name_template[] = "/tmp/captured_stderr.XXXXXX";
|
||||
const int captured_fd = mkstemp(name_template);
|
||||
filename_ = name_template;
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
fflush(NULL);
|
||||
dup2(captured_fd, STDERR_FILENO);
|
||||
dup2(captured_fd, kStdErrFileno);
|
||||
close(captured_fd);
|
||||
}
|
||||
|
||||
@@ -145,7 +446,7 @@ class CapturedStderr {
|
||||
void StopCapture() {
|
||||
// Restores the original stream.
|
||||
fflush(NULL);
|
||||
dup2(uncaptured_fd_, STDERR_FILENO);
|
||||
dup2(uncaptured_fd_, kStdErrFileno);
|
||||
close(uncaptured_fd_);
|
||||
uncaptured_fd_ = -1;
|
||||
}
|
||||
@@ -160,6 +461,10 @@ class CapturedStderr {
|
||||
::std::string filename_;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
static CapturedStderr* g_captured_stderr = NULL;
|
||||
|
||||
// Returns the size (in bytes) of a file.
|
||||
@@ -169,8 +474,6 @@ static size_t GetFileSize(FILE * file) {
|
||||
}
|
||||
|
||||
// Reads the entire content of a file as a string.
|
||||
// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can
|
||||
// use it here.
|
||||
static ::std::string ReadEntireFile(FILE * file) {
|
||||
const size_t file_size = GetFileSize(file);
|
||||
char* const buffer = new char[file_size];
|
||||
@@ -206,9 +509,18 @@ void CaptureStderr() {
|
||||
// use it here.
|
||||
::std::string GetCapturedStderr() {
|
||||
g_captured_stderr->StopCapture();
|
||||
|
||||
// Disables Microsoft deprecation warning for fopen and fclose.
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif // _MSC_VER
|
||||
FILE* const file = fopen(g_captured_stderr->filename().c_str(), "r");
|
||||
const ::std::string content = ReadEntireFile(file);
|
||||
fclose(file);
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
delete g_captured_stderr;
|
||||
g_captured_stderr = NULL;
|
||||
@@ -216,6 +528,10 @@ void CaptureStderr() {
|
||||
return content;
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_STD_STRING
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// A copy of all command line arguments. Set by InitGoogleTest().
|
||||
::std::vector<String> g_argvs;
|
||||
|
||||
@@ -235,7 +551,8 @@ void abort() {
|
||||
// given flag. For example, FlagToEnvVar("foo") will return
|
||||
// "GTEST_FOO" in the open-source version.
|
||||
static String FlagToEnvVar(const char* flag) {
|
||||
const String full_flag = (Message() << GTEST_FLAG_PREFIX << flag).GetString();
|
||||
const String full_flag =
|
||||
(Message() << GTEST_FLAG_PREFIX_ << flag).GetString();
|
||||
|
||||
Message env_var;
|
||||
for (int i = 0; i != full_flag.GetLength(); i++) {
|
||||
@@ -245,17 +562,6 @@ static String FlagToEnvVar(const char* flag) {
|
||||
return env_var.GetString();
|
||||
}
|
||||
|
||||
// Reads and returns the Boolean environment variable corresponding to
|
||||
// the given flag; if it's not set, returns default_value.
|
||||
//
|
||||
// The value is considered true iff it's not "0".
|
||||
bool BoolFromGTestEnv(const char* flag, bool default_value) {
|
||||
const String env_var = FlagToEnvVar(flag);
|
||||
const char* const string_value = GetEnv(env_var.c_str());
|
||||
return string_value == NULL ?
|
||||
default_value : strcmp(string_value, "0") != 0;
|
||||
}
|
||||
|
||||
// Parses 'str' for a 32-bit signed integer. If successful, writes
|
||||
// the result to *value and returns true; otherwise leaves *value
|
||||
// unchanged and returns false.
|
||||
@@ -297,6 +603,17 @@ bool ParseInt32(const Message& src_text, const char* str, Int32* value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reads and returns the Boolean environment variable corresponding to
|
||||
// the given flag; if it's not set, returns default_value.
|
||||
//
|
||||
// The value is considered true iff it's not "0".
|
||||
bool BoolFromGTestEnv(const char* flag, bool default_value) {
|
||||
const String env_var = FlagToEnvVar(flag);
|
||||
const char* const string_value = GetEnv(env_var.c_str());
|
||||
return string_value == NULL ?
|
||||
default_value : strcmp(string_value, "0") != 0;
|
||||
}
|
||||
|
||||
// Reads and returns a 32-bit integer stored in the environment
|
||||
// variable corresponding to the given flag; if it isn't set or
|
||||
// doesn't represent a valid 32-bit integer, returns default_value.
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
namespace testing {
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
// Verifies that registered_tests match the test names in
|
||||
// defined_test_names_; returns registered_tests if successful, or
|
||||
@@ -85,6 +85,7 @@ const char* TypedTestCasePState::VerifyRegisteredTestNames(
|
||||
if (errors_str != "") {
|
||||
fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
|
||||
errors_str.c_str());
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
593
src/gtest.cc
593
src/gtest.cc
File diff suppressed because it is too large
Load Diff
@@ -33,11 +33,22 @@
|
||||
|
||||
#include <gtest/gtest-death-test.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <gtest/internal/gtest-filepath.h>
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
#include <stdio.h>
|
||||
#if GTEST_OS_WINDOWS
|
||||
#include <direct.h> // For chdir().
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h> // For waitpid.
|
||||
#include <limits> // For std::numeric_limits.
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gtest/gtest-spi.h>
|
||||
|
||||
// Indicates that this translation unit is part of Google Test's
|
||||
@@ -45,12 +56,18 @@
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
using testing::Message;
|
||||
|
||||
using testing::internal::DeathTest;
|
||||
using testing::internal::DeathTestFactory;
|
||||
using testing::internal::FilePath;
|
||||
using testing::internal::GetLastSystemErrorMessage;
|
||||
using testing::internal::ParseNaturalNumber;
|
||||
using testing::internal::String;
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
@@ -85,9 +102,20 @@ class ReplaceDeathTestFactory {
|
||||
|
||||
class TestForDeathTest : public testing::Test {
|
||||
protected:
|
||||
TestForDeathTest() : original_dir_(FilePath::GetCurrentDir()) {}
|
||||
|
||||
virtual ~TestForDeathTest() {
|
||||
#if GTEST_OS_WINDOWS
|
||||
_chdir(original_dir_.c_str());
|
||||
#else
|
||||
chdir(original_dir_.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
// A static member function that's expected to die.
|
||||
static void StaticMemberFunction() {
|
||||
fprintf(stderr, "%s", "death inside StaticMemberFunction().");
|
||||
fflush(stderr);
|
||||
// We call _exit() instead of exit(), as the former is a direct
|
||||
// system call and thus safer in the presence of threads. exit()
|
||||
// will invoke user-defined exit-hooks, which may do dangerous
|
||||
@@ -99,12 +127,14 @@ class TestForDeathTest : public testing::Test {
|
||||
void MemberFunction() {
|
||||
if (should_die_) {
|
||||
fprintf(stderr, "%s", "death inside MemberFunction().");
|
||||
fflush(stderr);
|
||||
_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// True iff MemberFunction() should die.
|
||||
bool should_die_;
|
||||
const FilePath original_dir_;
|
||||
};
|
||||
|
||||
// A class with a member function that may die.
|
||||
@@ -165,6 +195,21 @@ int DieInDebugElse12(int* sideeffect) {
|
||||
return 12;
|
||||
}
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
// Tests the ExitedWithCode predicate.
|
||||
TEST(ExitStatusPredicateTest, ExitedWithCode) {
|
||||
// On Windows, the process's exit code is the same as its exit status,
|
||||
// so the predicate just compares the its input with its parameter.
|
||||
EXPECT_TRUE(testing::ExitedWithCode(0)(0));
|
||||
EXPECT_TRUE(testing::ExitedWithCode(1)(1));
|
||||
EXPECT_TRUE(testing::ExitedWithCode(42)(42));
|
||||
EXPECT_FALSE(testing::ExitedWithCode(0)(1));
|
||||
EXPECT_FALSE(testing::ExitedWithCode(1)(0));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// Returns the exit status of a process that calls _exit(2) with a
|
||||
// given exit code. This is a helper function for the
|
||||
// ExitStatusPredicateTest test suite.
|
||||
@@ -222,6 +267,8 @@ TEST(ExitStatusPredicateTest, KilledBySignal) {
|
||||
EXPECT_FALSE(pred_kill(status_segv));
|
||||
}
|
||||
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
// Tests that the death test macros expand to code which may or may not
|
||||
// be followed by operator<<, and that in either case the complete text
|
||||
// comprises only a single C++ statement.
|
||||
@@ -248,21 +295,31 @@ TEST_F(TestForDeathTest, SingleStatement) {
|
||||
|
||||
void DieWithEmbeddedNul() {
|
||||
fprintf(stderr, "Hello%cworld.\n", '\0');
|
||||
fflush(stderr);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
#if GTEST_USES_PCRE
|
||||
// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
|
||||
// message has a NUL character in it.
|
||||
TEST_F(TestForDeathTest, DISABLED_EmbeddedNulInMessage) {
|
||||
TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
|
||||
// TODO(wan@google.com): <regex.h> doesn't support matching strings
|
||||
// with embedded NUL characters - find a way to workaround it.
|
||||
EXPECT_DEATH(DieWithEmbeddedNul(), "w.*ld");
|
||||
ASSERT_DEATH(DieWithEmbeddedNul(), "w.*ld");
|
||||
}
|
||||
#endif // GTEST_USES_PCRE
|
||||
|
||||
// Tests that death test macros expand to code which interacts well with switch
|
||||
// statements.
|
||||
TEST_F(TestForDeathTest, SwitchStatement) {
|
||||
// Microsoft compiler usually complains about switch statements without
|
||||
// case labels. We suppress that warning for this test.
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4065)
|
||||
#endif // _MSC_VER
|
||||
|
||||
switch (0)
|
||||
default:
|
||||
ASSERT_DEATH(_exit(1), "") << "exit in default switch handler";
|
||||
@@ -270,6 +327,10 @@ TEST_F(TestForDeathTest, SwitchStatement) {
|
||||
switch (0)
|
||||
case 0:
|
||||
EXPECT_DEATH(_exit(1), "") << "exit in switch case";
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
}
|
||||
|
||||
// Tests that a static member function can be used in a "fast" style
|
||||
@@ -287,15 +348,23 @@ TEST_F(TestForDeathTest, MemberFunctionFastStyle) {
|
||||
EXPECT_DEATH(MemberFunction(), "inside.*MemberFunction");
|
||||
}
|
||||
|
||||
void ChangeToRootDir() {
|
||||
#if GTEST_OS_WINDOWS
|
||||
_chdir("\\");
|
||||
#else
|
||||
chdir("/");
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
}
|
||||
|
||||
// Tests that death tests work even if the current directory has been
|
||||
// changed.
|
||||
TEST_F(TestForDeathTest, FastDeathTestInChangedDir) {
|
||||
testing::GTEST_FLAG(death_test_style) = "fast";
|
||||
|
||||
chdir("/");
|
||||
ChangeToRootDir();
|
||||
EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
|
||||
|
||||
chdir("/");
|
||||
ChangeToRootDir();
|
||||
ASSERT_DEATH(_exit(1), "");
|
||||
}
|
||||
|
||||
@@ -322,10 +391,10 @@ TEST_F(TestForDeathTest, ThreadsafeDeathTestInLoop) {
|
||||
TEST_F(TestForDeathTest, ThreadsafeDeathTestInChangedDir) {
|
||||
testing::GTEST_FLAG(death_test_style) = "threadsafe";
|
||||
|
||||
chdir("/");
|
||||
ChangeToRootDir();
|
||||
EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
|
||||
|
||||
chdir("/");
|
||||
ChangeToRootDir();
|
||||
ASSERT_DEATH(_exit(1), "");
|
||||
}
|
||||
|
||||
@@ -346,14 +415,20 @@ void SetPthreadFlag() {
|
||||
|
||||
} // namespace
|
||||
|
||||
#if GTEST_HAS_CLONE
|
||||
|
||||
TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
|
||||
testing::GTEST_FLAG(death_test_style) = "threadsafe";
|
||||
pthread_flag = false;
|
||||
ASSERT_EQ(0, pthread_atfork(&SetPthreadFlag, NULL, NULL));
|
||||
ASSERT_DEATH(_exit(1), "");
|
||||
ASSERT_FALSE(pthread_flag);
|
||||
if (!testing::GTEST_FLAG(death_test_use_fork)) {
|
||||
testing::GTEST_FLAG(death_test_style) = "threadsafe";
|
||||
pthread_flag = false;
|
||||
ASSERT_EQ(0, pthread_atfork(&SetPthreadFlag, NULL, NULL));
|
||||
ASSERT_DEATH(_exit(1), "");
|
||||
ASSERT_FALSE(pthread_flag);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_CLONE
|
||||
|
||||
// Tests that a method of another class can be used in a death test.
|
||||
TEST_F(TestForDeathTest, MethodOfAnotherClass) {
|
||||
const MayDie x(true);
|
||||
@@ -535,6 +610,30 @@ void ExpectDebugDeathHelper(bool* aborted) {
|
||||
*aborted = false;
|
||||
}
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
|
||||
printf("This test should be considered failing if it shows "
|
||||
"any pop-up dialogs.\n");
|
||||
fflush(stdout);
|
||||
|
||||
EXPECT_DEATH({
|
||||
testing::GTEST_FLAG(catch_exceptions) = false;
|
||||
abort();
|
||||
}, "");
|
||||
}
|
||||
|
||||
TEST(PopUpDeathTest, DoesNotShowPopUpOnThrow) {
|
||||
printf("This test should be considered failing if it shows "
|
||||
"any pop-up dialogs.\n");
|
||||
fflush(stdout);
|
||||
|
||||
EXPECT_DEATH({
|
||||
testing::GTEST_FLAG(catch_exceptions) = false;
|
||||
throw 1;
|
||||
}, "");
|
||||
}
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
// Tests that EXPECT_DEBUG_DEATH in debug mode does not abort
|
||||
// the function.
|
||||
TEST_F(TestForDeathTest, ExpectDebugDeathDoesNotAbort) {
|
||||
@@ -561,21 +660,50 @@ TEST_F(TestForDeathTest, AssertDebugDeathAborts) {
|
||||
#endif // _NDEBUG
|
||||
|
||||
// Tests the *_EXIT family of macros, using a variety of predicates.
|
||||
TEST_F(TestForDeathTest, ExitMacros) {
|
||||
static void TestExitMacros() {
|
||||
EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
|
||||
ASSERT_EXIT(_exit(42), testing::ExitedWithCode(42), "");
|
||||
EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo";
|
||||
ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), "") << "bar";
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
EXPECT_EXIT({
|
||||
testing::GTEST_FLAG(catch_exceptions) = false;
|
||||
*static_cast<int*>(NULL) = 1;
|
||||
}, testing::ExitedWithCode(0xC0000005), "") << "foo";
|
||||
|
||||
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
||||
EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), "")
|
||||
<< "This failure is expected.";
|
||||
EXPECT_EXIT({
|
||||
testing::GTEST_FLAG(catch_exceptions) = false;
|
||||
*static_cast<int*>(NULL) = 1;
|
||||
}, testing::ExitedWithCode(0), "") << "This failure is expected.";
|
||||
}, "This failure is expected.");
|
||||
|
||||
// Of all signals effects on the process exit code, only those of SIGABRT
|
||||
// are documented on Windows.
|
||||
// See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx.
|
||||
EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "");
|
||||
#else
|
||||
EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo";
|
||||
ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), "") << "bar";
|
||||
|
||||
EXPECT_FATAL_FAILURE({ // NOLINT
|
||||
ASSERT_EXIT(_exit(0), testing::KilledBySignal(SIGSEGV), "")
|
||||
<< "This failure is expected, too.";
|
||||
}, "This failure is expected, too.");
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
||||
EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), "")
|
||||
<< "This failure is expected.";
|
||||
}, "This failure is expected.");
|
||||
}
|
||||
|
||||
TEST_F(TestForDeathTest, ExitMacros) {
|
||||
TestExitMacros();
|
||||
}
|
||||
|
||||
TEST_F(TestForDeathTest, ExitMacrosUsingFork) {
|
||||
testing::GTEST_FLAG(death_test_use_fork) = true;
|
||||
TestExitMacros();
|
||||
}
|
||||
|
||||
TEST_F(TestForDeathTest, InvalidStyle) {
|
||||
@@ -862,6 +990,156 @@ TEST(StreamingAssertionsDeathTest, DeathTest) {
|
||||
}, "expected failure");
|
||||
}
|
||||
|
||||
// Tests that GetLastSystemErrorMessage returns an empty string when the
|
||||
// last error is 0 and non-empty string when it is non-zero.
|
||||
TEST(GetLastSystemErrorMessageTest, GetLastSystemErrorMessageWorks) {
|
||||
#if GTEST_OS_WINDOWS
|
||||
::SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
EXPECT_STRNE("", GetLastSystemErrorMessage().c_str());
|
||||
::SetLastError(0);
|
||||
EXPECT_STREQ("", GetLastSystemErrorMessage().c_str());
|
||||
#else
|
||||
errno = ENOENT;
|
||||
EXPECT_STRNE("", GetLastSystemErrorMessage().c_str());
|
||||
errno = 0;
|
||||
EXPECT_STREQ("", GetLastSystemErrorMessage().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
TEST(AutoHandleTest, AutoHandleWorks) {
|
||||
HANDLE handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
ASSERT_NE(INVALID_HANDLE_VALUE, handle);
|
||||
|
||||
// Tests that the AutoHandle is correctly initialized with a handle.
|
||||
testing::internal::AutoHandle auto_handle(handle);
|
||||
EXPECT_EQ(handle, auto_handle.Get());
|
||||
|
||||
// Tests that Reset assigns INVALID_HANDLE_VALUE.
|
||||
// Note that this cannot verify whether the original handle is closed.
|
||||
auto_handle.Reset();
|
||||
EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle.Get());
|
||||
|
||||
// Tests that Reset assigns the new handle.
|
||||
// Note that this cannot verify whether the original handle is closed.
|
||||
handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
ASSERT_NE(INVALID_HANDLE_VALUE, handle);
|
||||
auto_handle.Reset(handle);
|
||||
EXPECT_EQ(handle, auto_handle.Get());
|
||||
|
||||
// Tests that AutoHandle contains INVALID_HANDLE_VALUE by default.
|
||||
testing::internal::AutoHandle auto_handle2;
|
||||
EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle2.Get());
|
||||
}
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef unsigned __int64 BiggestParsable;
|
||||
typedef signed __int64 BiggestSignedParsable;
|
||||
const BiggestParsable kBiggestParsableMax = ULLONG_MAX;
|
||||
const BiggestParsable kBiggestSignedParsableMax = LLONG_MAX;
|
||||
#else
|
||||
typedef unsigned long long BiggestParsable;
|
||||
typedef signed long long BiggestSignedParsable;
|
||||
const BiggestParsable kBiggestParsableMax =
|
||||
::std::numeric_limits<BiggestParsable>::max();
|
||||
const BiggestSignedParsable kBiggestSignedParsableMax =
|
||||
::std::numeric_limits<BiggestSignedParsable>::max();
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
TEST(ParseNaturalNumberTest, RejectsInvalidFormat) {
|
||||
BiggestParsable result = 0;
|
||||
|
||||
// Rejects non-numbers.
|
||||
EXPECT_FALSE(ParseNaturalNumber(String("non-number string"), &result));
|
||||
|
||||
// Rejects numbers with whitespace prefix.
|
||||
EXPECT_FALSE(ParseNaturalNumber(String(" 123"), &result));
|
||||
|
||||
// Rejects negative numbers.
|
||||
EXPECT_FALSE(ParseNaturalNumber(String("-123"), &result));
|
||||
|
||||
// Rejects numbers starting with a plus sign.
|
||||
EXPECT_FALSE(ParseNaturalNumber(String("+123"), &result));
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
TEST(ParseNaturalNumberTest, RejectsOverflownNumbers) {
|
||||
BiggestParsable result = 0;
|
||||
|
||||
EXPECT_FALSE(ParseNaturalNumber(String("99999999999999999999999"), &result));
|
||||
|
||||
signed char char_result = 0;
|
||||
EXPECT_FALSE(ParseNaturalNumber(String("200"), &char_result));
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
TEST(ParseNaturalNumberTest, AcceptsValidNumbers) {
|
||||
BiggestParsable result = 0;
|
||||
|
||||
result = 0;
|
||||
ASSERT_TRUE(ParseNaturalNumber(String("123"), &result));
|
||||
EXPECT_EQ(123, result);
|
||||
|
||||
// Check 0 as an edge case.
|
||||
result = 1;
|
||||
ASSERT_TRUE(ParseNaturalNumber(String("0"), &result));
|
||||
EXPECT_EQ(0, result);
|
||||
|
||||
result = 1;
|
||||
ASSERT_TRUE(ParseNaturalNumber(String("00000"), &result));
|
||||
EXPECT_EQ(0, result);
|
||||
}
|
||||
|
||||
TEST(ParseNaturalNumberTest, AcceptsTypeLimits) {
|
||||
Message msg;
|
||||
msg << kBiggestParsableMax;
|
||||
|
||||
BiggestParsable result = 0;
|
||||
EXPECT_TRUE(ParseNaturalNumber(msg.GetString(), &result));
|
||||
EXPECT_EQ(kBiggestParsableMax, result);
|
||||
|
||||
Message msg2;
|
||||
msg2 << kBiggestSignedParsableMax;
|
||||
|
||||
BiggestSignedParsable signed_result = 0;
|
||||
EXPECT_TRUE(ParseNaturalNumber(msg2.GetString(), &signed_result));
|
||||
EXPECT_EQ(kBiggestSignedParsableMax, signed_result);
|
||||
|
||||
Message msg3;
|
||||
msg3 << INT_MAX;
|
||||
|
||||
int int_result = 0;
|
||||
EXPECT_TRUE(ParseNaturalNumber(msg3.GetString(), &int_result));
|
||||
EXPECT_EQ(INT_MAX, int_result);
|
||||
|
||||
Message msg4;
|
||||
msg4 << UINT_MAX;
|
||||
|
||||
unsigned int uint_result = 0;
|
||||
EXPECT_TRUE(ParseNaturalNumber(msg4.GetString(), &uint_result));
|
||||
EXPECT_EQ(UINT_MAX, uint_result);
|
||||
}
|
||||
|
||||
TEST(ParseNaturalNumberTest, WorksForShorterIntegers) {
|
||||
short short_result = 0;
|
||||
ASSERT_TRUE(ParseNaturalNumber(String("123"), &short_result));
|
||||
EXPECT_EQ(123, short_result);
|
||||
|
||||
signed char char_result = 0;
|
||||
ASSERT_TRUE(ParseNaturalNumber(String("123"), &char_result));
|
||||
EXPECT_EQ(123, char_result);
|
||||
}
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
TEST(EnvironmentTest, HandleFitsIntoSizeT) {
|
||||
// TODO(vladl@google.com): Remove this test after this condition is verified
|
||||
// in a static assertion in gtest-death-test.cc in the function
|
||||
// GetStatusFileDescriptor.
|
||||
ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t));
|
||||
}
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Tests that a test case whose name ends with "DeathTest" works fine
|
||||
|
||||
@@ -46,20 +46,15 @@
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#ifdef _WIN32_WCE
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#include <windows.h> // NOLINT
|
||||
#elif GTEST_OS_WINDOWS
|
||||
#include <direct.h> // NOLINT
|
||||
#endif // _WIN32_WCE
|
||||
#define PATH_SEP "\\"
|
||||
#else
|
||||
#define PATH_SEP "/"
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
@@ -88,18 +83,21 @@ int _rmdir(const char* path) {
|
||||
#ifndef _WIN32_WCE
|
||||
|
||||
TEST(GetCurrentDirTest, ReturnsCurrentDir) {
|
||||
EXPECT_FALSE(FilePath::GetCurrentDir().IsEmpty());
|
||||
const FilePath original_dir = FilePath::GetCurrentDir();
|
||||
EXPECT_FALSE(original_dir.IsEmpty());
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
_chdir(PATH_SEP);
|
||||
#if GTEST_OS_WINDOWS
|
||||
_chdir(GTEST_PATH_SEP_);
|
||||
const FilePath cwd = FilePath::GetCurrentDir();
|
||||
_chdir(original_dir.c_str());
|
||||
// Skips the ":".
|
||||
const char* const cwd_without_drive = strchr(cwd.c_str(), ':');
|
||||
ASSERT_TRUE(cwd_without_drive != NULL);
|
||||
EXPECT_STREQ(PATH_SEP, cwd_without_drive + 1);
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_, cwd_without_drive + 1);
|
||||
#else
|
||||
chdir(PATH_SEP);
|
||||
EXPECT_STREQ(PATH_SEP, FilePath::GetCurrentDir().c_str());
|
||||
chdir(GTEST_PATH_SEP_);
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_, FilePath::GetCurrentDir().c_str());
|
||||
chdir(original_dir.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -131,25 +129,25 @@ TEST(RemoveDirectoryNameTest, ButNoDirectory) {
|
||||
// RemoveDirectoryName "/afile" -> "afile"
|
||||
TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileName) {
|
||||
EXPECT_STREQ("afile",
|
||||
FilePath(PATH_SEP "afile").RemoveDirectoryName().c_str());
|
||||
FilePath(GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
|
||||
}
|
||||
|
||||
// RemoveDirectoryName "adir/" -> ""
|
||||
TEST(RemoveDirectoryNameTest, WhereThereIsNoFileName) {
|
||||
EXPECT_STREQ("",
|
||||
FilePath("adir" PATH_SEP).RemoveDirectoryName().c_str());
|
||||
FilePath("adir" GTEST_PATH_SEP_).RemoveDirectoryName().c_str());
|
||||
}
|
||||
|
||||
// RemoveDirectoryName "adir/afile" -> "afile"
|
||||
TEST(RemoveDirectoryNameTest, ShouldGiveFileName) {
|
||||
EXPECT_STREQ("afile",
|
||||
FilePath("adir" PATH_SEP "afile").RemoveDirectoryName().c_str());
|
||||
FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
|
||||
}
|
||||
|
||||
// RemoveDirectoryName "adir/subdir/afile" -> "afile"
|
||||
TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
|
||||
EXPECT_STREQ("afile",
|
||||
FilePath("adir" PATH_SEP "subdir" PATH_SEP "afile")
|
||||
FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
|
||||
.RemoveDirectoryName().c_str());
|
||||
}
|
||||
|
||||
@@ -158,65 +156,127 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
|
||||
TEST(RemoveFileNameTest, EmptyName) {
|
||||
#ifdef _WIN32_WCE
|
||||
// On Windows CE, we use the root as the current directory.
|
||||
EXPECT_STREQ(PATH_SEP,
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_,
|
||||
FilePath("").RemoveFileName().c_str());
|
||||
#else
|
||||
EXPECT_STREQ("." PATH_SEP,
|
||||
EXPECT_STREQ("." GTEST_PATH_SEP_,
|
||||
FilePath("").RemoveFileName().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
// RemoveFileName "adir/" -> "adir/"
|
||||
TEST(RemoveFileNameTest, ButNoFile) {
|
||||
EXPECT_STREQ("adir" PATH_SEP,
|
||||
FilePath("adir" PATH_SEP).RemoveFileName().c_str());
|
||||
EXPECT_STREQ("adir" GTEST_PATH_SEP_,
|
||||
FilePath("adir" GTEST_PATH_SEP_).RemoveFileName().c_str());
|
||||
}
|
||||
|
||||
// RemoveFileName "adir/afile" -> "adir/"
|
||||
TEST(RemoveFileNameTest, GivesDirName) {
|
||||
EXPECT_STREQ("adir" PATH_SEP,
|
||||
FilePath("adir" PATH_SEP "afile")
|
||||
EXPECT_STREQ("adir" GTEST_PATH_SEP_,
|
||||
FilePath("adir" GTEST_PATH_SEP_ "afile")
|
||||
.RemoveFileName().c_str());
|
||||
}
|
||||
|
||||
// RemoveFileName "adir/subdir/afile" -> "adir/subdir/"
|
||||
TEST(RemoveFileNameTest, GivesDirAndSubDirName) {
|
||||
EXPECT_STREQ("adir" PATH_SEP "subdir" PATH_SEP,
|
||||
FilePath("adir" PATH_SEP "subdir" PATH_SEP "afile")
|
||||
EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
|
||||
FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
|
||||
.RemoveFileName().c_str());
|
||||
}
|
||||
|
||||
// RemoveFileName "/afile" -> "/"
|
||||
TEST(RemoveFileNameTest, GivesRootDir) {
|
||||
EXPECT_STREQ(PATH_SEP,
|
||||
FilePath(PATH_SEP "afile").RemoveFileName().c_str());
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_,
|
||||
FilePath(GTEST_PATH_SEP_ "afile").RemoveFileName().c_str());
|
||||
}
|
||||
|
||||
|
||||
TEST(MakeFileNameTest, GenerateWhenNumberIsZero) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
|
||||
0, "xml");
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(MakeFileNameTest, GenerateFileNameNumberGtZero) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
|
||||
12, "xml");
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar_12.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberIsZero) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo" PATH_SEP),
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
|
||||
FilePath("bar"), 0, "xml");
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberGtZero) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo" PATH_SEP),
|
||||
FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
|
||||
FilePath("bar"), 12, "xml");
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar_12.xml", actual.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(MakeFileNameTest, GenerateWhenNumberIsZeroAndDirIsEmpty) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"),
|
||||
0, "xml");
|
||||
EXPECT_STREQ("bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(MakeFileNameTest, GenerateWhenNumberIsNotZeroAndDirIsEmpty) {
|
||||
FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"),
|
||||
14, "xml");
|
||||
EXPECT_STREQ("bar_14.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, WorksWhenDirDoesNotEndWithPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
|
||||
FilePath("bar.xml"));
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, WorksWhenPath1EndsWithPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_),
|
||||
FilePath("bar.xml"));
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, Path1BeingEmpty) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath(""),
|
||||
FilePath("bar.xml"));
|
||||
EXPECT_STREQ("bar.xml", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, Path2BeingEmpty) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
|
||||
FilePath(""));
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_, actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, BothPathBeingEmpty) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath(""),
|
||||
FilePath(""));
|
||||
EXPECT_STREQ("", actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, Path1ContainsPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_ "bar"),
|
||||
FilePath("foobar.xml"));
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "foobar.xml",
|
||||
actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, Path2ContainsPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(
|
||||
FilePath("foo" GTEST_PATH_SEP_),
|
||||
FilePath("bar" GTEST_PATH_SEP_ "bar.xml"));
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "bar.xml",
|
||||
actual.c_str());
|
||||
}
|
||||
|
||||
TEST(ConcatPathsTest, Path2EndsWithPathSep) {
|
||||
FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
|
||||
FilePath("bar" GTEST_PATH_SEP_));
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_, actual.c_str());
|
||||
}
|
||||
|
||||
// RemoveTrailingPathSeparator "" -> ""
|
||||
TEST(RemoveTrailingPathSeparatorTest, EmptyString) {
|
||||
@@ -232,27 +292,29 @@ TEST(RemoveTrailingPathSeparatorTest, FileNoSlashString) {
|
||||
|
||||
// RemoveTrailingPathSeparator "foo/" -> "foo"
|
||||
TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveTrailingSeparator) {
|
||||
EXPECT_STREQ("foo",
|
||||
FilePath("foo" PATH_SEP).RemoveTrailingPathSeparator().c_str());
|
||||
EXPECT_STREQ(
|
||||
"foo",
|
||||
FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().c_str());
|
||||
}
|
||||
|
||||
// RemoveTrailingPathSeparator "foo/bar/" -> "foo/bar/"
|
||||
TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveLastSeparator) {
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP "bar" PATH_SEP).RemoveTrailingPathSeparator()
|
||||
.c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_)
|
||||
.RemoveTrailingPathSeparator().c_str());
|
||||
}
|
||||
|
||||
// RemoveTrailingPathSeparator "foo/bar" -> "foo/bar"
|
||||
TEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) {
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP "bar").RemoveTrailingPathSeparator().c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ "bar")
|
||||
.RemoveTrailingPathSeparator().c_str());
|
||||
}
|
||||
|
||||
TEST(DirectoryTest, RootDirectoryExists) {
|
||||
#ifdef GTEST_OS_WINDOWS // We are on Windows.
|
||||
char current_drive[_MAX_PATH];
|
||||
current_drive[0] = _getdrive() + 'A' - 1;
|
||||
#if GTEST_OS_WINDOWS // We are on Windows.
|
||||
char current_drive[_MAX_PATH]; // NOLINT
|
||||
current_drive[0] = static_cast<char>(_getdrive() + 'A' - 1);
|
||||
current_drive[1] = ':';
|
||||
current_drive[2] = '\\';
|
||||
current_drive[3] = '\0';
|
||||
@@ -262,13 +324,13 @@ TEST(DirectoryTest, RootDirectoryExists) {
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
}
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
|
||||
const int saved_drive_ = _getdrive();
|
||||
// Find a drive that doesn't exist. Start with 'Z' to avoid common ones.
|
||||
for (char drive = 'Z'; drive >= 'A'; drive--)
|
||||
if (_chdrive(drive - 'A' + 1) == -1) {
|
||||
char non_drive[_MAX_PATH];
|
||||
char non_drive[_MAX_PATH]; // NOLINT
|
||||
non_drive[0] = drive;
|
||||
non_drive[1] = ':';
|
||||
non_drive[2] = '\\';
|
||||
@@ -278,17 +340,17 @@ TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
|
||||
}
|
||||
_chdrive(saved_drive_);
|
||||
}
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
// Windows CE _does_ consider an empty directory to exist.
|
||||
TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
|
||||
EXPECT_FALSE(FilePath("").DirectoryExists());
|
||||
}
|
||||
#endif // ! _WIN32_WCE
|
||||
#endif // ! _WIN32_WCE
|
||||
|
||||
TEST(DirectoryTest, CurrentDirectoryExists) {
|
||||
#ifdef GTEST_OS_WINDOWS // We are on Windows.
|
||||
#if GTEST_OS_WINDOWS // We are on Windows.
|
||||
#ifndef _WIN32_CE // Windows CE doesn't have a current directory.
|
||||
EXPECT_TRUE(FilePath(".").DirectoryExists());
|
||||
EXPECT_TRUE(FilePath(".\\").DirectoryExists());
|
||||
@@ -306,32 +368,33 @@ TEST(NormalizeTest, NullStringsEqualEmptyDirectory) {
|
||||
|
||||
// "foo/bar" == foo//bar" == "foo///bar"
|
||||
TEST(NormalizeTest, MultipleConsecutiveSepaparatorsInMidstring) {
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ("foo" PATH_SEP "bar",
|
||||
FilePath("foo" PATH_SEP PATH_SEP PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ "bar").c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
|
||||
FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_
|
||||
GTEST_PATH_SEP_ "bar").c_str());
|
||||
}
|
||||
|
||||
// "/bar" == //bar" == "///bar"
|
||||
TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringStart) {
|
||||
EXPECT_STREQ(PATH_SEP "bar",
|
||||
FilePath(PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ(PATH_SEP "bar",
|
||||
FilePath(PATH_SEP PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ(PATH_SEP "bar",
|
||||
FilePath(PATH_SEP PATH_SEP PATH_SEP "bar").c_str());
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
|
||||
FilePath(GTEST_PATH_SEP_ "bar").c_str());
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
|
||||
FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
|
||||
EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
|
||||
FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
|
||||
}
|
||||
|
||||
// "foo/" == foo//" == "foo///"
|
||||
TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) {
|
||||
EXPECT_STREQ("foo" PATH_SEP,
|
||||
FilePath("foo" PATH_SEP).c_str());
|
||||
EXPECT_STREQ("foo" PATH_SEP,
|
||||
FilePath("foo" PATH_SEP PATH_SEP).c_str());
|
||||
EXPECT_STREQ("foo" PATH_SEP,
|
||||
FilePath("foo" PATH_SEP PATH_SEP PATH_SEP).c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_,
|
||||
FilePath("foo" GTEST_PATH_SEP_).c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_,
|
||||
FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
|
||||
EXPECT_STREQ("foo" GTEST_PATH_SEP_,
|
||||
FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
|
||||
}
|
||||
|
||||
TEST(AssignmentOperatorTest, DefaultAssignedToNonDefault) {
|
||||
@@ -362,7 +425,7 @@ class DirectoryCreationTest : public Test {
|
||||
virtual void SetUp() {
|
||||
testdata_path_.Set(FilePath(String::Format("%s%s%s",
|
||||
TempDir().c_str(), GetCurrentExecutableName().c_str(),
|
||||
"_directory_creation" PATH_SEP "test" PATH_SEP)));
|
||||
"_directory_creation" GTEST_PATH_SEP_ "test" GTEST_PATH_SEP_)));
|
||||
testdata_file_.Set(testdata_path_.RemoveTrailingPathSeparator());
|
||||
|
||||
unique_file0_.Set(FilePath::MakeFileName(testdata_path_, FilePath("unique"),
|
||||
@@ -373,7 +436,7 @@ class DirectoryCreationTest : public Test {
|
||||
remove(testdata_file_.c_str());
|
||||
remove(unique_file0_.c_str());
|
||||
remove(unique_file1_.c_str());
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
_rmdir(testdata_path_.c_str());
|
||||
#else
|
||||
rmdir(testdata_path_.c_str());
|
||||
@@ -384,7 +447,7 @@ class DirectoryCreationTest : public Test {
|
||||
remove(testdata_file_.c_str());
|
||||
remove(unique_file0_.c_str());
|
||||
remove(unique_file1_.c_str());
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
_rmdir(testdata_path_.c_str());
|
||||
#else
|
||||
rmdir(testdata_path_.c_str());
|
||||
@@ -395,7 +458,7 @@ class DirectoryCreationTest : public Test {
|
||||
#ifdef _WIN32_WCE
|
||||
return String("\\temp\\");
|
||||
|
||||
#elif defined(GTEST_OS_WINDOWS)
|
||||
#elif GTEST_OS_WINDOWS
|
||||
// MSVC 8 deprecates getenv(), so we want to suppress warning 4996
|
||||
// (deprecated function) there.
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
@@ -415,7 +478,7 @@ class DirectoryCreationTest : public Test {
|
||||
}
|
||||
|
||||
void CreateTextFile(const char* filename) {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// MSVC 8 deprecates fopen(), so we want to suppress warning 4996
|
||||
// (deprecated function) there.#pragma warning(push)
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
@@ -526,11 +589,24 @@ TEST(FilePathTest, RemoveExtensionWhenThereIsNoExtension) {
|
||||
|
||||
TEST(FilePathTest, IsDirectory) {
|
||||
EXPECT_FALSE(FilePath("cola").IsDirectory());
|
||||
EXPECT_TRUE(FilePath("koala" PATH_SEP).IsDirectory());
|
||||
EXPECT_TRUE(FilePath("koala" GTEST_PATH_SEP_).IsDirectory());
|
||||
}
|
||||
|
||||
TEST(FilePathTest, IsAbsolutePath) {
|
||||
EXPECT_FALSE(FilePath("is" GTEST_PATH_SEP_ "relative").IsAbsolutePath());
|
||||
EXPECT_FALSE(FilePath("").IsAbsolutePath());
|
||||
#if GTEST_OS_WINDOWS
|
||||
EXPECT_TRUE(FilePath("c:\\" GTEST_PATH_SEP_ "is_not"
|
||||
GTEST_PATH_SEP_ "relative").IsAbsolutePath());
|
||||
EXPECT_FALSE(FilePath("c:foo" GTEST_PATH_SEP_ "bar").IsAbsolutePath());
|
||||
#else
|
||||
EXPECT_TRUE(FilePath(GTEST_PATH_SEP_ "is_not" GTEST_PATH_SEP_ "relative")
|
||||
.IsAbsolutePath());
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
#undef PATH_SEP
|
||||
#undef GTEST_PATH_SEP_
|
||||
|
||||
@@ -40,20 +40,30 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#include <windows.h>
|
||||
#elif GTEST_OS_WINDOWS
|
||||
#include <direct.h>
|
||||
#endif // _WIN32_WCE
|
||||
|
||||
// Indicates that this translation unit is part of Google Test's
|
||||
// implementation. It must come before gtest-internal-inl.h is
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
namespace testing {
|
||||
|
||||
namespace internal {
|
||||
namespace {
|
||||
|
||||
// Turns the given relative path into an absolute path.
|
||||
FilePath GetAbsolutePathOf(const FilePath& relative_path) {
|
||||
return FilePath::ConcatPaths(FilePath::GetCurrentDir(), relative_path);
|
||||
}
|
||||
|
||||
// Testing UnitTestOptions::GetOutputFormat/GetOutputFile.
|
||||
|
||||
TEST(XmlOutputTest, GetOutputFormatDefault) {
|
||||
@@ -68,55 +78,198 @@ TEST(XmlOutputTest, GetOutputFormat) {
|
||||
|
||||
TEST(XmlOutputTest, GetOutputFileDefault) {
|
||||
GTEST_FLAG(output) = "";
|
||||
EXPECT_STREQ("test_detail.xml",
|
||||
UnitTestOptions::GetOutputFile().c_str());
|
||||
EXPECT_STREQ(GetAbsolutePathOf(FilePath("test_detail.xml")).c_str(),
|
||||
UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
|
||||
}
|
||||
|
||||
TEST(XmlOutputTest, GetOutputFileSingleFile) {
|
||||
GTEST_FLAG(output) = "xml:filename.abc";
|
||||
EXPECT_STREQ("filename.abc",
|
||||
UnitTestOptions::GetOutputFile().c_str());
|
||||
EXPECT_STREQ(GetAbsolutePathOf(FilePath("filename.abc")).c_str(),
|
||||
UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
|
||||
}
|
||||
|
||||
TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
GTEST_FLAG(output) = "xml:pathname\\";
|
||||
const String& output_file = UnitTestOptions::GetOutputFile();
|
||||
EXPECT_TRUE(_strcmpi(output_file.c_str(),
|
||||
"pathname\\gtest-options_test.xml") == 0 ||
|
||||
_strcmpi(output_file.c_str(),
|
||||
"pathname\\gtest-options-ex_test.xml") == 0)
|
||||
<< " output_file = " << output_file;
|
||||
#if GTEST_OS_WINDOWS
|
||||
GTEST_FLAG(output) = "xml:path\\";
|
||||
const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
|
||||
EXPECT_TRUE(
|
||||
_strcmpi(output_file.c_str(),
|
||||
GetAbsolutePathOf(
|
||||
FilePath("path\\gtest-options_test.xml")).c_str()) == 0 ||
|
||||
_strcmpi(output_file.c_str(),
|
||||
GetAbsolutePathOf(
|
||||
FilePath("path\\gtest-options-ex_test.xml")).c_str()) == 0 ||
|
||||
_strcmpi(output_file.c_str(),
|
||||
GetAbsolutePathOf(
|
||||
FilePath("path\\gtest_all_test.xml")).c_str()) == 0)
|
||||
<< " output_file = " << output_file;
|
||||
#else
|
||||
GTEST_FLAG(output) = "xml:pathname/";
|
||||
const String& output_file = UnitTestOptions::GetOutputFile();
|
||||
GTEST_FLAG(output) = "xml:path/";
|
||||
const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
|
||||
// TODO(wan@google.com): libtool causes the test binary file to be
|
||||
// named lt-gtest-options_test. Therefore the output file may be
|
||||
// named .../lt-gtest-options_test.xml. We should remove this
|
||||
// hard-coded logic when Chandler Carruth's libtool replacement is
|
||||
// ready.
|
||||
EXPECT_TRUE(output_file == "pathname/gtest-options_test.xml" ||
|
||||
output_file == "pathname/lt-gtest-options_test.xml")
|
||||
<< " output_file = " << output_file;
|
||||
EXPECT_TRUE(output_file ==
|
||||
GetAbsolutePathOf(
|
||||
FilePath("path/gtest-options_test.xml")).c_str() ||
|
||||
output_file ==
|
||||
GetAbsolutePathOf(
|
||||
FilePath("path/lt-gtest-options_test.xml")).c_str() ||
|
||||
output_file ==
|
||||
GetAbsolutePathOf(
|
||||
FilePath("path/gtest_all_test.xml")).c_str() ||
|
||||
output_file ==
|
||||
GetAbsolutePathOf(
|
||||
FilePath("path/lt-gtest_all_test.xml")).c_str())
|
||||
<< " output_file = " << output_file;
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
|
||||
const FilePath executable = GetCurrentExecutableName();
|
||||
const char* const exe_str = executable.c_str();
|
||||
#if defined(_WIN32_WCE) || defined(GTEST_OS_WINDOWS)
|
||||
#if defined(_WIN32_WCE) || GTEST_OS_WINDOWS
|
||||
ASSERT_TRUE(_strcmpi("gtest-options_test", exe_str) == 0 ||
|
||||
_strcmpi("gtest-options-ex_test", exe_str) == 0)
|
||||
_strcmpi("gtest-options-ex_test", exe_str) == 0 ||
|
||||
_strcmpi("gtest_all_test", exe_str) == 0)
|
||||
<< "GetCurrentExecutableName() returns " << exe_str;
|
||||
#else
|
||||
// TODO(wan@google.com): remove the hard-coded "lt-" prefix when
|
||||
// Chandler Carruth's libtool replacement is ready.
|
||||
EXPECT_TRUE(String(exe_str) == "gtest-options_test" ||
|
||||
String(exe_str) == "lt-gtest-options_test")
|
||||
String(exe_str) == "lt-gtest-options_test" ||
|
||||
String(exe_str) == "gtest_all_test" ||
|
||||
String(exe_str) == "lt-gtest_all_test")
|
||||
<< "GetCurrentExecutableName() returns " << exe_str;
|
||||
#endif
|
||||
}
|
||||
|
||||
class XmlOutputChangeDirTest : public Test {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
original_working_dir_ = FilePath::GetCurrentDir();
|
||||
ChDir("..");
|
||||
// This will make the test fail if run from the root directory.
|
||||
EXPECT_STRNE(original_working_dir_.c_str(),
|
||||
FilePath::GetCurrentDir().c_str());
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
ChDir(original_working_dir_.c_str());
|
||||
}
|
||||
|
||||
void ChDir(const char* dir) {
|
||||
#if GTEST_OS_WINDOWS
|
||||
_chdir(dir);
|
||||
#else
|
||||
chdir(dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
FilePath original_working_dir_;
|
||||
};
|
||||
|
||||
TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault) {
|
||||
GTEST_FLAG(output) = "";
|
||||
EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_,
|
||||
FilePath("test_detail.xml")).c_str(),
|
||||
UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
|
||||
}
|
||||
|
||||
TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefaultXML) {
|
||||
GTEST_FLAG(output) = "xml";
|
||||
EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_,
|
||||
FilePath("test_detail.xml")).c_str(),
|
||||
UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
|
||||
}
|
||||
|
||||
TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativeFile) {
|
||||
GTEST_FLAG(output) = "xml:filename.abc";
|
||||
EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_,
|
||||
FilePath("filename.abc")).c_str(),
|
||||
UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
|
||||
}
|
||||
|
||||
TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
|
||||
#if GTEST_OS_WINDOWS
|
||||
GTEST_FLAG(output) = "xml:path\\";
|
||||
const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
|
||||
EXPECT_TRUE(
|
||||
_strcmpi(output_file.c_str(),
|
||||
FilePath::ConcatPaths(
|
||||
original_working_dir_,
|
||||
FilePath("path\\gtest-options_test.xml")).c_str()) == 0 ||
|
||||
_strcmpi(output_file.c_str(),
|
||||
FilePath::ConcatPaths(
|
||||
original_working_dir_,
|
||||
FilePath("path\\gtest-options-ex_test.xml")).c_str()) == 0 ||
|
||||
_strcmpi(output_file.c_str(),
|
||||
FilePath::ConcatPaths(
|
||||
original_working_dir_,
|
||||
FilePath("path\\gtest_all_test.xml")).c_str()) == 0)
|
||||
<< " output_file = " << output_file;
|
||||
#else
|
||||
GTEST_FLAG(output) = "xml:path/";
|
||||
const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
|
||||
// TODO(wan@google.com): libtool causes the test binary file to be
|
||||
// named lt-gtest-options_test. Therefore the output file may be
|
||||
// named .../lt-gtest-options_test.xml. We should remove this
|
||||
// hard-coded logic when Chandler Carruth's libtool replacement is
|
||||
// ready.
|
||||
EXPECT_TRUE(output_file == FilePath::ConcatPaths(original_working_dir_,
|
||||
FilePath("path/gtest-options_test.xml")).c_str() ||
|
||||
output_file == FilePath::ConcatPaths(original_working_dir_,
|
||||
FilePath("path/lt-gtest-options_test.xml")).c_str() ||
|
||||
output_file == FilePath::ConcatPaths(original_working_dir_,
|
||||
FilePath("path/gtest_all_test.xml")).c_str() ||
|
||||
output_file == FilePath::ConcatPaths(original_working_dir_,
|
||||
FilePath("path/lt-gtest_all_test.xml")).c_str())
|
||||
<< " output_file = " << output_file;
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) {
|
||||
#if GTEST_OS_WINDOWS
|
||||
GTEST_FLAG(output) = "xml:c:\\tmp\\filename.abc";
|
||||
EXPECT_STREQ(FilePath("c:\\tmp\\filename.abc").c_str(),
|
||||
UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
|
||||
#else
|
||||
GTEST_FLAG(output) ="xml:/tmp/filename.abc";
|
||||
EXPECT_STREQ(FilePath("/tmp/filename.abc").c_str(),
|
||||
UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) {
|
||||
#if GTEST_OS_WINDOWS
|
||||
GTEST_FLAG(output) = "xml:c:\\tmp\\";
|
||||
const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
|
||||
EXPECT_TRUE(
|
||||
_strcmpi(output_file.c_str(),
|
||||
FilePath("c:\\tmp\\gtest-options_test.xml").c_str()) == 0 ||
|
||||
_strcmpi(output_file.c_str(),
|
||||
FilePath("c:\\tmp\\gtest-options-ex_test.xml").c_str()) == 0 ||
|
||||
_strcmpi(output_file.c_str(),
|
||||
FilePath("c:\\tmp\\gtest_all_test.xml").c_str()) == 0)
|
||||
<< " output_file = " << output_file;
|
||||
#else
|
||||
GTEST_FLAG(output) = "xml:/tmp/";
|
||||
const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
|
||||
// TODO(wan@google.com): libtool causes the test binary file to be
|
||||
// named lt-gtest-options_test. Therefore the output file may be
|
||||
// named .../lt-gtest-options_test.xml. We should remove this
|
||||
// hard-coded logic when Chandler Carruth's libtool replacement is
|
||||
// ready.
|
||||
EXPECT_TRUE(output_file == "/tmp/gtest-options_test.xml" ||
|
||||
output_file == "/tmp/lt-gtest-options_test.xml" ||
|
||||
output_file == "/tmp/gtest_all_test.xml" ||
|
||||
output_file == "/tmp/lt-gtest_all_test.xml")
|
||||
<< " output_file = " << output_file;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "test/gtest-param-test_test.h"
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
using ::testing::Values;
|
||||
using ::testing::internal::ParamGenerator;
|
||||
|
||||
@@ -35,21 +35,17 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#include <tr1/tuple>
|
||||
#endif // GTEST_HAS_COMBINE
|
||||
|
||||
// To include gtest-internal-inl.h.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h" // for UnitTestOptions
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
#include "test/gtest-param-test_test.h"
|
||||
|
||||
@@ -64,7 +60,7 @@ using ::testing::TestWithParam;
|
||||
using ::testing::Values;
|
||||
using ::testing::ValuesIn;
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
using ::testing::Combine;
|
||||
using ::std::tr1::get;
|
||||
using ::std::tr1::make_tuple;
|
||||
@@ -402,7 +398,7 @@ TEST(BoolTest, BoolWorks) {
|
||||
VerifyGenerator(gen, expected_values);
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
|
||||
template <typename T1, typename T2>
|
||||
::std::ostream& operator<<(::std::ostream& stream, const tuple<T1, T2>& value) {
|
||||
@@ -778,13 +774,13 @@ INSTANTIATE_TEST_CASE_P(ZeroToFiveSequence, NamingTest, Range(0, 5));
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
|
||||
TEST(CompileTest, CombineIsDefinedOnlyWhenGtestHasParamTestIsDefined) {
|
||||
#if defined(GTEST_HAS_COMBINE) && !defined(GTEST_HAS_PARAM_TEST)
|
||||
#if GTEST_HAS_COMBINE && !GTEST_HAS_PARAM_TEST
|
||||
FAIL() << "GTEST_HAS_COMBINE is defined while GTEST_HAS_PARAM_TEST is not\n"
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// Used in TestGenerationTest test case.
|
||||
AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
|
||||
// Used in GeneratorEvaluationTest test case.
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
// Test fixture for testing definition and instantiation of a test
|
||||
// in separate translation units.
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Author: vladl@google.com (Vlad Losev)
|
||||
// Authors: vladl@google.com (Vlad Losev), wan@google.com (Zhanyong Wan)
|
||||
//
|
||||
// This file tests the internal cross-platform support utilities.
|
||||
|
||||
@@ -35,6 +35,18 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <gtest/gtest-spi.h>
|
||||
|
||||
// Indicates that this translation unit is part of Google Test's
|
||||
// implementation. It must come before gtest-internal-inl.h is
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) {
|
||||
if (false)
|
||||
GTEST_CHECK_(false) << "This should never be executed; "
|
||||
@@ -64,17 +76,19 @@ TEST(GtestCheckSyntaxTest, WorksWithSwitch) {
|
||||
GTEST_CHECK_(true) << "Check failed in switch case";
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) {
|
||||
const bool a_false_condition = false;
|
||||
EXPECT_DEATH(GTEST_CHECK_(a_false_condition) << "Extra info",
|
||||
const char regex[] =
|
||||
#ifdef _MSC_VER
|
||||
"gtest-port_test\\.cc\\([0-9]+\\):"
|
||||
"gtest-port_test\\.cc\\(\\d+\\):"
|
||||
#else
|
||||
"gtest-port_test\\.cc:[0-9]+"
|
||||
"gtest-port_test\\.cc:[0-9]+"
|
||||
#endif // _MSC_VER
|
||||
".*a_false_condition.*Extra info.*");
|
||||
".*a_false_condition.*Extra info.*";
|
||||
|
||||
EXPECT_DEATH(GTEST_CHECK_(a_false_condition) << "Extra info", regex);
|
||||
}
|
||||
|
||||
TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
|
||||
@@ -87,9 +101,7 @@ TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
#ifdef GTEST_USES_POSIX_RE
|
||||
|
||||
using ::testing::internal::RE;
|
||||
#if GTEST_USES_POSIX_RE
|
||||
|
||||
template <typename Str>
|
||||
class RETest : public ::testing::Test {};
|
||||
@@ -109,30 +121,30 @@ TYPED_TEST_CASE(RETest, StringTypes);
|
||||
|
||||
// Tests RE's implicit constructors.
|
||||
TYPED_TEST(RETest, ImplicitConstructorWorks) {
|
||||
const RE empty = TypeParam("");
|
||||
const RE empty(TypeParam(""));
|
||||
EXPECT_STREQ("", empty.pattern());
|
||||
|
||||
const RE simple = TypeParam("hello");
|
||||
const RE simple(TypeParam("hello"));
|
||||
EXPECT_STREQ("hello", simple.pattern());
|
||||
|
||||
const RE normal = TypeParam(".*(\\w+)");
|
||||
const RE normal(TypeParam(".*(\\w+)"));
|
||||
EXPECT_STREQ(".*(\\w+)", normal.pattern());
|
||||
}
|
||||
|
||||
// Tests that RE's constructors reject invalid regular expressions.
|
||||
TYPED_TEST(RETest, RejectsInvalidRegex) {
|
||||
EXPECT_NONFATAL_FAILURE({
|
||||
const RE invalid = TypeParam("?");
|
||||
const RE invalid(TypeParam("?"));
|
||||
}, "\"?\" is not a valid POSIX Extended regular expression.");
|
||||
}
|
||||
|
||||
// Tests RE::FullMatch().
|
||||
TYPED_TEST(RETest, FullMatchWorks) {
|
||||
const RE empty = TypeParam("");
|
||||
const RE empty(TypeParam(""));
|
||||
EXPECT_TRUE(RE::FullMatch(TypeParam(""), empty));
|
||||
EXPECT_FALSE(RE::FullMatch(TypeParam("a"), empty));
|
||||
|
||||
const RE re = TypeParam("a.*z");
|
||||
const RE re(TypeParam("a.*z"));
|
||||
EXPECT_TRUE(RE::FullMatch(TypeParam("az"), re));
|
||||
EXPECT_TRUE(RE::FullMatch(TypeParam("axyz"), re));
|
||||
EXPECT_FALSE(RE::FullMatch(TypeParam("baz"), re));
|
||||
@@ -141,11 +153,11 @@ TYPED_TEST(RETest, FullMatchWorks) {
|
||||
|
||||
// Tests RE::PartialMatch().
|
||||
TYPED_TEST(RETest, PartialMatchWorks) {
|
||||
const RE empty = TypeParam("");
|
||||
const RE empty(TypeParam(""));
|
||||
EXPECT_TRUE(RE::PartialMatch(TypeParam(""), empty));
|
||||
EXPECT_TRUE(RE::PartialMatch(TypeParam("a"), empty));
|
||||
|
||||
const RE re = TypeParam("a.*z");
|
||||
const RE re(TypeParam("a.*z"));
|
||||
EXPECT_TRUE(RE::PartialMatch(TypeParam("az"), re));
|
||||
EXPECT_TRUE(RE::PartialMatch(TypeParam("axyz"), re));
|
||||
EXPECT_TRUE(RE::PartialMatch(TypeParam("baz"), re));
|
||||
@@ -153,4 +165,481 @@ TYPED_TEST(RETest, PartialMatchWorks) {
|
||||
EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re));
|
||||
}
|
||||
|
||||
#elif GTEST_USES_SIMPLE_RE
|
||||
|
||||
TEST(IsInSetTest, NulCharIsNotInAnySet) {
|
||||
EXPECT_FALSE(IsInSet('\0', ""));
|
||||
EXPECT_FALSE(IsInSet('\0', "\0"));
|
||||
EXPECT_FALSE(IsInSet('\0', "a"));
|
||||
}
|
||||
|
||||
TEST(IsInSetTest, WorksForNonNulChars) {
|
||||
EXPECT_FALSE(IsInSet('a', "Ab"));
|
||||
EXPECT_FALSE(IsInSet('c', ""));
|
||||
|
||||
EXPECT_TRUE(IsInSet('b', "bcd"));
|
||||
EXPECT_TRUE(IsInSet('b', "ab"));
|
||||
}
|
||||
|
||||
TEST(IsDigitTest, IsFalseForNonDigit) {
|
||||
EXPECT_FALSE(IsDigit('\0'));
|
||||
EXPECT_FALSE(IsDigit(' '));
|
||||
EXPECT_FALSE(IsDigit('+'));
|
||||
EXPECT_FALSE(IsDigit('-'));
|
||||
EXPECT_FALSE(IsDigit('.'));
|
||||
EXPECT_FALSE(IsDigit('a'));
|
||||
}
|
||||
|
||||
TEST(IsDigitTest, IsTrueForDigit) {
|
||||
EXPECT_TRUE(IsDigit('0'));
|
||||
EXPECT_TRUE(IsDigit('1'));
|
||||
EXPECT_TRUE(IsDigit('5'));
|
||||
EXPECT_TRUE(IsDigit('9'));
|
||||
}
|
||||
|
||||
TEST(IsPunctTest, IsFalseForNonPunct) {
|
||||
EXPECT_FALSE(IsPunct('\0'));
|
||||
EXPECT_FALSE(IsPunct(' '));
|
||||
EXPECT_FALSE(IsPunct('\n'));
|
||||
EXPECT_FALSE(IsPunct('a'));
|
||||
EXPECT_FALSE(IsPunct('0'));
|
||||
}
|
||||
|
||||
TEST(IsPunctTest, IsTrueForPunct) {
|
||||
for (const char* p = "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; *p; p++) {
|
||||
EXPECT_PRED1(IsPunct, *p);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(IsRepeatTest, IsFalseForNonRepeatChar) {
|
||||
EXPECT_FALSE(IsRepeat('\0'));
|
||||
EXPECT_FALSE(IsRepeat(' '));
|
||||
EXPECT_FALSE(IsRepeat('a'));
|
||||
EXPECT_FALSE(IsRepeat('1'));
|
||||
EXPECT_FALSE(IsRepeat('-'));
|
||||
}
|
||||
|
||||
TEST(IsRepeatTest, IsTrueForRepeatChar) {
|
||||
EXPECT_TRUE(IsRepeat('?'));
|
||||
EXPECT_TRUE(IsRepeat('*'));
|
||||
EXPECT_TRUE(IsRepeat('+'));
|
||||
}
|
||||
|
||||
TEST(IsWhiteSpaceTest, IsFalseForNonWhiteSpace) {
|
||||
EXPECT_FALSE(IsWhiteSpace('\0'));
|
||||
EXPECT_FALSE(IsWhiteSpace('a'));
|
||||
EXPECT_FALSE(IsWhiteSpace('1'));
|
||||
EXPECT_FALSE(IsWhiteSpace('+'));
|
||||
EXPECT_FALSE(IsWhiteSpace('_'));
|
||||
}
|
||||
|
||||
TEST(IsWhiteSpaceTest, IsTrueForWhiteSpace) {
|
||||
EXPECT_TRUE(IsWhiteSpace(' '));
|
||||
EXPECT_TRUE(IsWhiteSpace('\n'));
|
||||
EXPECT_TRUE(IsWhiteSpace('\r'));
|
||||
EXPECT_TRUE(IsWhiteSpace('\t'));
|
||||
EXPECT_TRUE(IsWhiteSpace('\v'));
|
||||
EXPECT_TRUE(IsWhiteSpace('\f'));
|
||||
}
|
||||
|
||||
TEST(IsWordCharTest, IsFalseForNonWordChar) {
|
||||
EXPECT_FALSE(IsWordChar('\0'));
|
||||
EXPECT_FALSE(IsWordChar('+'));
|
||||
EXPECT_FALSE(IsWordChar('.'));
|
||||
EXPECT_FALSE(IsWordChar(' '));
|
||||
EXPECT_FALSE(IsWordChar('\n'));
|
||||
}
|
||||
|
||||
TEST(IsWordCharTest, IsTrueForLetter) {
|
||||
EXPECT_TRUE(IsWordChar('a'));
|
||||
EXPECT_TRUE(IsWordChar('b'));
|
||||
EXPECT_TRUE(IsWordChar('A'));
|
||||
EXPECT_TRUE(IsWordChar('Z'));
|
||||
}
|
||||
|
||||
TEST(IsWordCharTest, IsTrueForDigit) {
|
||||
EXPECT_TRUE(IsWordChar('0'));
|
||||
EXPECT_TRUE(IsWordChar('1'));
|
||||
EXPECT_TRUE(IsWordChar('7'));
|
||||
EXPECT_TRUE(IsWordChar('9'));
|
||||
}
|
||||
|
||||
TEST(IsWordCharTest, IsTrueForUnderscore) {
|
||||
EXPECT_TRUE(IsWordChar('_'));
|
||||
}
|
||||
|
||||
TEST(IsValidEscapeTest, IsFalseForNonPrintable) {
|
||||
EXPECT_FALSE(IsValidEscape('\0'));
|
||||
EXPECT_FALSE(IsValidEscape('\007'));
|
||||
}
|
||||
|
||||
TEST(IsValidEscapeTest, IsFalseForDigit) {
|
||||
EXPECT_FALSE(IsValidEscape('0'));
|
||||
EXPECT_FALSE(IsValidEscape('9'));
|
||||
}
|
||||
|
||||
TEST(IsValidEscapeTest, IsFalseForWhiteSpace) {
|
||||
EXPECT_FALSE(IsValidEscape(' '));
|
||||
EXPECT_FALSE(IsValidEscape('\n'));
|
||||
}
|
||||
|
||||
TEST(IsValidEscapeTest, IsFalseForSomeLetter) {
|
||||
EXPECT_FALSE(IsValidEscape('a'));
|
||||
EXPECT_FALSE(IsValidEscape('Z'));
|
||||
}
|
||||
|
||||
TEST(IsValidEscapeTest, IsTrueForPunct) {
|
||||
EXPECT_TRUE(IsValidEscape('.'));
|
||||
EXPECT_TRUE(IsValidEscape('-'));
|
||||
EXPECT_TRUE(IsValidEscape('^'));
|
||||
EXPECT_TRUE(IsValidEscape('$'));
|
||||
EXPECT_TRUE(IsValidEscape('('));
|
||||
EXPECT_TRUE(IsValidEscape(']'));
|
||||
EXPECT_TRUE(IsValidEscape('{'));
|
||||
EXPECT_TRUE(IsValidEscape('|'));
|
||||
}
|
||||
|
||||
TEST(IsValidEscapeTest, IsTrueForSomeLetter) {
|
||||
EXPECT_TRUE(IsValidEscape('d'));
|
||||
EXPECT_TRUE(IsValidEscape('D'));
|
||||
EXPECT_TRUE(IsValidEscape('s'));
|
||||
EXPECT_TRUE(IsValidEscape('S'));
|
||||
EXPECT_TRUE(IsValidEscape('w'));
|
||||
EXPECT_TRUE(IsValidEscape('W'));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, EscapedPunct) {
|
||||
EXPECT_FALSE(AtomMatchesChar(true, '\\', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, '\\', ' '));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, '_', '.'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, '.', 'a'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(true, '\\', '\\'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, '_', '_'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, '+', '+'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, '.', '.'));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, Escaped_d) {
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'd', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'd', 'a'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'd', '.'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'd', '0'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'd', '9'));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, Escaped_D) {
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'D', '0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'D', '9'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'D', '\0'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'D', 'a'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'D', '-'));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, Escaped_s) {
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 's', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 's', 'a'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 's', '.'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 's', '9'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 's', ' '));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 's', '\n'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 's', '\t'));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, Escaped_S) {
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'S', ' '));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'S', '\r'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'S', '\0'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'S', 'a'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'S', '9'));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, Escaped_w) {
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'w', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'w', '+'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'w', ' '));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'w', '\n'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'w', '0'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'w', 'b'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'w', 'C'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'w', '_'));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, Escaped_W) {
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'W', 'A'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'W', 'b'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'W', '9'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'W', '_'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'W', '\0'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'W', '*'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'W', '\n'));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, EscapedWhiteSpace) {
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'f', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'f', '\n'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'n', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'n', '\r'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'r', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'r', 'a'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 't', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 't', 't'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'v', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(true, 'v', '\f'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'f', '\f'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'n', '\n'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'r', '\r'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 't', '\t'));
|
||||
EXPECT_TRUE(AtomMatchesChar(true, 'v', '\v'));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, UnescapedDot) {
|
||||
EXPECT_FALSE(AtomMatchesChar(false, '.', '\n'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(false, '.', '\0'));
|
||||
EXPECT_TRUE(AtomMatchesChar(false, '.', '.'));
|
||||
EXPECT_TRUE(AtomMatchesChar(false, '.', 'a'));
|
||||
EXPECT_TRUE(AtomMatchesChar(false, '.', ' '));
|
||||
}
|
||||
|
||||
TEST(AtomMatchesCharTest, UnescapedChar) {
|
||||
EXPECT_FALSE(AtomMatchesChar(false, 'a', '\0'));
|
||||
EXPECT_FALSE(AtomMatchesChar(false, 'a', 'b'));
|
||||
EXPECT_FALSE(AtomMatchesChar(false, '$', 'a'));
|
||||
|
||||
EXPECT_TRUE(AtomMatchesChar(false, '$', '$'));
|
||||
EXPECT_TRUE(AtomMatchesChar(false, '5', '5'));
|
||||
EXPECT_TRUE(AtomMatchesChar(false, 'Z', 'Z'));
|
||||
}
|
||||
|
||||
TEST(ValidateRegexTest, GeneratesFailureAndReturnsFalseForInvalid) {
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(NULL)),
|
||||
"NULL is not a valid simple regular expression");
|
||||
EXPECT_NONFATAL_FAILURE(
|
||||
ASSERT_FALSE(ValidateRegex("a\\")),
|
||||
"Syntax error at index 1 in simple regular expression \"a\\\": ");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a\\")),
|
||||
"'\\' cannot appear at the end");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("\\n\\")),
|
||||
"'\\' cannot appear at the end");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("\\s\\hb")),
|
||||
"invalid escape sequence \"\\h\"");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^^")),
|
||||
"'^' can only appear at the beginning");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(".*^b")),
|
||||
"'^' can only appear at the beginning");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("$$")),
|
||||
"'$' can only appear at the end");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^$a")),
|
||||
"'$' can only appear at the end");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a(b")),
|
||||
"'(' is unsupported");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("ab)")),
|
||||
"')' is unsupported");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("[ab")),
|
||||
"'[' is unsupported");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a{2")),
|
||||
"'{' is unsupported");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("?")),
|
||||
"'?' can only follow a repeatable token");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^*")),
|
||||
"'*' can only follow a repeatable token");
|
||||
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("5*+")),
|
||||
"'+' can only follow a repeatable token");
|
||||
}
|
||||
|
||||
TEST(ValidateRegexTest, ReturnsTrueForValid) {
|
||||
EXPECT_TRUE(ValidateRegex(""));
|
||||
EXPECT_TRUE(ValidateRegex("a"));
|
||||
EXPECT_TRUE(ValidateRegex(".*"));
|
||||
EXPECT_TRUE(ValidateRegex("^a_+"));
|
||||
EXPECT_TRUE(ValidateRegex("^a\\t\\&?"));
|
||||
EXPECT_TRUE(ValidateRegex("09*$"));
|
||||
EXPECT_TRUE(ValidateRegex("^Z$"));
|
||||
EXPECT_TRUE(ValidateRegex("a\\^Z\\$\\(\\)\\|\\[\\]\\{\\}"));
|
||||
}
|
||||
|
||||
TEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrOne) {
|
||||
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "a", "ba"));
|
||||
// Repeating more than once.
|
||||
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "aab"));
|
||||
|
||||
// Repeating zero times.
|
||||
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "ba"));
|
||||
// Repeating once.
|
||||
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "ab"));
|
||||
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '#', '?', ".", "##"));
|
||||
}
|
||||
|
||||
TEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrMany) {
|
||||
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '*', "a$", "baab"));
|
||||
|
||||
// Repeating zero times.
|
||||
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', "b", "bc"));
|
||||
// Repeating once.
|
||||
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', "b", "abc"));
|
||||
// Repeating more than once.
|
||||
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '*', "-", "ab_1-g"));
|
||||
}
|
||||
|
||||
TEST(MatchRepetitionAndRegexAtHeadTest, WorksForOneOrMany) {
|
||||
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', "a$", "baab"));
|
||||
// Repeating zero times.
|
||||
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', "b", "bc"));
|
||||
|
||||
// Repeating once.
|
||||
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '+', "b", "abc"));
|
||||
// Repeating more than once.
|
||||
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '+', "-", "ab_1-g"));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAtHeadTest, ReturnsTrueForEmptyRegex) {
|
||||
EXPECT_TRUE(MatchRegexAtHead("", ""));
|
||||
EXPECT_TRUE(MatchRegexAtHead("", "ab"));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAtHeadTest, WorksWhenDollarIsInRegex) {
|
||||
EXPECT_FALSE(MatchRegexAtHead("$", "a"));
|
||||
|
||||
EXPECT_TRUE(MatchRegexAtHead("$", ""));
|
||||
EXPECT_TRUE(MatchRegexAtHead("a$", "a"));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithEscapeSequence) {
|
||||
EXPECT_FALSE(MatchRegexAtHead("\\w", "+"));
|
||||
EXPECT_FALSE(MatchRegexAtHead("\\W", "ab"));
|
||||
|
||||
EXPECT_TRUE(MatchRegexAtHead("\\sa", "\nab"));
|
||||
EXPECT_TRUE(MatchRegexAtHead("\\d", "1a"));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithRepetition) {
|
||||
EXPECT_FALSE(MatchRegexAtHead(".+a", "abc"));
|
||||
EXPECT_FALSE(MatchRegexAtHead("a?b", "aab"));
|
||||
|
||||
EXPECT_TRUE(MatchRegexAtHead(".*a", "bc12-ab"));
|
||||
EXPECT_TRUE(MatchRegexAtHead("a?b", "b"));
|
||||
EXPECT_TRUE(MatchRegexAtHead("a?b", "ab"));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAtHeadTest,
|
||||
WorksWhenRegexStartsWithRepetionOfEscapeSequence) {
|
||||
EXPECT_FALSE(MatchRegexAtHead("\\.+a", "abc"));
|
||||
EXPECT_FALSE(MatchRegexAtHead("\\s?b", " b"));
|
||||
|
||||
EXPECT_TRUE(MatchRegexAtHead("\\(*a", "((((ab"));
|
||||
EXPECT_TRUE(MatchRegexAtHead("\\^?b", "^b"));
|
||||
EXPECT_TRUE(MatchRegexAtHead("\\\\?b", "b"));
|
||||
EXPECT_TRUE(MatchRegexAtHead("\\\\?b", "\\b"));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAtHeadTest, MatchesSequentially) {
|
||||
EXPECT_FALSE(MatchRegexAtHead("ab.*c", "acabc"));
|
||||
|
||||
EXPECT_TRUE(MatchRegexAtHead("ab.*c", "ab-fsc"));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAnywhereTest, ReturnsFalseWhenStringIsNull) {
|
||||
EXPECT_FALSE(MatchRegexAnywhere("", NULL));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAnywhereTest, WorksWhenRegexStartsWithCaret) {
|
||||
EXPECT_FALSE(MatchRegexAnywhere("^a", "ba"));
|
||||
EXPECT_FALSE(MatchRegexAnywhere("^$", "a"));
|
||||
|
||||
EXPECT_TRUE(MatchRegexAnywhere("^a", "ab"));
|
||||
EXPECT_TRUE(MatchRegexAnywhere("^", "ab"));
|
||||
EXPECT_TRUE(MatchRegexAnywhere("^$", ""));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAnywhereTest, ReturnsFalseWhenNoMatch) {
|
||||
EXPECT_FALSE(MatchRegexAnywhere("a", "bcde123"));
|
||||
EXPECT_FALSE(MatchRegexAnywhere("a.+a", "--aa88888888"));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingPrefix) {
|
||||
EXPECT_TRUE(MatchRegexAnywhere("\\w+", "ab1_ - 5"));
|
||||
EXPECT_TRUE(MatchRegexAnywhere(".*=", "="));
|
||||
EXPECT_TRUE(MatchRegexAnywhere("x.*ab?.*bc", "xaaabc"));
|
||||
}
|
||||
|
||||
TEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingNonPrefix) {
|
||||
EXPECT_TRUE(MatchRegexAnywhere("\\w+", "$$$ ab1_ - 5"));
|
||||
EXPECT_TRUE(MatchRegexAnywhere("\\.+=", "= ...="));
|
||||
}
|
||||
|
||||
// Tests RE's implicit constructors.
|
||||
TEST(RETest, ImplicitConstructorWorks) {
|
||||
const RE empty("");
|
||||
EXPECT_STREQ("", empty.pattern());
|
||||
|
||||
const RE simple("hello");
|
||||
EXPECT_STREQ("hello", simple.pattern());
|
||||
}
|
||||
|
||||
// Tests that RE's constructors reject invalid regular expressions.
|
||||
TEST(RETest, RejectsInvalidRegex) {
|
||||
EXPECT_NONFATAL_FAILURE({
|
||||
const RE normal(NULL);
|
||||
}, "NULL is not a valid simple regular expression");
|
||||
|
||||
EXPECT_NONFATAL_FAILURE({
|
||||
const RE normal(".*(\\w+");
|
||||
}, "'(' is unsupported");
|
||||
|
||||
EXPECT_NONFATAL_FAILURE({
|
||||
const RE invalid("^?");
|
||||
}, "'?' can only follow a repeatable token");
|
||||
}
|
||||
|
||||
// Tests RE::FullMatch().
|
||||
TEST(RETest, FullMatchWorks) {
|
||||
const RE empty("");
|
||||
EXPECT_TRUE(RE::FullMatch("", empty));
|
||||
EXPECT_FALSE(RE::FullMatch("a", empty));
|
||||
|
||||
const RE re1("a");
|
||||
EXPECT_TRUE(RE::FullMatch("a", re1));
|
||||
|
||||
const RE re("a.*z");
|
||||
EXPECT_TRUE(RE::FullMatch("az", re));
|
||||
EXPECT_TRUE(RE::FullMatch("axyz", re));
|
||||
EXPECT_FALSE(RE::FullMatch("baz", re));
|
||||
EXPECT_FALSE(RE::FullMatch("azy", re));
|
||||
}
|
||||
|
||||
// Tests RE::PartialMatch().
|
||||
TEST(RETest, PartialMatchWorks) {
|
||||
const RE empty("");
|
||||
EXPECT_TRUE(RE::PartialMatch("", empty));
|
||||
EXPECT_TRUE(RE::PartialMatch("a", empty));
|
||||
|
||||
const RE re("a.*z");
|
||||
EXPECT_TRUE(RE::PartialMatch("az", re));
|
||||
EXPECT_TRUE(RE::PartialMatch("axyz", re));
|
||||
EXPECT_TRUE(RE::PartialMatch("baz", re));
|
||||
EXPECT_TRUE(RE::PartialMatch("azy", re));
|
||||
EXPECT_FALSE(RE::PartialMatch("zza", re));
|
||||
}
|
||||
|
||||
#endif // GTEST_USES_POSIX_RE
|
||||
|
||||
#if GTEST_HAS_STD_STRING
|
||||
|
||||
TEST(CaptureStderrTest, CapturesStdErr) {
|
||||
CaptureStderr();
|
||||
fprintf(stderr, "abc");
|
||||
ASSERT_EQ("abc", GetCapturedStderr());
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_STD_STRING
|
||||
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
@@ -117,7 +117,7 @@ TEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {
|
||||
EXPECT_STREQ("Failure 2", results.GetTestPartResult(1).message());
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
typedef TestPartResultArrayTest TestPartResultArrayDeathTest;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "test/gtest-typed-test_test.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
// Tests that the same type-parameterized test case can be
|
||||
// instantiated in different translation units linked together.
|
||||
|
||||
@@ -82,7 +82,7 @@ template <typename T>
|
||||
T* CommonTest<T>::shared_ = NULL;
|
||||
|
||||
// This #ifdef block tests typed tests.
|
||||
#ifdef GTEST_HAS_TYPED_TEST
|
||||
#if GTEST_HAS_TYPED_TEST
|
||||
|
||||
using testing::Types;
|
||||
|
||||
@@ -166,7 +166,7 @@ TYPED_TEST(NumericTest, DefaultIsZero) {
|
||||
#endif // GTEST_HAS_TYPED_TEST
|
||||
|
||||
// This #ifdef block tests type-parameterized tests.
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
using testing::Types;
|
||||
using testing::internal::TypedTestCasePState;
|
||||
@@ -198,26 +198,26 @@ TEST_F(TypedTestCasePStateTest, IgnoresOrderAndSpaces) {
|
||||
state_.VerifyRegisteredTestNames("foo.cc", 1, tests));
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
typedef TypedTestCasePStateTest TypedTestCasePStateDeathTest;
|
||||
|
||||
TEST_F(TypedTestCasePStateDeathTest, DetectsDuplicates) {
|
||||
EXPECT_DEATH(
|
||||
state_.VerifyRegisteredTestNames("foo.cc", 1, "A, B, A, C"),
|
||||
"foo\\.cc:1: Test A is listed more than once\\.");
|
||||
"foo\\.cc.1.?: Test A is listed more than once\\.");
|
||||
}
|
||||
|
||||
TEST_F(TypedTestCasePStateDeathTest, DetectsExtraTest) {
|
||||
EXPECT_DEATH(
|
||||
state_.VerifyRegisteredTestNames("foo.cc", 1, "A, B, C, D"),
|
||||
"foo\\.cc:1: No test named D can be found in this test case\\.");
|
||||
"foo\\.cc.1.?: No test named D can be found in this test case\\.");
|
||||
}
|
||||
|
||||
TEST_F(TypedTestCasePStateDeathTest, DetectsMissedTest) {
|
||||
EXPECT_DEATH(
|
||||
state_.VerifyRegisteredTestNames("foo.cc", 1, "A, C"),
|
||||
"foo\\.cc:1: You forgot to list test B\\.");
|
||||
"foo\\.cc.1.?: You forgot to list test B\\.");
|
||||
}
|
||||
|
||||
// Tests that defining a test for a parameterized test case generates
|
||||
@@ -226,7 +226,7 @@ TEST_F(TypedTestCasePStateDeathTest, DetectsTestAfterRegistration) {
|
||||
state_.VerifyRegisteredTestNames("foo.cc", 1, "A, B, C");
|
||||
EXPECT_DEATH(
|
||||
state_.AddTestName("foo.cc", 2, "FooTest", "D"),
|
||||
"foo\\.cc:2: Test D must be defined before REGISTER_TYPED_TEST_CASE_P"
|
||||
"foo\\.cc.2.?: Test D must be defined before REGISTER_TYPED_TEST_CASE_P"
|
||||
"\\(FooTest, \\.\\.\\.\\)\\.");
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
using testing::Test;
|
||||
|
||||
|
||||
47
test/gtest_all_test.cc
Normal file
47
test/gtest_all_test.cc
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2009, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Author: wan@google.com (Zhanyong Wan)
|
||||
//
|
||||
// Tests for Google C++ Testing Framework (Google Test)
|
||||
//
|
||||
// Sometimes it's desirable to build most of Google Test's own tests
|
||||
// by compiling a single file. This file serves this purpose.
|
||||
#include "test/gtest-filepath_test.cc"
|
||||
#include "test/gtest-linked_ptr_test.cc"
|
||||
#include "test/gtest-message_test.cc"
|
||||
#include "test/gtest-options_test.cc"
|
||||
#include "test/gtest-port_test.cc"
|
||||
#include "test/gtest_pred_impl_unittest.cc"
|
||||
#include "test/gtest_prod_test.cc"
|
||||
#include "test/gtest-test-part_test.cc"
|
||||
#include "test/gtest-typed-test_test.cc"
|
||||
#include "test/gtest-typed-test2_test.cc"
|
||||
#include "test/gtest_unittest.cc"
|
||||
#include "test/production.cc"
|
||||
@@ -42,7 +42,6 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
|
||||
|
||||
import gtest_test_utils
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
@@ -55,13 +54,17 @@ BREAK_ON_FAILURE_ENV_VAR = 'GTEST_BREAK_ON_FAILURE'
|
||||
# The command line flag for enabling/disabling the break-on-failure mode.
|
||||
BREAK_ON_FAILURE_FLAG = 'gtest_break_on_failure'
|
||||
|
||||
# The environment variable for enabling/disabling the throw-on-failure mode.
|
||||
THROW_ON_FAILURE_ENV_VAR = 'GTEST_THROW_ON_FAILURE'
|
||||
|
||||
# Path to the gtest_break_on_failure_unittest_ program.
|
||||
EXE_PATH = os.path.join(gtest_test_utils.GetBuildDir(),
|
||||
'gtest_break_on_failure_unittest_');
|
||||
'gtest_break_on_failure_unittest_')
|
||||
|
||||
|
||||
# Utilities.
|
||||
|
||||
|
||||
def SetEnvVar(env_var, value):
|
||||
"""Sets an environment variable to a given value; unsets it when the
|
||||
given value is None.
|
||||
@@ -74,8 +77,7 @@ def SetEnvVar(env_var, value):
|
||||
|
||||
|
||||
def Run(command):
|
||||
"""Runs a command; returns 1 if it was killed by a signal, or 0 otherwise.
|
||||
"""
|
||||
"""Runs a command; returns 1 if it was killed by a signal, or 0 otherwise."""
|
||||
|
||||
p = gtest_test_utils.Subprocess(command)
|
||||
if p.terminated_by_signal:
|
||||
@@ -84,7 +86,8 @@ def Run(command):
|
||||
return 0
|
||||
|
||||
|
||||
# The unit test.
|
||||
# The tests.
|
||||
|
||||
|
||||
class GTestBreakOnFailureUnitTest(unittest.TestCase):
|
||||
"""Tests using the GTEST_BREAK_ON_FAILURE environment variable or
|
||||
@@ -180,6 +183,16 @@ class GTestBreakOnFailureUnitTest(unittest.TestCase):
|
||||
flag_value='1',
|
||||
expect_seg_fault=1)
|
||||
|
||||
def testBreakOnFailureOverridesThrowOnFailure(self):
|
||||
"""Tests that gtest_break_on_failure overrides gtest_throw_on_failure."""
|
||||
|
||||
SetEnvVar(THROW_ON_FAILURE_ENV_VAR, '1')
|
||||
try:
|
||||
self.RunAndVerify(env_var_value=None,
|
||||
flag_value='1',
|
||||
expect_seg_fault=1)
|
||||
finally:
|
||||
SetEnvVar(THROW_ON_FAILURE_ENV_VAR, None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
gtest_test_utils.Main()
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
@@ -54,9 +54,8 @@ TEST(Foo, Bar) {
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Suppresses display of the Windows error dialog upon encountering
|
||||
// a general protection fault (segment violation).
|
||||
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
|
||||
|
||||
@@ -103,12 +103,14 @@ def TestEnvVarAffectsFlag(command):
|
||||
TestFlag(command, 'output', 'tmp/foo.xml', '')
|
||||
TestFlag(command, 'print_time', '1', '0')
|
||||
TestFlag(command, 'repeat', '999', '1')
|
||||
TestFlag(command, 'throw_on_failure', '1', '0')
|
||||
|
||||
if IS_WINDOWS:
|
||||
TestFlag(command, 'catch_exceptions', '1', '0')
|
||||
if IS_LINUX:
|
||||
TestFlag(command, 'stack_trace_depth', '0', '100')
|
||||
TestFlag(command, 'death_test_style', 'thread-safe', 'fast')
|
||||
TestFlag(command, 'death_test_use_fork', '1', '0')
|
||||
|
||||
|
||||
if IS_WINDOWS:
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
using ::std::cout;
|
||||
|
||||
@@ -71,6 +71,11 @@ void PrintFlag(const char* flag) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(flag, "death_test_use_fork") == 0) {
|
||||
cout << GTEST_FLAG(death_test_use_fork);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(flag, "filter") == 0) {
|
||||
cout << GTEST_FLAG(filter);
|
||||
return;
|
||||
@@ -96,6 +101,11 @@ void PrintFlag(const char* flag) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(flag, "throw_on_failure") == 0) {
|
||||
cout << GTEST_FLAG(throw_on_failure);
|
||||
return;
|
||||
}
|
||||
|
||||
cout << "Invalid flag name " << flag
|
||||
<< ". Valid names are break_on_failure, color, filter, etc.\n";
|
||||
exit(1);
|
||||
|
||||
@@ -36,25 +36,36 @@ the GTEST_FILTER environment variable or the --gtest_filter flag.
|
||||
This script tests such functionality by invoking
|
||||
gtest_filter_unittest_ (a program written with Google Test) with different
|
||||
environments and command line flags.
|
||||
|
||||
Note that test sharding may also influence which tests are filtered. Therefore,
|
||||
we test that here also.
|
||||
"""
|
||||
|
||||
__author__ = 'wan@google.com (Zhanyong Wan)'
|
||||
|
||||
import gtest_test_utils
|
||||
import os
|
||||
import re
|
||||
import sets
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import gtest_test_utils
|
||||
|
||||
# Constants.
|
||||
|
||||
# The environment variable for specifying the test filters.
|
||||
FILTER_ENV_VAR = 'GTEST_FILTER'
|
||||
|
||||
# The environment variables for test sharding.
|
||||
TOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS'
|
||||
SHARD_INDEX_ENV_VAR = 'GTEST_SHARD_INDEX'
|
||||
SHARD_STATUS_FILE_ENV_VAR = 'GTEST_SHARD_STATUS_FILE'
|
||||
|
||||
# The command line flag for specifying the test filters.
|
||||
FILTER_FLAG = 'gtest_filter'
|
||||
|
||||
# The command line flag for including disabled tests.
|
||||
ALSO_RUN_DISABED_TESTS_FLAG = 'gtest_also_run_disabled_tests'
|
||||
|
||||
# Command to run the gtest_filter_unittest_ program.
|
||||
COMMAND = os.path.join(gtest_test_utils.GetBuildDir(),
|
||||
'gtest_filter_unittest_')
|
||||
@@ -80,7 +91,17 @@ PARAM_TESTS = [
|
||||
'SeqQ/ParamTest.TestY/1',
|
||||
]
|
||||
|
||||
ALL_TESTS = [
|
||||
DISABLED_TESTS = [
|
||||
'BarTest.DISABLED_TestFour',
|
||||
'BarTest.DISABLED_TestFive',
|
||||
'BazTest.DISABLED_TestC',
|
||||
'DISABLED_FoobarTest.Test1',
|
||||
'DISABLED_FoobarTest.DISABLED_Test2',
|
||||
'DISABLED_FoobarbazTest.TestA',
|
||||
]
|
||||
|
||||
# All the non-disabled tests.
|
||||
ACTIVE_TESTS = [
|
||||
'FooTest.Abc',
|
||||
'FooTest.Xyz',
|
||||
|
||||
@@ -91,6 +112,9 @@ ALL_TESTS = [
|
||||
'BazTest.TestOne',
|
||||
'BazTest.TestA',
|
||||
'BazTest.TestB',
|
||||
|
||||
'HasDeathTest.Test1',
|
||||
'HasDeathTest.Test2',
|
||||
] + PARAM_TESTS
|
||||
|
||||
param_tests_present = None
|
||||
@@ -109,7 +133,7 @@ def SetEnvVar(env_var, value):
|
||||
|
||||
def Run(command):
|
||||
"""Runs a Google Test program and returns a list of full names of the
|
||||
tests that were run.
|
||||
tests that were run along with the test exit code.
|
||||
"""
|
||||
|
||||
stdout_file = os.popen(command, 'r')
|
||||
@@ -125,10 +149,33 @@ def Run(command):
|
||||
if match is not None:
|
||||
test = match.group(1)
|
||||
tests_run += [test_case + '.' + test]
|
||||
stdout_file.close()
|
||||
return tests_run
|
||||
exit_code = stdout_file.close()
|
||||
return (tests_run, exit_code)
|
||||
|
||||
|
||||
def InvokeWithModifiedEnv(extra_env, function, *args, **kwargs):
|
||||
"""Runs the given function and arguments in a modified environment."""
|
||||
try:
|
||||
original_env = os.environ.copy()
|
||||
os.environ.update(extra_env)
|
||||
return function(*args, **kwargs)
|
||||
finally:
|
||||
for key in extra_env.iterkeys():
|
||||
if key in original_env:
|
||||
os.environ[key] = original_env[key]
|
||||
else:
|
||||
del os.environ[key]
|
||||
|
||||
|
||||
def RunWithSharding(total_shards, shard_index, command):
|
||||
"""Runs the Google Test program shard and returns a list of full names of the
|
||||
tests that were run along with the exit code.
|
||||
"""
|
||||
|
||||
extra_env = {SHARD_INDEX_ENV_VAR: str(shard_index),
|
||||
TOTAL_SHARDS_ENV_VAR: str(total_shards)}
|
||||
return InvokeWithModifiedEnv(extra_env, Run, command)
|
||||
|
||||
# The unit test.
|
||||
|
||||
|
||||
@@ -148,6 +195,15 @@ class GTestFilterUnitTest(unittest.TestCase):
|
||||
for elem in rhs:
|
||||
self.assert_(elem in lhs, '%s in %s' % (elem, lhs))
|
||||
|
||||
def AssertPartitionIsValid(self, set_var, list_of_sets):
|
||||
"""Asserts that list_of_sets is a valid partition of set_var."""
|
||||
|
||||
full_partition = []
|
||||
for slice_var in list_of_sets:
|
||||
full_partition.extend(slice_var)
|
||||
self.assertEqual(len(set_var), len(full_partition))
|
||||
self.assertEqual(sets.Set(set_var), sets.Set(full_partition))
|
||||
|
||||
def RunAndVerify(self, gtest_filter, tests_to_run):
|
||||
"""Runs gtest_flag_unittest_ with the given filter, and verifies
|
||||
that the right set of tests were run.
|
||||
@@ -161,7 +217,7 @@ class GTestFilterUnitTest(unittest.TestCase):
|
||||
# First, tests using GTEST_FILTER.
|
||||
|
||||
SetEnvVar(FILTER_ENV_VAR, gtest_filter)
|
||||
tests_run = Run(COMMAND)
|
||||
tests_run = Run(COMMAND)[0]
|
||||
SetEnvVar(FILTER_ENV_VAR, None)
|
||||
|
||||
self.AssertSetEqual(tests_run, tests_to_run)
|
||||
@@ -173,7 +229,37 @@ class GTestFilterUnitTest(unittest.TestCase):
|
||||
else:
|
||||
command = '%s --%s=%s' % (COMMAND, FILTER_FLAG, gtest_filter)
|
||||
|
||||
tests_run = Run(command)
|
||||
tests_run = Run(command)[0]
|
||||
self.AssertSetEqual(tests_run, tests_to_run)
|
||||
|
||||
def RunAndVerifyWithSharding(self, gtest_filter, total_shards, tests_to_run,
|
||||
command=COMMAND, check_exit_0=False):
|
||||
"""Runs all shards of gtest_flag_unittest_ with the given filter, and
|
||||
verifies that the right set of tests were run. The union of tests run
|
||||
on each shard should be identical to tests_to_run, without duplicates.
|
||||
If check_exit_0, make sure that all shards returned 0.
|
||||
"""
|
||||
SetEnvVar(FILTER_ENV_VAR, gtest_filter)
|
||||
partition = []
|
||||
for i in range(0, total_shards):
|
||||
(tests_run, exit_code) = RunWithSharding(total_shards, i, command)
|
||||
if check_exit_0:
|
||||
self.assert_(exit_code is None)
|
||||
partition.append(tests_run)
|
||||
|
||||
self.AssertPartitionIsValid(tests_to_run, partition)
|
||||
SetEnvVar(FILTER_ENV_VAR, None)
|
||||
|
||||
def RunAndVerifyAllowingDisabled(self, gtest_filter, tests_to_run):
|
||||
"""Runs gtest_flag_unittest_ with the given filter, and enables
|
||||
disabled tests. Verifies that the right set of tests were run.
|
||||
"""
|
||||
# Construct the command line.
|
||||
command = '%s --%s' % (COMMAND, ALSO_RUN_DISABED_TESTS_FLAG)
|
||||
if gtest_filter is not None:
|
||||
command = '%s --%s=%s' % (command, FILTER_FLAG, gtest_filter)
|
||||
|
||||
tests_run = Run(command)[0]
|
||||
self.AssertSetEqual(tests_run, tests_to_run)
|
||||
|
||||
def setUp(self):
|
||||
@@ -188,39 +274,87 @@ class GTestFilterUnitTest(unittest.TestCase):
|
||||
def testDefaultBehavior(self):
|
||||
"""Tests the behavior of not specifying the filter."""
|
||||
|
||||
self.RunAndVerify(None, ALL_TESTS)
|
||||
self.RunAndVerify(None, ACTIVE_TESTS)
|
||||
|
||||
def testDefaultBehaviorWithShards(self):
|
||||
"""Tests the behavior of not specifying the filter, with sharding
|
||||
enabled.
|
||||
"""
|
||||
self.RunAndVerifyWithSharding(None, 1, ACTIVE_TESTS)
|
||||
self.RunAndVerifyWithSharding(None, 2, ACTIVE_TESTS)
|
||||
self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS) - 1, ACTIVE_TESTS)
|
||||
self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS), ACTIVE_TESTS)
|
||||
self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS) + 1, ACTIVE_TESTS)
|
||||
|
||||
def testEmptyFilter(self):
|
||||
"""Tests an empty filter."""
|
||||
|
||||
self.RunAndVerify('', [])
|
||||
self.RunAndVerifyWithSharding('', 1, [])
|
||||
self.RunAndVerifyWithSharding('', 2, [])
|
||||
|
||||
def testBadFilter(self):
|
||||
"""Tests a filter that matches nothing."""
|
||||
|
||||
self.RunAndVerify('BadFilter', [])
|
||||
self.RunAndVerifyAllowingDisabled('BadFilter', [])
|
||||
|
||||
def testFullName(self):
|
||||
"""Tests filtering by full name."""
|
||||
|
||||
self.RunAndVerify('FooTest.Xyz', ['FooTest.Xyz'])
|
||||
self.RunAndVerifyAllowingDisabled('FooTest.Xyz', ['FooTest.Xyz'])
|
||||
self.RunAndVerifyWithSharding('FooTest.Xyz', 5, ['FooTest.Xyz'])
|
||||
|
||||
def testUniversalFilters(self):
|
||||
"""Tests filters that match everything."""
|
||||
|
||||
self.RunAndVerify('*', ALL_TESTS)
|
||||
self.RunAndVerify('*.*', ALL_TESTS)
|
||||
self.RunAndVerify('*', ACTIVE_TESTS)
|
||||
self.RunAndVerify('*.*', ACTIVE_TESTS)
|
||||
self.RunAndVerifyWithSharding('*.*', len(ACTIVE_TESTS) - 3, ACTIVE_TESTS)
|
||||
self.RunAndVerifyAllowingDisabled('*', ACTIVE_TESTS + DISABLED_TESTS)
|
||||
self.RunAndVerifyAllowingDisabled('*.*', ACTIVE_TESTS + DISABLED_TESTS)
|
||||
|
||||
def testFilterByTestCase(self):
|
||||
"""Tests filtering by test case name."""
|
||||
|
||||
self.RunAndVerify('FooTest.*', ['FooTest.Abc', 'FooTest.Xyz'])
|
||||
|
||||
BAZ_TESTS = ['BazTest.TestOne', 'BazTest.TestA', 'BazTest.TestB']
|
||||
self.RunAndVerify('BazTest.*', BAZ_TESTS)
|
||||
self.RunAndVerifyAllowingDisabled('BazTest.*',
|
||||
BAZ_TESTS + ['BazTest.DISABLED_TestC'])
|
||||
|
||||
def testFilterByTest(self):
|
||||
"""Tests filtering by test name."""
|
||||
|
||||
self.RunAndVerify('*.TestOne', ['BarTest.TestOne', 'BazTest.TestOne'])
|
||||
|
||||
def testFilterDisabledTests(self):
|
||||
"""Select only the disabled tests to run."""
|
||||
|
||||
self.RunAndVerify('DISABLED_FoobarTest.Test1', [])
|
||||
self.RunAndVerifyAllowingDisabled('DISABLED_FoobarTest.Test1',
|
||||
['DISABLED_FoobarTest.Test1'])
|
||||
|
||||
self.RunAndVerify('*DISABLED_*', [])
|
||||
self.RunAndVerifyAllowingDisabled('*DISABLED_*', DISABLED_TESTS)
|
||||
|
||||
self.RunAndVerify('*.DISABLED_*', [])
|
||||
self.RunAndVerifyAllowingDisabled('*.DISABLED_*', [
|
||||
'BarTest.DISABLED_TestFour',
|
||||
'BarTest.DISABLED_TestFive',
|
||||
'BazTest.DISABLED_TestC',
|
||||
'DISABLED_FoobarTest.DISABLED_Test2',
|
||||
])
|
||||
|
||||
self.RunAndVerify('DISABLED_*', [])
|
||||
self.RunAndVerifyAllowingDisabled('DISABLED_*', [
|
||||
'DISABLED_FoobarTest.Test1',
|
||||
'DISABLED_FoobarTest.DISABLED_Test2',
|
||||
'DISABLED_FoobarbazTest.TestA',
|
||||
])
|
||||
|
||||
def testWildcardInTestCaseName(self):
|
||||
"""Tests using wildcard in the test case name."""
|
||||
|
||||
@@ -231,7 +365,10 @@ class GTestFilterUnitTest(unittest.TestCase):
|
||||
|
||||
'BazTest.TestOne',
|
||||
'BazTest.TestA',
|
||||
'BazTest.TestB',] + PARAM_TESTS)
|
||||
'BazTest.TestB',
|
||||
|
||||
'HasDeathTest.Test1',
|
||||
'HasDeathTest.Test2', ] + PARAM_TESTS)
|
||||
|
||||
def testWildcardInTestName(self):
|
||||
"""Tests using wildcard in the test name."""
|
||||
@@ -292,7 +429,22 @@ class GTestFilterUnitTest(unittest.TestCase):
|
||||
])
|
||||
|
||||
def testNegativeFilters(self):
|
||||
self.RunAndVerify('*-FooTest.Abc', [
|
||||
self.RunAndVerify('*-HasDeathTest.Test1', [
|
||||
'FooTest.Abc',
|
||||
'FooTest.Xyz',
|
||||
|
||||
'BarTest.TestOne',
|
||||
'BarTest.TestTwo',
|
||||
'BarTest.TestThree',
|
||||
|
||||
'BazTest.TestOne',
|
||||
'BazTest.TestA',
|
||||
'BazTest.TestB',
|
||||
|
||||
'HasDeathTest.Test2',
|
||||
] + PARAM_TESTS)
|
||||
|
||||
self.RunAndVerify('*-FooTest.Abc:HasDeathTest.*', [
|
||||
'FooTest.Xyz',
|
||||
|
||||
'BarTest.TestOne',
|
||||
@@ -304,21 +456,13 @@ class GTestFilterUnitTest(unittest.TestCase):
|
||||
'BazTest.TestB',
|
||||
] + PARAM_TESTS)
|
||||
|
||||
self.RunAndVerify('*-FooTest.Abc:BazTest.*', [
|
||||
'FooTest.Xyz',
|
||||
|
||||
'BarTest.TestOne',
|
||||
'BarTest.TestTwo',
|
||||
'BarTest.TestThree',
|
||||
] + PARAM_TESTS)
|
||||
|
||||
self.RunAndVerify('BarTest.*-BarTest.TestOne', [
|
||||
'BarTest.TestTwo',
|
||||
'BarTest.TestThree',
|
||||
])
|
||||
|
||||
# Tests without leading '*'.
|
||||
self.RunAndVerify('-FooTest.Abc:FooTest.Xyz', [
|
||||
self.RunAndVerify('-FooTest.Abc:FooTest.Xyz:HasDeathTest.*', [
|
||||
'BarTest.TestOne',
|
||||
'BarTest.TestTwo',
|
||||
'BarTest.TestThree',
|
||||
@@ -354,11 +498,65 @@ class GTestFilterUnitTest(unittest.TestCase):
|
||||
|
||||
SetEnvVar(FILTER_ENV_VAR, 'Foo*')
|
||||
command = '%s --%s=%s' % (COMMAND, FILTER_FLAG, '*One')
|
||||
tests_run = Run(command)
|
||||
tests_run = Run(command)[0]
|
||||
SetEnvVar(FILTER_ENV_VAR, None)
|
||||
|
||||
self.AssertSetEqual(tests_run, ['BarTest.TestOne', 'BazTest.TestOne'])
|
||||
|
||||
def testShardStatusFileIsCreated(self):
|
||||
"""Tests that the shard file is created if specified in the environment."""
|
||||
|
||||
test_tmpdir = tempfile.mkdtemp()
|
||||
shard_status_file = os.path.join(test_tmpdir, 'shard_status_file')
|
||||
self.assert_(not os.path.exists(shard_status_file))
|
||||
|
||||
extra_env = {SHARD_STATUS_FILE_ENV_VAR: shard_status_file}
|
||||
stdout_file = InvokeWithModifiedEnv(extra_env, os.popen, COMMAND, 'r')
|
||||
try:
|
||||
stdout_file.readlines()
|
||||
finally:
|
||||
stdout_file.close()
|
||||
self.assert_(os.path.exists(shard_status_file))
|
||||
os.remove(shard_status_file)
|
||||
os.removedirs(test_tmpdir)
|
||||
|
||||
def testShardStatusFileIsCreatedWithListTests(self):
|
||||
"""Tests that the shard file is created with --gtest_list_tests."""
|
||||
|
||||
test_tmpdir = tempfile.mkdtemp()
|
||||
shard_status_file = os.path.join(test_tmpdir, 'shard_status_file2')
|
||||
self.assert_(not os.path.exists(shard_status_file))
|
||||
|
||||
extra_env = {SHARD_STATUS_FILE_ENV_VAR: shard_status_file}
|
||||
stdout_file = InvokeWithModifiedEnv(extra_env, os.popen,
|
||||
'%s --gtest_list_tests' % COMMAND, 'r')
|
||||
try:
|
||||
stdout_file.readlines()
|
||||
finally:
|
||||
stdout_file.close()
|
||||
self.assert_(os.path.exists(shard_status_file))
|
||||
os.remove(shard_status_file)
|
||||
os.removedirs(test_tmpdir)
|
||||
|
||||
def testShardingWorksWithDeathTests(self):
|
||||
"""Tests integration with death tests and sharding."""
|
||||
gtest_filter = 'HasDeathTest.*:SeqP/*'
|
||||
expected_tests = [
|
||||
'HasDeathTest.Test1',
|
||||
'HasDeathTest.Test2',
|
||||
|
||||
'SeqP/ParamTest.TestX/0',
|
||||
'SeqP/ParamTest.TestX/1',
|
||||
'SeqP/ParamTest.TestY/0',
|
||||
'SeqP/ParamTest.TestY/1',
|
||||
]
|
||||
|
||||
for command in (COMMAND + ' --gtest_death_test_style=threadsafe',
|
||||
COMMAND + ' --gtest_death_test_style=fast'):
|
||||
self.RunAndVerifyWithSharding(gtest_filter, 3, expected_tests,
|
||||
check_exit_0=True, command=command)
|
||||
self.RunAndVerifyWithSharding(gtest_filter, 5, expected_tests,
|
||||
check_exit_0=True, command=command)
|
||||
|
||||
if __name__ == '__main__':
|
||||
gtest_test_utils.Main()
|
||||
|
||||
@@ -67,6 +67,13 @@ TEST(BarTest, TestTwo) {
|
||||
TEST(BarTest, TestThree) {
|
||||
}
|
||||
|
||||
TEST(BarTest, DISABLED_TestFour) {
|
||||
FAIL() << "Expected failure.";
|
||||
}
|
||||
|
||||
TEST(BarTest, DISABLED_TestFive) {
|
||||
FAIL() << "Expected failure.";
|
||||
}
|
||||
|
||||
// Test case BazTest.
|
||||
|
||||
@@ -80,7 +87,46 @@ TEST(BazTest, TestA) {
|
||||
TEST(BazTest, TestB) {
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
TEST(BazTest, DISABLED_TestC) {
|
||||
FAIL() << "Expected failure.";
|
||||
}
|
||||
|
||||
// Test case HasDeathTest
|
||||
|
||||
TEST(HasDeathTest, Test1) {
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
EXPECT_DEATH({exit(1);},
|
||||
".*");
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
}
|
||||
|
||||
// We need at least two death tests to make sure that the all death tests
|
||||
// aren't on the first shard.
|
||||
TEST(HasDeathTest, Test2) {
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
EXPECT_DEATH({exit(1);},
|
||||
".*");
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
}
|
||||
|
||||
|
||||
// Test case FoobarTest
|
||||
|
||||
TEST(DISABLED_FoobarTest, Test1) {
|
||||
FAIL() << "Expected failure.";
|
||||
}
|
||||
|
||||
TEST(DISABLED_FoobarTest, DISABLED_Test2) {
|
||||
FAIL() << "Expected failure.";
|
||||
}
|
||||
|
||||
// Test case FoobarbazTest
|
||||
|
||||
TEST(DISABLED_FoobarbazTest, TestA) {
|
||||
FAIL() << "Expected failure.";
|
||||
}
|
||||
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
class ParamTest : public testing::TestWithParam<int> {
|
||||
};
|
||||
|
||||
|
||||
127
test/gtest_help_test.py
Executable file
127
test/gtest_help_test.py
Executable file
@@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2009, Google Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
"""Tests the --help flag of Google C++ Testing Framework.
|
||||
|
||||
SYNOPSIS
|
||||
gtest_help_test.py --gtest_build_dir=BUILD/DIR
|
||||
# where BUILD/DIR contains the built gtest_help_test_ file.
|
||||
gtest_help_test.py
|
||||
"""
|
||||
|
||||
__author__ = 'wan@google.com (Zhanyong Wan)'
|
||||
|
||||
import gtest_test_utils
|
||||
import os
|
||||
import re
|
||||
import unittest
|
||||
|
||||
|
||||
IS_WINDOWS = os.name == 'nt'
|
||||
|
||||
if IS_WINDOWS:
|
||||
PROGRAM = 'gtest_help_test_.exe'
|
||||
else:
|
||||
PROGRAM = 'gtest_help_test_'
|
||||
|
||||
PROGRAM_PATH = os.path.join(gtest_test_utils.GetBuildDir(), PROGRAM)
|
||||
FLAG_PREFIX = '--gtest_'
|
||||
CATCH_EXCEPTIONS_FLAG = FLAG_PREFIX + 'catch_exceptions'
|
||||
|
||||
# The help message must match this regex.
|
||||
HELP_REGEX = re.compile(
|
||||
FLAG_PREFIX + r'list_tests.*' +
|
||||
FLAG_PREFIX + r'filter=.*' +
|
||||
FLAG_PREFIX + r'also_run_disabled_tests.*' +
|
||||
FLAG_PREFIX + r'repeat=.*' +
|
||||
FLAG_PREFIX + r'color=.*' +
|
||||
FLAG_PREFIX + r'print_time.*' +
|
||||
FLAG_PREFIX + r'output=.*' +
|
||||
FLAG_PREFIX + r'break_on_failure.*' +
|
||||
FLAG_PREFIX + r'throw_on_failure.*',
|
||||
re.DOTALL)
|
||||
|
||||
|
||||
def RunWithFlag(flag):
|
||||
"""Runs gtest_help_test_ with the given flag.
|
||||
|
||||
Returns:
|
||||
the exit code and the text output as a tuple.
|
||||
Args:
|
||||
flag: the command-line flag to pass to gtest_help_test_, or None.
|
||||
"""
|
||||
|
||||
if flag is None:
|
||||
command = [PROGRAM_PATH]
|
||||
else:
|
||||
command = [PROGRAM_PATH, flag]
|
||||
child = gtest_test_utils.Subprocess(command)
|
||||
return child.exit_code, child.output
|
||||
|
||||
|
||||
class GTestHelpTest(unittest.TestCase):
|
||||
"""Tests the --help flag and its equivalent forms."""
|
||||
|
||||
def TestHelpFlag(self, flag):
|
||||
"""Verifies that the right message is printed and the tests are
|
||||
skipped when the given flag is specified."""
|
||||
|
||||
exit_code, output = RunWithFlag(flag)
|
||||
self.assertEquals(0, exit_code)
|
||||
self.assert_(HELP_REGEX.search(output), output)
|
||||
if IS_WINDOWS:
|
||||
self.assert_(CATCH_EXCEPTIONS_FLAG in output, output)
|
||||
else:
|
||||
self.assert_(CATCH_EXCEPTIONS_FLAG not in output, output)
|
||||
|
||||
def testPrintsHelpWithFullFlag(self):
|
||||
self.TestHelpFlag('--help')
|
||||
|
||||
def testPrintsHelpWithShortFlag(self):
|
||||
self.TestHelpFlag('-h')
|
||||
|
||||
def testPrintsHelpWithQuestionFlag(self):
|
||||
self.TestHelpFlag('-?')
|
||||
|
||||
def testPrintsHelpWithWindowsStyleQuestionFlag(self):
|
||||
self.TestHelpFlag('/?')
|
||||
|
||||
def testRunsTestsWithoutHelpFlag(self):
|
||||
"""Verifies that when no help flag is specified, the tests are run
|
||||
and the help message is not printed."""
|
||||
|
||||
exit_code, output = RunWithFlag(None)
|
||||
self.assert_(exit_code != 0)
|
||||
self.assert_(not HELP_REGEX.search(output), output)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
gtest_test_utils.Main()
|
||||
42
test/gtest_help_test_.cc
Normal file
42
test/gtest_help_test_.cc
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright 2009, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Author: wan@google.com (Zhanyong Wan)
|
||||
|
||||
// This program is meant to be run by gtest_help_test.py. Do not run
|
||||
// it directly.
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// When a help flag is specified, this program should skip the tests
|
||||
// and exit with 0; otherwise the following test will be executed,
|
||||
// causing this program to exit with a non-zero code.
|
||||
TEST(HelpFlagTest, ShouldNotBeRun) {
|
||||
ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified.";
|
||||
}
|
||||
@@ -181,6 +181,47 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>);
|
||||
// Wrong name prefix: "My" has been used.
|
||||
INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<double>);
|
||||
|
||||
#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_IS_NOT_A_TYPE)
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// Tests that StaticAssertTypeEq<T1, T2> cannot be used as a type.
|
||||
testing::StaticAssertTypeEq<int, int> dummy;
|
||||
|
||||
#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_NAMESPACE)
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// Tests that StaticAssertTypeEq<T1, T2> works in a namespace scope.
|
||||
static bool dummy = testing::StaticAssertTypeEq<int, const int>();
|
||||
|
||||
#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_CLASS)
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
template <typename T>
|
||||
class Helper {
|
||||
public:
|
||||
// Tests that StaticAssertTypeEq<T1, T2> works in a class.
|
||||
Helper() { testing::StaticAssertTypeEq<int, T>(); }
|
||||
|
||||
void DoSomething() {}
|
||||
};
|
||||
|
||||
void Test() {
|
||||
Helper<bool> h;
|
||||
h.DoSomething(); // To avoid the "unused variable" warning.
|
||||
}
|
||||
|
||||
#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_FUNCTION)
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
void Test() {
|
||||
// Tests that StaticAssertTypeEq<T1, T2> works inside a function.
|
||||
testing::StaticAssertTypeEq<const int, int>();
|
||||
}
|
||||
|
||||
#else
|
||||
// A sanity test. This should compile.
|
||||
|
||||
|
||||
@@ -78,6 +78,18 @@ class GTestNCTest(unittest.TestCase):
|
||||
('CATCHES_INSTANTIATE_TYPED_TESET_CASE_P_WITH_SAME_NAME_PREFIX',
|
||||
[r'redefinition of.*My.*FooTest']),
|
||||
|
||||
('STATIC_ASSERT_TYPE_EQ_IS_NOT_A_TYPE',
|
||||
[r'StaticAssertTypeEq.* does not name a type']),
|
||||
|
||||
('STATIC_ASSERT_TYPE_EQ_WORKS_IN_NAMESPACE',
|
||||
[r'StaticAssertTypeEq.*int.*const int']),
|
||||
|
||||
('STATIC_ASSERT_TYPE_EQ_WORKS_IN_CLASS',
|
||||
[r'StaticAssertTypeEq.*int.*bool']),
|
||||
|
||||
('STATIC_ASSERT_TYPE_EQ_WORKS_IN_FUNCTION',
|
||||
[r'StaticAssertTypeEq.*const int.*int']),
|
||||
|
||||
('SANITY',
|
||||
None)
|
||||
]
|
||||
|
||||
@@ -40,12 +40,12 @@ SYNOPSIS
|
||||
|
||||
__author__ = 'wan@google.com (Zhanyong Wan)'
|
||||
|
||||
import gtest_test_utils
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
import sys
|
||||
import unittest
|
||||
import gtest_test_utils
|
||||
|
||||
|
||||
# The flag for generating the golden file
|
||||
@@ -61,13 +61,25 @@ else:
|
||||
GOLDEN_NAME = 'gtest_output_test_golden_lin.txt'
|
||||
|
||||
PROGRAM_PATH = os.path.join(gtest_test_utils.GetBuildDir(), PROGRAM)
|
||||
COMMAND_WITH_COLOR = PROGRAM_PATH + ' --gtest_color=yes'
|
||||
COMMAND_WITH_TIME = (PROGRAM_PATH + ' --gtest_print_time '
|
||||
+ '--gtest_filter="FatalFailureTest.*:LoggingTest.*"')
|
||||
|
||||
# At least one command we exercise must not have the
|
||||
# --gtest_internal_skip_environment_and_ad_hoc_tests flag.
|
||||
COMMAND_WITH_COLOR = ({}, PROGRAM_PATH + ' --gtest_color=yes')
|
||||
COMMAND_WITH_TIME = ({}, PROGRAM_PATH + ' --gtest_print_time '
|
||||
'--gtest_internal_skip_environment_and_ad_hoc_tests '
|
||||
'--gtest_filter="FatalFailureTest.*:LoggingTest.*"')
|
||||
COMMAND_WITH_DISABLED = ({}, PROGRAM_PATH + ' --gtest_also_run_disabled_tests '
|
||||
'--gtest_internal_skip_environment_and_ad_hoc_tests '
|
||||
'--gtest_filter="*DISABLED_*"')
|
||||
COMMAND_WITH_SHARDING = ({'GTEST_SHARD_INDEX': '1', 'GTEST_TOTAL_SHARDS': '2'},
|
||||
PROGRAM_PATH +
|
||||
' --gtest_internal_skip_environment_and_ad_hoc_tests '
|
||||
' --gtest_filter="PassingTest.*"')
|
||||
|
||||
GOLDEN_PATH = os.path.join(gtest_test_utils.GetSourceDir(),
|
||||
GOLDEN_NAME)
|
||||
|
||||
|
||||
def ToUnixLineEnding(s):
|
||||
"""Changes all Windows/Mac line endings in s to UNIX line endings."""
|
||||
|
||||
@@ -128,19 +140,26 @@ def NormalizeOutput(output):
|
||||
return output
|
||||
|
||||
|
||||
def IterShellCommandOutput(cmd, stdin_string=None):
|
||||
def IterShellCommandOutput(env_cmd, stdin_string=None):
|
||||
"""Runs a command in a sub-process, and iterates the lines in its STDOUT.
|
||||
|
||||
Args:
|
||||
|
||||
cmd: The shell command.
|
||||
stdin_string: The string to be fed to the STDIN of the sub-process;
|
||||
If None, the sub-process will inherit the STDIN
|
||||
from the parent process.
|
||||
env_cmd: The shell command. A 2-tuple where element 0 is a dict
|
||||
of extra environment variables to set, and element 1
|
||||
is a string with the command and any flags.
|
||||
stdin_string: The string to be fed to the STDIN of the sub-process;
|
||||
If None, the sub-process will inherit the STDIN
|
||||
from the parent process.
|
||||
"""
|
||||
|
||||
# Spawns cmd in a sub-process, and gets its standard I/O file objects.
|
||||
stdin_file, stdout_file = os.popen2(cmd, 'b')
|
||||
# Set and save the environment properly.
|
||||
old_env_vars = dict(os.environ)
|
||||
os.environ.update(env_cmd[0])
|
||||
stdin_file, stdout_file = os.popen2(env_cmd[1], 'b')
|
||||
os.environ.clear()
|
||||
os.environ.update(old_env_vars)
|
||||
|
||||
# If the caller didn't specify a string for STDIN, gets it from the
|
||||
# parent process.
|
||||
@@ -160,38 +179,50 @@ def IterShellCommandOutput(cmd, stdin_string=None):
|
||||
yield line
|
||||
|
||||
|
||||
def GetShellCommandOutput(cmd, stdin_string=None):
|
||||
def GetShellCommandOutput(env_cmd, stdin_string=None):
|
||||
"""Runs a command in a sub-process, and returns its STDOUT in a string.
|
||||
|
||||
Args:
|
||||
|
||||
cmd: The shell command.
|
||||
stdin_string: The string to be fed to the STDIN of the sub-process;
|
||||
If None, the sub-process will inherit the STDIN
|
||||
from the parent process.
|
||||
env_cmd: The shell command. A 2-tuple where element 0 is a dict
|
||||
of extra environment variables to set, and element 1
|
||||
is a string with the command and any flags.
|
||||
stdin_string: The string to be fed to the STDIN of the sub-process;
|
||||
If None, the sub-process will inherit the STDIN
|
||||
from the parent process.
|
||||
"""
|
||||
|
||||
lines = list(IterShellCommandOutput(cmd, stdin_string))
|
||||
lines = list(IterShellCommandOutput(env_cmd, stdin_string))
|
||||
return string.join(lines, '')
|
||||
|
||||
|
||||
def GetCommandOutput(cmd):
|
||||
def GetCommandOutput(env_cmd):
|
||||
"""Runs a command and returns its output with all file location
|
||||
info stripped off.
|
||||
|
||||
Args:
|
||||
cmd: the shell command.
|
||||
env_cmd: The shell command. A 2-tuple where element 0 is a dict of extra
|
||||
environment variables to set, and element 1 is a string with
|
||||
the command and any flags.
|
||||
"""
|
||||
|
||||
# Disables exception pop-ups on Windows.
|
||||
os.environ['GTEST_CATCH_EXCEPTIONS'] = '1'
|
||||
return NormalizeOutput(GetShellCommandOutput(cmd, ''))
|
||||
return NormalizeOutput(GetShellCommandOutput(env_cmd, ''))
|
||||
|
||||
|
||||
def GetOutputOfAllCommands():
|
||||
"""Returns concatenated output from several representative commands."""
|
||||
|
||||
return (GetCommandOutput(COMMAND_WITH_COLOR) +
|
||||
GetCommandOutput(COMMAND_WITH_TIME) +
|
||||
GetCommandOutput(COMMAND_WITH_DISABLED) +
|
||||
GetCommandOutput(COMMAND_WITH_SHARDING))
|
||||
|
||||
|
||||
class GTestOutputTest(unittest.TestCase):
|
||||
def testOutput(self):
|
||||
output = (GetCommandOutput(COMMAND_WITH_COLOR) +
|
||||
GetCommandOutput(COMMAND_WITH_TIME))
|
||||
output = GetOutputOfAllCommands()
|
||||
golden_file = open(GOLDEN_PATH, 'rb')
|
||||
golden = golden_file.read()
|
||||
golden_file.close()
|
||||
@@ -205,8 +236,7 @@ class GTestOutputTest(unittest.TestCase):
|
||||
|
||||
if __name__ == '__main__':
|
||||
if sys.argv[1:] == [GENGOLDEN_FLAG]:
|
||||
output = (GetCommandOutput(COMMAND_WITH_COLOR) +
|
||||
GetCommandOutput(COMMAND_WITH_TIME))
|
||||
output = GetOutputOfAllCommands()
|
||||
golden_file = open(GOLDEN_PATH, 'wb')
|
||||
golden_file.write(output)
|
||||
golden_file.close()
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include <pthread.h>
|
||||
#endif // GTEST_HAS_PTHREAD
|
||||
|
||||
#ifdef GTEST_OS_LINUX
|
||||
#if GTEST_OS_LINUX
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <string>
|
||||
@@ -60,6 +60,8 @@
|
||||
using testing::ScopedFakeTestPartResultReporter;
|
||||
using testing::TestPartResultArray;
|
||||
|
||||
using testing::internal::String;
|
||||
|
||||
// Tests catching fatal failures.
|
||||
|
||||
// A subroutine used by the following test.
|
||||
@@ -83,6 +85,12 @@ void TryTestSubroutine() {
|
||||
FAIL() << "This should never be reached.";
|
||||
}
|
||||
|
||||
TEST(PassingTest, PassingTest1) {
|
||||
}
|
||||
|
||||
TEST(PassingTest, PassingTest2) {
|
||||
}
|
||||
|
||||
// Tests catching a fatal failure in a subroutine.
|
||||
TEST(FatalFailureTest, FatalFailureInSubroutine) {
|
||||
printf("(expecting a failure that x should be 1)\n");
|
||||
@@ -212,6 +220,14 @@ TEST(SCOPED_TRACETest, CanBeRepeated) {
|
||||
<< "trace point A, B, and D.";
|
||||
}
|
||||
|
||||
TEST(DisabledTestsWarningTest,
|
||||
DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning) {
|
||||
// This test body is intentionally empty. Its sole purpose is for
|
||||
// verifying that the --gtest_also_run_disabled_tests flag
|
||||
// suppresses the "YOU HAVE 12 DISABLED TESTS" warning at the end of
|
||||
// the test output.
|
||||
}
|
||||
|
||||
// Tests using assertions outside of TEST and TEST_F.
|
||||
//
|
||||
// This function creates two failures intentionally.
|
||||
@@ -339,7 +355,7 @@ TEST_F(FatalFailureInSetUpTest, FailureInSetUp) {
|
||||
<< "We should never get here, as SetUp() failed.";
|
||||
}
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
// This group of tests verifies that Google Test handles SEH and C++
|
||||
// exceptions correctly.
|
||||
@@ -706,7 +722,7 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
|
||||
#endif // GTEST_HAS_EXCEPTIONS
|
||||
|
||||
// This #ifdef block tests the output of typed tests.
|
||||
#ifdef GTEST_HAS_TYPED_TEST
|
||||
#if GTEST_HAS_TYPED_TEST
|
||||
|
||||
template <typename T>
|
||||
class TypedTest : public testing::Test {
|
||||
@@ -725,7 +741,7 @@ TYPED_TEST(TypedTest, Failure) {
|
||||
#endif // GTEST_HAS_TYPED_TEST
|
||||
|
||||
// This #ifdef block tests the output of type-parameterized tests.
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
template <typename T>
|
||||
class TypedTestP : public testing::Test {
|
||||
@@ -748,7 +764,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
|
||||
|
||||
#endif // GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// We rely on the golden file to verify that tests whose test case
|
||||
// name ends with DeathTest are run first.
|
||||
@@ -756,7 +772,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
|
||||
TEST(ADeathTest, ShouldRunFirst) {
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST
|
||||
#if GTEST_HAS_TYPED_TEST
|
||||
|
||||
// We rely on the golden file to verify that typed tests whose test
|
||||
// case name ends with DeathTest are run first.
|
||||
@@ -773,7 +789,7 @@ TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
|
||||
|
||||
#endif // GTEST_HAS_TYPED_TEST
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
|
||||
// We rely on the golden file to verify that type-parameterized tests
|
||||
@@ -950,6 +966,10 @@ class BarEnvironment : public testing::Environment {
|
||||
}
|
||||
};
|
||||
|
||||
GTEST_DEFINE_bool_(internal_skip_environment_and_ad_hoc_tests, false,
|
||||
"This flag causes the program to skip test environment "
|
||||
"tests and ad hoc tests.");
|
||||
|
||||
// The main function.
|
||||
//
|
||||
// The idea is to use Google Test to run all the tests we have defined (some
|
||||
@@ -960,16 +980,33 @@ int main(int argc, char **argv) {
|
||||
// We will use a separate Python script to compare the output of
|
||||
// this program with the golden file.
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
if (argc >= 2 &&
|
||||
String(argv[1]) == "--gtest_internal_skip_environment_and_ad_hoc_tests")
|
||||
GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests) = true;
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
if (testing::internal::GTEST_FLAG(internal_run_death_test) != "") {
|
||||
// Skip the usual output capturing if we're running as the child
|
||||
// process of an threadsafe-style death test.
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
#endif // _MSC_VER
|
||||
freopen("nul:", "w", stdout);
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
#else
|
||||
freopen("/dev/null", "w", stdout);
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
if (GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests))
|
||||
return RUN_ALL_TESTS();
|
||||
|
||||
// Registers two global test environments.
|
||||
// The golden file verifies that they are set up in the order they
|
||||
// are registered, and torn down in the reverse order.
|
||||
|
||||
@@ -7,7 +7,7 @@ Expected: true
|
||||
gtest_output_test_.cc:#: Failure
|
||||
Value of: 3
|
||||
Expected: 2
|
||||
[0;32m[==========] [mRunning 52 tests from 22 test cases.
|
||||
[0;32m[==========] [mRunning 56 tests from 23 test cases.
|
||||
[0;32m[----------] [mGlobal test environment set-up.
|
||||
FooEnvironment::SetUp() called.
|
||||
BarEnvironment::SetUp() called.
|
||||
@@ -26,6 +26,11 @@ BarEnvironment::SetUp() called.
|
||||
[0;32m[----------] [m1 test from My/ATypeParamDeathTest/1, where TypeParam = double
|
||||
[0;32m[ RUN ] [mMy/ATypeParamDeathTest/1.ShouldRunFirst
|
||||
[0;32m[ OK ] [mMy/ATypeParamDeathTest/1.ShouldRunFirst
|
||||
[0;32m[----------] [m2 tests from PassingTest
|
||||
[0;32m[ RUN ] [mPassingTest.PassingTest1
|
||||
[0;32m[ OK ] [mPassingTest.PassingTest1
|
||||
[0;32m[ RUN ] [mPassingTest.PassingTest2
|
||||
[0;32m[ OK ] [mPassingTest.PassingTest2
|
||||
[0;32m[----------] [m3 tests from FatalFailureTest
|
||||
[0;32m[ RUN ] [mFatalFailureTest.FatalFailureInSubroutine
|
||||
(expecting a failure that x should be 1)
|
||||
@@ -270,7 +275,7 @@ test DefinedUsingTEST is defined using TEST. You probably
|
||||
want to change the TEST to TEST_F or move it to another test
|
||||
case.
|
||||
[0;31m[ FAILED ] [mTEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
|
||||
[0;32m[----------] [m7 tests from ExpectNonfatalFailureTest
|
||||
[0;32m[----------] [m8 tests from ExpectNonfatalFailureTest
|
||||
[0;32m[ RUN ] [mExpectNonfatalFailureTest.CanReferenceGlobalVariables
|
||||
[0;32m[ OK ] [mExpectNonfatalFailureTest.CanReferenceGlobalVariables
|
||||
[0;32m[ RUN ] [mExpectNonfatalFailureTest.CanReferenceLocalVariables
|
||||
@@ -313,7 +318,13 @@ gtest.cc:#: Failure
|
||||
Expected: 1 non-fatal failure
|
||||
Actual: 0 failures
|
||||
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenStatementReturns
|
||||
[0;32m[----------] [m7 tests from ExpectFatalFailureTest
|
||||
[0;32m[ RUN ] [mExpectNonfatalFailureTest.FailsWhenStatementThrows
|
||||
(expecting a failure)
|
||||
gtest.cc:#: Failure
|
||||
Expected: 1 non-fatal failure
|
||||
Actual: 0 failures
|
||||
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenStatementThrows
|
||||
[0;32m[----------] [m8 tests from ExpectFatalFailureTest
|
||||
[0;32m[ RUN ] [mExpectFatalFailureTest.CanReferenceGlobalVariables
|
||||
[0;32m[ OK ] [mExpectFatalFailureTest.CanReferenceGlobalVariables
|
||||
[0;32m[ RUN ] [mExpectFatalFailureTest.CanReferenceLocalStaticVariables
|
||||
@@ -356,6 +367,12 @@ gtest.cc:#: Failure
|
||||
Expected: 1 fatal failure
|
||||
Actual: 0 failures
|
||||
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementReturns
|
||||
[0;32m[ RUN ] [mExpectFatalFailureTest.FailsWhenStatementThrows
|
||||
(expecting a failure)
|
||||
gtest.cc:#: Failure
|
||||
Expected: 1 fatal failure
|
||||
Actual: 0 failures
|
||||
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementThrows
|
||||
[0;32m[----------] [m2 tests from TypedTest/0, where TypeParam = int
|
||||
[0;32m[ RUN ] [mTypedTest/0.Success
|
||||
[0;32m[ OK ] [mTypedTest/0.Success
|
||||
@@ -496,9 +513,9 @@ FooEnvironment::TearDown() called.
|
||||
gtest_output_test_.cc:#: Failure
|
||||
Failed
|
||||
Expected fatal failure.
|
||||
[0;32m[==========] [m52 tests from 22 test cases ran.
|
||||
[0;32m[ PASSED ] [m19 tests.
|
||||
[0;31m[ FAILED ] [m33 tests, listed below:
|
||||
[0;32m[==========] [m56 tests from 23 test cases ran.
|
||||
[0;32m[ PASSED ] [m21 tests.
|
||||
[0;31m[ FAILED ] [m35 tests, listed below:
|
||||
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInSubroutine
|
||||
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInNestedSubroutine
|
||||
[0;31m[ FAILED ] [mFatalFailureTest.NonfatalFailureInSubroutine
|
||||
@@ -521,10 +538,12 @@ Expected fatal failure.
|
||||
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
|
||||
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
|
||||
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenStatementReturns
|
||||
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenStatementThrows
|
||||
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
|
||||
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
|
||||
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
|
||||
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementReturns
|
||||
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementThrows
|
||||
[0;31m[ FAILED ] [mTypedTest/0.Failure, where TypeParam = int
|
||||
[0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
|
||||
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
|
||||
@@ -533,21 +552,12 @@ Expected fatal failure.
|
||||
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads
|
||||
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailureOnAllThreads
|
||||
|
||||
33 FAILED TESTS
|
||||
The non-test part of the code is expected to have 2 failures.
|
||||
35 FAILED TESTS
|
||||
[0;33m YOU HAVE 1 DISABLED TEST
|
||||
|
||||
gtest_output_test_.cc:#: Failure
|
||||
Value of: false
|
||||
Actual: false
|
||||
Expected: true
|
||||
gtest_output_test_.cc:#: Failure
|
||||
Value of: 3
|
||||
Expected: 2
|
||||
Note: Google Test filter = FatalFailureTest.*:LoggingTest.*
|
||||
[mNote: Google Test filter = FatalFailureTest.*:LoggingTest.*
|
||||
[==========] Running 4 tests from 2 test cases.
|
||||
[----------] Global test environment set-up.
|
||||
FooEnvironment::SetUp() called.
|
||||
BarEnvironment::SetUp() called.
|
||||
[----------] 3 tests from FatalFailureTest
|
||||
[ RUN ] FatalFailureTest.FatalFailureInSubroutine
|
||||
(expecting a failure that x should be 1)
|
||||
@@ -587,14 +597,6 @@ Expected: (3) >= (a[i]), actual: 3 vs 6
|
||||
[----------] 1 test from LoggingTest (? ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
BarEnvironment::TearDown() called.
|
||||
gtest_output_test_.cc:#: Failure
|
||||
Failed
|
||||
Expected non-fatal failure.
|
||||
FooEnvironment::TearDown() called.
|
||||
gtest_output_test_.cc:#: Failure
|
||||
Failed
|
||||
Expected fatal failure.
|
||||
[==========] 4 tests from 2 test cases ran. (? ms total)
|
||||
[ PASSED ] 0 tests.
|
||||
[ FAILED ] 4 tests, listed below:
|
||||
@@ -604,3 +606,27 @@ Expected fatal failure.
|
||||
[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
|
||||
|
||||
4 FAILED TESTS
|
||||
YOU HAVE 1 DISABLED TEST
|
||||
|
||||
Note: Google Test filter = *DISABLED_*
|
||||
[==========] Running 1 test from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 1 test from DisabledTestsWarningTest
|
||||
[ RUN ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
|
||||
[ OK ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 1 test from 1 test case ran.
|
||||
[ PASSED ] 1 test.
|
||||
Note: Google Test filter = PassingTest.*
|
||||
Note: This is test shard 1 of 2.
|
||||
[==========] Running 1 test from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 1 test from PassingTest
|
||||
[ RUN ] PassingTest.PassingTest2
|
||||
[ OK ] PassingTest.PassingTest2
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 1 test from 1 test case ran.
|
||||
[ PASSED ] 1 test.
|
||||
|
||||
YOU HAVE 1 DISABLED TEST
|
||||
|
||||
|
||||
@@ -5,10 +5,30 @@ gtest_output_test_.cc:#: error: Value of: false
|
||||
Expected: true
|
||||
gtest_output_test_.cc:#: error: Value of: 3
|
||||
Expected: 2
|
||||
[==========] Running 50 tests from 20 test cases.
|
||||
[==========] Running 57 tests from 26 test cases.
|
||||
[----------] Global test environment set-up.
|
||||
FooEnvironment::SetUp() called.
|
||||
BarEnvironment::SetUp() called.
|
||||
[----------] 1 test from ADeathTest
|
||||
[ RUN ] ADeathTest.ShouldRunFirst
|
||||
[ OK ] ADeathTest.ShouldRunFirst
|
||||
[----------] 1 test from ATypedDeathTest/0, where TypeParam = int
|
||||
[ RUN ] ATypedDeathTest/0.ShouldRunFirst
|
||||
[ OK ] ATypedDeathTest/0.ShouldRunFirst
|
||||
[----------] 1 test from ATypedDeathTest/1, where TypeParam = double
|
||||
[ RUN ] ATypedDeathTest/1.ShouldRunFirst
|
||||
[ OK ] ATypedDeathTest/1.ShouldRunFirst
|
||||
[----------] 1 test from My/ATypeParamDeathTest/0, where TypeParam = int
|
||||
[ RUN ] My/ATypeParamDeathTest/0.ShouldRunFirst
|
||||
[ OK ] My/ATypeParamDeathTest/0.ShouldRunFirst
|
||||
[----------] 1 test from My/ATypeParamDeathTest/1, where TypeParam = double
|
||||
[ RUN ] My/ATypeParamDeathTest/1.ShouldRunFirst
|
||||
[ OK ] My/ATypeParamDeathTest/1.ShouldRunFirst
|
||||
[----------] 2 tests from PassingTest
|
||||
[ RUN ] PassingTest.PassingTest1
|
||||
[ OK ] PassingTest.PassingTest1
|
||||
[ RUN ] PassingTest.PassingTest2
|
||||
[ OK ] PassingTest.PassingTest2
|
||||
[----------] 3 tests from FatalFailureTest
|
||||
[ RUN ] FatalFailureTest.FatalFailureInSubroutine
|
||||
(expecting a failure that x should be 1)
|
||||
@@ -440,8 +460,8 @@ Expected non-fatal failure.
|
||||
FooEnvironment::TearDown() called.
|
||||
gtest_output_test_.cc:#: error: Failed
|
||||
Expected fatal failure.
|
||||
[==========] 50 tests from 20 test cases ran.
|
||||
[ PASSED ] 14 tests.
|
||||
[==========] 57 tests from 26 test cases ran.
|
||||
[ PASSED ] 21 tests.
|
||||
[ FAILED ] 36 tests, listed below:
|
||||
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
|
||||
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
|
||||
@@ -481,18 +501,11 @@ Expected fatal failure.
|
||||
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
|
||||
|
||||
36 FAILED TESTS
|
||||
The non-test part of the code is expected to have 2 failures.
|
||||
YOU HAVE 1 DISABLED TEST
|
||||
|
||||
gtest_output_test_.cc:#: error: Value of: false
|
||||
Actual: false
|
||||
Expected: true
|
||||
gtest_output_test_.cc:#: error: Value of: 3
|
||||
Expected: 2
|
||||
Note: Google Test filter = FatalFailureTest.*:LoggingTest.*
|
||||
[==========] Running 4 tests from 2 test cases.
|
||||
[----------] Global test environment set-up.
|
||||
FooEnvironment::SetUp() called.
|
||||
BarEnvironment::SetUp() called.
|
||||
[----------] 3 tests from FatalFailureTest
|
||||
[ RUN ] FatalFailureTest.FatalFailureInSubroutine
|
||||
(expecting a failure that x should be 1)
|
||||
@@ -527,12 +540,6 @@ gtest_output_test_.cc:#: error: Expected: (3) >= (a[i]), actual: 3 vs 6
|
||||
[----------] 1 test from LoggingTest (? ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
BarEnvironment::TearDown() called.
|
||||
gtest_output_test_.cc:#: error: Failed
|
||||
Expected non-fatal failure.
|
||||
FooEnvironment::TearDown() called.
|
||||
gtest_output_test_.cc:#: error: Failed
|
||||
Expected fatal failure.
|
||||
[==========] 4 tests from 2 test cases ran. (? ms total)
|
||||
[ PASSED ] 0 tests.
|
||||
[ FAILED ] 4 tests, listed below:
|
||||
@@ -542,3 +549,27 @@ Expected fatal failure.
|
||||
[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
|
||||
|
||||
4 FAILED TESTS
|
||||
YOU HAVE 1 DISABLED TEST
|
||||
|
||||
Note: Google Test filter = *DISABLED_*
|
||||
[==========] Running 1 test from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 1 test from DisabledTestsWarningTest
|
||||
[ RUN ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
|
||||
[ OK ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 1 test from 1 test case ran.
|
||||
[ PASSED ] 1 test.
|
||||
Note: Google Test filter = PassingTest.*
|
||||
Note: This is test shard 1 of 2.
|
||||
[==========] Running 1 test from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 1 test from PassingTest
|
||||
[ RUN ] PassingTest.PassingTest2
|
||||
[ OK ] PassingTest.PassingTest2
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 1 test from 1 test case ran.
|
||||
[ PASSED ] 1 test.
|
||||
|
||||
YOU HAVE 1 DISABLED TEST
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
// included, or there will be a compiler error. This trick is to
|
||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||
// his code.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
namespace testing {
|
||||
|
||||
@@ -112,7 +112,7 @@ int g_death_test_count = 0;
|
||||
TEST(BarDeathTest, ThreadSafeAndFast) {
|
||||
g_death_test_count++;
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
GTEST_FLAG(death_test_style) = "threadsafe";
|
||||
EXPECT_DEATH(abort(), "");
|
||||
|
||||
@@ -121,7 +121,7 @@ TEST(BarDeathTest, ThreadSafeAndFast) {
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
int g_param_test_count = 0;
|
||||
|
||||
const int kNumberOfParamTests = 10;
|
||||
@@ -146,7 +146,7 @@ void ResetCounts() {
|
||||
g_should_fail_count = 0;
|
||||
g_should_pass_count = 0;
|
||||
g_death_test_count = 0;
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
g_param_test_count = 0;
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
}
|
||||
@@ -158,7 +158,7 @@ void CheckCounts(int expected) {
|
||||
GTEST_CHECK_INT_EQ_(expected, g_should_fail_count);
|
||||
GTEST_CHECK_INT_EQ_(expected, g_should_pass_count);
|
||||
GTEST_CHECK_INT_EQ_(expected, g_death_test_count);
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count);
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
}
|
||||
@@ -203,7 +203,7 @@ void TestRepeatWithFilterForSuccessfulTests(int repeat) {
|
||||
GTEST_CHECK_INT_EQ_(0, g_should_fail_count);
|
||||
GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count);
|
||||
GTEST_CHECK_INT_EQ_(repeat, g_death_test_count);
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count);
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
}
|
||||
@@ -221,7 +221,7 @@ void TestRepeatWithFilterForFailedTests(int repeat) {
|
||||
GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count);
|
||||
GTEST_CHECK_INT_EQ_(0, g_should_pass_count);
|
||||
GTEST_CHECK_INT_EQ_(0, g_death_test_count);
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
GTEST_CHECK_INT_EQ_(0, g_param_test_count);
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
// We must define this macro in order to #include
|
||||
// gtest-internal-inl.h. This is how Google Test prevents a user from
|
||||
// accidentally depending on its internal implementation.
|
||||
#define GTEST_IMPLEMENTATION
|
||||
#define GTEST_IMPLEMENTATION_ 1
|
||||
#include "src/gtest-internal-inl.h"
|
||||
#undef GTEST_IMPLEMENTATION
|
||||
#undef GTEST_IMPLEMENTATION_
|
||||
|
||||
namespace testing {
|
||||
namespace {
|
||||
|
||||
@@ -124,7 +124,7 @@ def GetExitStatus(exit_code):
|
||||
|
||||
|
||||
class Subprocess:
|
||||
def __init__(this, command, working_dir=None):
|
||||
def __init__(self, command, working_dir=None):
|
||||
"""Changes into a specified directory, if provided, and executes a command.
|
||||
Restores the old directory afterwards. Execution results are returned
|
||||
via the following attributes:
|
||||
@@ -137,7 +137,7 @@ class Subprocess:
|
||||
combined in a string.
|
||||
|
||||
Args:
|
||||
command: A command to run.
|
||||
command: A command to run, in the form of sys.argv.
|
||||
working_dir: A directory to change into.
|
||||
"""
|
||||
|
||||
@@ -154,8 +154,8 @@ class Subprocess:
|
||||
cwd=working_dir, universal_newlines=True)
|
||||
# communicate returns a tuple with the file obect for the child's
|
||||
# output.
|
||||
this.output = p.communicate()[0]
|
||||
this._return_code = p.returncode
|
||||
self.output = p.communicate()[0]
|
||||
self._return_code = p.returncode
|
||||
else:
|
||||
old_dir = os.getcwd()
|
||||
try:
|
||||
@@ -163,25 +163,25 @@ class Subprocess:
|
||||
os.chdir(working_dir)
|
||||
p = popen2.Popen4(command)
|
||||
p.tochild.close()
|
||||
this.output = p.fromchild.read()
|
||||
self.output = p.fromchild.read()
|
||||
ret_code = p.wait()
|
||||
finally:
|
||||
os.chdir(old_dir)
|
||||
# Converts ret_code to match the semantics of
|
||||
# subprocess.Popen.returncode.
|
||||
if os.WIFSIGNALED(ret_code):
|
||||
this._return_code = -os.WTERMSIG(ret_code)
|
||||
self._return_code = -os.WTERMSIG(ret_code)
|
||||
else: # os.WIFEXITED(ret_code) should return True here.
|
||||
this._return_code = os.WEXITSTATUS(ret_code)
|
||||
self._return_code = os.WEXITSTATUS(ret_code)
|
||||
|
||||
if this._return_code < 0:
|
||||
this.terminated_by_signal = True
|
||||
this.exited = False
|
||||
this.signal = -this._return_code
|
||||
if self._return_code < 0:
|
||||
self.terminated_by_signal = True
|
||||
self.exited = False
|
||||
self.signal = -self._return_code
|
||||
else:
|
||||
this.terminated_by_signal = False
|
||||
this.exited = True
|
||||
this.exit_code = this._return_code
|
||||
self.terminated_by_signal = False
|
||||
self.exited = True
|
||||
self.exit_code = self._return_code
|
||||
|
||||
|
||||
def Main():
|
||||
|
||||
92
test/gtest_throw_on_failure_ex_test.cc
Normal file
92
test/gtest_throw_on_failure_ex_test.cc
Normal file
@@ -0,0 +1,92 @@
|
||||
// Copyright 2009, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Author: wan@google.com (Zhanyong Wan)
|
||||
|
||||
// Tests Google Test's throw-on-failure mode with exceptions enabled.
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdexcept>
|
||||
|
||||
// Prints the given failure message and exits the program with
|
||||
// non-zero. We use this instead of a Google Test assertion to
|
||||
// indicate a failure, as the latter is been tested and cannot be
|
||||
// relied on.
|
||||
void Fail(const char* msg) {
|
||||
printf("FAILURE: %s\n", msg);
|
||||
fflush(stdout);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Tests that an assertion failure throws a subclass of
|
||||
// std::runtime_error.
|
||||
void TestFailureThrowsRuntimeError() {
|
||||
testing::GTEST_FLAG(throw_on_failure) = true;
|
||||
|
||||
// A successful assertion shouldn't throw.
|
||||
try {
|
||||
EXPECT_EQ(3, 3);
|
||||
} catch(...) {
|
||||
Fail("A successful assertion wrongfully threw.");
|
||||
}
|
||||
|
||||
// A failed assertion should throw a subclass of std::runtime_error.
|
||||
try {
|
||||
EXPECT_EQ(2, 3) << "Expected failure";
|
||||
} catch(const std::runtime_error& e) {
|
||||
if (strstr(e.what(), "Expected failure") != NULL)
|
||||
return;
|
||||
|
||||
printf("%s",
|
||||
"A failed assertion did throw an exception of the right type, "
|
||||
"but the message is incorrect. Instead of containing \"Expected "
|
||||
"failure\", it is:\n");
|
||||
Fail(e.what());
|
||||
} catch(...) {
|
||||
Fail("A failed assertion threw the wrong type of exception.");
|
||||
}
|
||||
Fail("A failed assertion should've thrown but didn't.");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
// We want to ensure that people can use Google Test assertions in
|
||||
// other testing frameworks, as long as they initialize Google Test
|
||||
// properly and set the thrown-on-failure mode. Therefore, we don't
|
||||
// use Google Test's constructs for defining and running tests
|
||||
// (e.g. TEST and RUN_ALL_TESTS) here.
|
||||
|
||||
TestFailureThrowsRuntimeError();
|
||||
return 0;
|
||||
}
|
||||
171
test/gtest_throw_on_failure_test.py
Executable file
171
test/gtest_throw_on_failure_test.py
Executable file
@@ -0,0 +1,171 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2009, Google Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
"""Tests Google Test's throw-on-failure mode with exceptions disabled.
|
||||
|
||||
This script invokes gtest_throw_on_failure_test_ (a program written with
|
||||
Google Test) with different environments and command line flags.
|
||||
"""
|
||||
|
||||
__author__ = 'wan@google.com (Zhanyong Wan)'
|
||||
|
||||
import gtest_test_utils
|
||||
import os
|
||||
import unittest
|
||||
|
||||
|
||||
# Constants.
|
||||
|
||||
# The command line flag for enabling/disabling the throw-on-failure mode.
|
||||
THROW_ON_FAILURE = 'gtest_throw_on_failure'
|
||||
|
||||
# Path to the gtest_throw_on_failure_test_ program, compiled with
|
||||
# exceptions disabled.
|
||||
EXE_PATH = os.path.join(gtest_test_utils.GetBuildDir(),
|
||||
'gtest_throw_on_failure_test_')
|
||||
|
||||
|
||||
# Utilities.
|
||||
|
||||
|
||||
def SetEnvVar(env_var, value):
|
||||
"""Sets an environment variable to a given value; unsets it when the
|
||||
given value is None.
|
||||
"""
|
||||
|
||||
env_var = env_var.upper()
|
||||
if value is not None:
|
||||
os.environ[env_var] = value
|
||||
elif env_var in os.environ:
|
||||
del os.environ[env_var]
|
||||
|
||||
|
||||
def Run(command):
|
||||
"""Runs a command; returns True/False if its exit code is/isn't 0."""
|
||||
|
||||
print 'Running "%s". . .' % ' '.join(command)
|
||||
return gtest_test_utils.Subprocess(command).exit_code == 0
|
||||
|
||||
|
||||
# The tests. TODO(wan@google.com): refactor the class to share common
|
||||
# logic with code in gtest_break_on_failure_unittest.py.
|
||||
class ThrowOnFailureTest(unittest.TestCase):
|
||||
"""Tests the throw-on-failure mode."""
|
||||
|
||||
def RunAndVerify(self, env_var_value, flag_value, should_fail):
|
||||
"""Runs gtest_throw_on_failure_test_ and verifies that it does
|
||||
(or does not) exit with a non-zero code.
|
||||
|
||||
Args:
|
||||
env_var_value: value of the GTEST_BREAK_ON_FAILURE environment
|
||||
variable; None if the variable should be unset.
|
||||
flag_value: value of the --gtest_break_on_failure flag;
|
||||
None if the flag should not be present.
|
||||
should_fail: True iff the program is expected to fail.
|
||||
"""
|
||||
|
||||
SetEnvVar(THROW_ON_FAILURE, env_var_value)
|
||||
|
||||
if env_var_value is None:
|
||||
env_var_value_msg = ' is not set'
|
||||
else:
|
||||
env_var_value_msg = '=' + env_var_value
|
||||
|
||||
if flag_value is None:
|
||||
flag = ''
|
||||
elif flag_value == '0':
|
||||
flag = '--%s=0' % THROW_ON_FAILURE
|
||||
else:
|
||||
flag = '--%s' % THROW_ON_FAILURE
|
||||
|
||||
command = [EXE_PATH]
|
||||
if flag:
|
||||
command.append(flag)
|
||||
|
||||
if should_fail:
|
||||
should_or_not = 'should'
|
||||
else:
|
||||
should_or_not = 'should not'
|
||||
|
||||
failed = not Run(command)
|
||||
|
||||
SetEnvVar(THROW_ON_FAILURE, None)
|
||||
|
||||
msg = ('when %s%s, an assertion failure in "%s" %s cause a non-zero '
|
||||
'exit code.' %
|
||||
(THROW_ON_FAILURE, env_var_value_msg, ' '.join(command),
|
||||
should_or_not))
|
||||
self.assert_(failed == should_fail, msg)
|
||||
|
||||
def testDefaultBehavior(self):
|
||||
"""Tests the behavior of the default mode."""
|
||||
|
||||
self.RunAndVerify(env_var_value=None, flag_value=None, should_fail=False)
|
||||
|
||||
def testThrowOnFailureEnvVar(self):
|
||||
"""Tests using the GTEST_THROW_ON_FAILURE environment variable."""
|
||||
|
||||
self.RunAndVerify(env_var_value='0',
|
||||
flag_value=None,
|
||||
should_fail=False)
|
||||
self.RunAndVerify(env_var_value='1',
|
||||
flag_value=None,
|
||||
should_fail=True)
|
||||
|
||||
def testThrowOnFailureFlag(self):
|
||||
"""Tests using the --gtest_throw_on_failure flag."""
|
||||
|
||||
self.RunAndVerify(env_var_value=None,
|
||||
flag_value='0',
|
||||
should_fail=False)
|
||||
self.RunAndVerify(env_var_value=None,
|
||||
flag_value='1',
|
||||
should_fail=True)
|
||||
|
||||
def testThrowOnFailureFlagOverridesEnvVar(self):
|
||||
"""Tests that --gtest_throw_on_failure overrides GTEST_THROW_ON_FAILURE."""
|
||||
|
||||
self.RunAndVerify(env_var_value='0',
|
||||
flag_value='0',
|
||||
should_fail=False)
|
||||
self.RunAndVerify(env_var_value='0',
|
||||
flag_value='1',
|
||||
should_fail=True)
|
||||
self.RunAndVerify(env_var_value='1',
|
||||
flag_value='0',
|
||||
should_fail=False)
|
||||
self.RunAndVerify(env_var_value='1',
|
||||
flag_value='1',
|
||||
should_fail=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
gtest_test_utils.Main()
|
||||
56
test/gtest_throw_on_failure_test_.cc
Normal file
56
test/gtest_throw_on_failure_test_.cc
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright 2009, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Author: wan@google.com (Zhanyong Wan)
|
||||
|
||||
// Tests Google Test's throw-on-failure mode with exceptions disabled.
|
||||
//
|
||||
// This program must be compiled with exceptions disabled. It will be
|
||||
// invoked by gtest_throw_on_failure_test.py, and is expected to exit
|
||||
// with non-zero in the throw-on-failure mode or 0 otherwise.
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
// We want to ensure that people can use Google Test assertions in
|
||||
// other testing frameworks, as long as they initialize Google Test
|
||||
// properly and set the thrown-on-failure mode. Therefore, we don't
|
||||
// use Google Test's constructs for defining and running tests
|
||||
// (e.g. TEST and RUN_ALL_TESTS) here.
|
||||
|
||||
// In the throw-on-failure mode with exceptions disabled, this
|
||||
// assertion will cause the program to exit with a non-zero code.
|
||||
EXPECT_EQ(2, 3);
|
||||
|
||||
// When not in the throw-on-failure mode, the control will reach
|
||||
// here.
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user