Merge pull request #1418 from gennadiycivil/master

Many code merge/upstream changes
This commit is contained in:
Gennadiy Civil 2018-01-24 14:57:08 -05:00 committed by GitHub
commit 21cf836003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 47 additions and 32 deletions

View File

@ -26,9 +26,9 @@
// 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.
//
#include <stdio.h>
#include "gtest/gtest.h"
GTEST_API_ int main(int argc, char **argv) {

View File

@ -33,7 +33,7 @@
// Google Test work.
#include "gtest/gtest.h"
#include "test/gtest-param-test_test.h"
#include "gtest-param-test_test.h"
using ::testing::Values;
using ::testing::internal::ParamGenerator;

View File

@ -275,11 +275,11 @@ using hash_multiset = ::std::unordered_multiset<Key>;
#elif GTEST_HAS_HASH_SET_
#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport.
using ::std::hash_set;
using ::std::hash_multiset;
using ::std::hash_map;
using ::std::hash_multimap;
#elif _MSC_VER
using ::stdext::hash_set;
using ::stdext::hash_multiset;
using ::stdext::hash_map;
using ::stdext::hash_multimap;
#endif
#endif

View File

@ -31,7 +31,7 @@
#include <vector>
#include "test/gtest-typed-test_test.h"
#include "gtest-typed-test_test.h"
#include "gtest/gtest.h"
#if GTEST_HAS_TYPED_TEST_P

View File

@ -29,7 +29,7 @@
//
// Author: wan@google.com (Zhanyong Wan)
#include "test/gtest-typed-test_test.h"
#include "gtest-typed-test_test.h"
#include <set>
#include <vector>

View File

@ -40,10 +40,8 @@ Google Test) with different environments and command line flags.
__author__ = 'wan@google.com (Zhanyong Wan)'
import gtest_test_utils
import os
import sys
import gtest_test_utils
# Constants.

View File

@ -37,8 +37,6 @@ Google Test) and verifies their output.
__author__ = 'vladl@google.com (Vlad Losev)'
import os
import gtest_test_utils
# Constants.

View File

@ -36,7 +36,7 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
import os
import gtest_test_utils
IS_WINDOWS = os.name = 'nt'
IS_WINDOWS = os.name == 'nt'
COLOR_ENV_VAR = 'GTEST_COLOR'
COLOR_FLAG = 'gtest_color'

View File

@ -47,8 +47,8 @@ environ = os.environ.copy()
def AssertEq(expected, actual):
if expected != actual:
print('Expected: %s' % (expected,))
print(' Actual: %s' % (actual,))
print 'Expected: %s' % (expected,)
print ' Actual: %s' % (actual,)
raise AssertionError

View File

@ -39,9 +39,8 @@ Google Test) the command line flags.
__author__ = 'phanna@google.com (Patrick Hanna)'
import gtest_test_utils
import re
import gtest_test_utils
# Constants.
@ -123,6 +122,7 @@ def Run(args):
# The unit test.
class GTestListTestsUnitTest(gtest_test_utils.TestCase):
"""Tests using the --gtest_list_tests flag to list all tests."""

View File

@ -168,6 +168,16 @@ void SubWithTrace(int n) {
SubWithoutTrace(n);
}
TEST(SCOPED_TRACETest, AcceptedValues) {
SCOPED_TRACE("literal string");
SCOPED_TRACE(std::string("std::string"));
SCOPED_TRACE(1337); // streamable type
const char* null_value = NULL;
SCOPED_TRACE(null_value);
ADD_FAILURE() << "Just checking that all these values work fine.";
}
// Tests that SCOPED_TRACE() obeys lexical scopes.
TEST(SCOPED_TRACETest, ObeysScopes) {
printf("(expected to fail)\n");

View File

@ -8,7 +8,7 @@ gtest_output_test_.cc:#: Failure
Expected equality of these values:
2
3
[==========] Running 67 tests from 30 test cases.
[==========] Running 68 tests from 30 test cases.
[----------] Global test environment set-up.
FooEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
@ -95,7 +95,17 @@ i == 3
gtest_output_test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 6
[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
[----------] 6 tests from SCOPED_TRACETest
[----------] 7 tests from SCOPED_TRACETest
[ RUN ] SCOPED_TRACETest.AcceptedValues
gtest_output_test_.cc:#: Failure
Failed
Just checking that all these values work fine.
Google Test trace:
gtest_output_test_.cc:#: (null)
gtest_output_test_.cc:#: 1337
gtest_output_test_.cc:#: std::string
gtest_output_test_.cc:#: literal string
[ FAILED ] SCOPED_TRACETest.AcceptedValues
[ RUN ] SCOPED_TRACETest.ObeysScopes
(expected to fail)
gtest_output_test_.cc:#: Failure
@ -474,7 +484,7 @@ Expected equality of these values:
Which is: '\0'
Expected failure
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int
[----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned
[ RUN ] Unsigned/TypedTestP/1.Success
[ OK ] Unsigned/TypedTestP/1.Success
[ RUN ] Unsigned/TypedTestP/1.Failure
@ -485,7 +495,7 @@ Expected equality of these values:
TypeParam()
Which is: 0
Expected failure
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned
[----------] 4 tests from ExpectFailureTest
[ RUN ] ExpectFailureTest.ExpectFatalFailure
(expecting 1 failure)
@ -644,15 +654,16 @@ FooEnvironment::TearDown() called.
gtest_output_test_.cc:#: Failure
Failed
Expected fatal failure.
[==========] 67 tests from 30 test cases ran.
[==========] 68 tests from 30 test cases ran.
[ PASSED ] 22 tests.
[ FAILED ] 45 tests, listed below:
[ FAILED ] 46 tests, listed below:
[ FAILED ] NonfatalFailureTest.EscapesStringOperands
[ FAILED ] NonfatalFailureTest.DiffForLongStrings
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
[ FAILED ] SCOPED_TRACETest.AcceptedValues
[ FAILED ] SCOPED_TRACETest.ObeysScopes
[ FAILED ] SCOPED_TRACETest.WorksInLoop
[ FAILED ] SCOPED_TRACETest.WorksInSubroutine
@ -682,7 +693,7 @@ Expected fatal failure.
[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows
[ FAILED ] TypedTest/0.Failure, where TypeParam = int
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned
[ FAILED ] ExpectFailureTest.ExpectFatalFailure
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
@ -693,7 +704,7 @@ Expected fatal failure.
[ FAILED ] PrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
[ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
45 FAILED TESTS
46 FAILED TESTS
 YOU HAVE 1 DISABLED TEST
Note: Google Test filter = FatalFailureTest.*:LoggingTest.*

View File

@ -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.
// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
// This file is AUTOMATICALLY GENERATED on 01/02/2018 by command
// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
// Regression test for gtest_pred_impl.h

View File

@ -29,10 +29,10 @@
//
// Author: wan@google.com (Zhanyong Wan)
//
// Unit test for include/gtest/gtest_prod.h.
// Unit test for gtest/gtest_prod.h.
#include "production.h"
#include "gtest/gtest.h"
#include "test/production.h"
// Tests that private members can be accessed from a TEST declared as
// a friend of the class.

View File

@ -29,11 +29,9 @@
"""Unit test utilities for gtest_xml_output"""
import os
import re
import gtest_test_utils
from xml.dom import minidom, Node
import gtest_test_utils
GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'