diff --git a/run_tests.py b/run_tests.py deleted file mode 100755 index 5e7b308f..00000000 --- a/run_tests.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008, 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. - -"""Runs the specified tests for Google Mock. - -This script requires Python 2.3 or higher. To learn the usage, run it -with -h. -""" - -__author__ = 'vladl@google.com (Vlad Losev)' - - -import os -import sys - -SCRIPT_DIR = os.path.dirname(__file__) or '.' - -# Path to the Google Test code this Google Mock will use. We assume the -# gtest/ directory is either a subdirectory (possibly via a symbolic link) -# of gmock/ or a sibling. -# -# isdir resolves symbolic links. -if os.path.isdir(os.path.join(SCRIPT_DIR, 'gtest/test')): - RUN_TESTS_UTIL_DIR = os.path.join(SCRIPT_DIR, 'gtest/test') -else: - RUN_TESTS_UTIL_DIR = os.path.join(SCRIPT_DIR, '../gtest/test') - -sys.path.append(RUN_TESTS_UTIL_DIR) -import run_tests_util - -def GetGmockBuildDir(injected_os, script_dir, config): - return injected_os.path.normpath(injected_os.path.join(script_dir, - 'scons/build', - config, - 'gmock/scons')) - - -def _Main(): - """Runs all tests for Google Mock.""" - - options, args = run_tests_util.ParseArgs('gtest') - test_runner = run_tests_util.TestRunner( - script_dir=SCRIPT_DIR, - injected_build_dir_finder=GetGmockBuildDir) - tests = test_runner.GetTestsToRun(args, - options.configurations, - options.built_configurations) - if not tests: - sys.exit(1) # Incorrect parameters given, abort execution. - - sys.exit(test_runner.RunTests(tests[0], tests[1])) - -if __name__ == '__main__': - _Main() diff --git a/scons/SConscript b/scons/SConscript deleted file mode 100644 index dedad37d..00000000 --- a/scons/SConscript +++ /dev/null @@ -1,215 +0,0 @@ -# -*- Python -*- -# -# Copyright 2008 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. - - -"""Builds the Google Mock (gmock) lib. - -You should be able to call this file from more or less any SConscript -file. - -You can optionally set a variable on the construction environment to -have the unit test executables copied to your output directory. The -variable should be env['EXE_OUTPUT']. - -Another optional variable is env['LIB_OUTPUT']. If set, the generated -libraries are copied to the folder indicated by the variable. - -If you place the Google Mock sources within your own project's source -directory, you should be able to call this SConscript file simply as -follows: - -# -- cut here -- -# Build gmock library; first tell it where to copy executables. -env['EXE_OUTPUT'] = '#/mybuilddir/mybuildmode' # example, optional -env['LIB_OUTPUT'] = '#/mybuilddir/mybuildmode/lib' -env.SConscript('whateverpath/gmock/scons/SConscript') -# -- cut here -- - -If on the other hand you place the Google Mock sources in a directory -outside of your project's source tree, you would use a snippet similar -to the following: - -# -- cut here -- - -# The following assumes that $BUILD_DIR refers to the root of the -# directory for your current build mode, e.g. "#/mybuilddir/mybuildmode" - -# Build gmock library; as it is outside of our source root, we need to -# tell SCons that the directory it will refer to as -# e.g. $BUILD_DIR/gmock is actually on disk in original form as -# ../../gmock (relative to your project root directory). Recall that -# SCons by default copies all source files into the build directory -# before building. -gmock_dir = env.Dir('$BUILD_DIR/gmock') - -# Modify this part to point to Google Mock relative to the current -# SConscript or SConstruct file's directory. The ../.. path would -# be different per project, to locate the base directory for Google Mock. -gmock_dir.addRepository(env.Dir('../../gmock')) - -# Tell the Google Mock SCons file where to copy executables. -env['EXE_OUTPUT'] = '$BUILD_DIR' # example, optional - -# Call the Google Mock SConscript to build gmock.lib and unit tests. The -# location of the library should end up as -# '$BUILD_DIR/gmock/scons/gmock.lib' -env.SConscript(env.File('scons/SConscript', gmock_dir)) - -# -- cut here -- -""" - - -__author__ = 'joi@google.com (Joi Sigurdsson)' - - -import os - -############################################################ -# Environments for building the targets, sorted by name. - -Import('env', 'gtest_exports') - -GTEST_DIR = env['GTEST_DIR'] - -GtestObject = gtest_exports['GtestObject'] -GtestBinary = gtest_exports['GtestBinary'] -GtestTest = gtest_exports['GtestTest'] - -gtest_common_exports = SConscript(GTEST_DIR + '/scons/SConscript.common') -EnvCreator = gtest_common_exports['EnvCreator'] - -env = env.Clone() -if env['PLATFORM'] == 'win32': - env.Append(CCFLAGS=[ - '-wd4127', # Disables warning "conditional expression is constant", - # triggered by VC 8.0's own STL header . - ]) - -# Note: The relative paths in SConscript files are relative to the location -# of the SConscript file itself. To make a path relative to the location of -# the main SConstruct file, prepend the path with the # sign. -# -# Include paths to gtest headers are relative to either the gmock -# directory or the 'include' subdirectory of it, and this SConscript -# file is one directory deeper than the gmock directory. -env.Prepend(CPPPATH = ['..', '../include', GTEST_DIR + '/include']) - -env_use_own_tuple = EnvCreator.Create(env, EnvCreator.UseOwnTuple) -env_with_exceptions = EnvCreator.Create(env, EnvCreator.WithExceptions) -env_without_rtti = EnvCreator.Create(env, EnvCreator.NoRtti) - -############################################################ -# Helpers for creating build targets. - -def GmockStaticLibraries(build_env): - """Builds static libraries for gmock and gmock_main in build_env. - - Args: - build_env: An environment in which to build libraries. - - Returns: - A pair (gmock_library, gmock_main_library) built in the build_env - environment. - """ - - gmock_object = GtestObject(build_env, '../src/gmock-all.cc') - gmock_main_object = GtestObject(build_env, '../src/gmock_main.cc') - - return (build_env.StaticLibrary(target='gmock' + build_env['OBJ_SUFFIX'], - source=[gmock_object]), - build_env.StaticLibrary(target='gmock_main' + build_env['OBJ_SUFFIX'], - source=[gmock_object, gmock_main_object])) - - -############################################################ -# Object and library targets. - -gtest = gtest_exports['gtest'] -gtest_ex = gtest_exports['gtest_ex'] -gtest_no_rtti = gtest_exports['gtest_no_rtti'] -gtest_use_own_tuple = gtest_exports['gtest_use_own_tuple'] - -# gmock.lib to be used by most apps (if you have your own main function). -# gmock_main.lib can be used if you just want a basic main function; it is -# also used by some tests for Google Test itself. -gmock, gmock_main = GmockStaticLibraries(env) -gmock_ex, gmock_main_ex = GmockStaticLibraries(env_with_exceptions) -gmock_no_rtti, gmock_main_no_rtti = GmockStaticLibraries(env_without_rtti) -gmock_use_own_tuple, gmock_main_use_own_tuple = GmockStaticLibraries( - env_use_own_tuple) - -# Install the libraries if needed. -if 'LIB_OUTPUT' in env.Dictionary(): - env.Install('$LIB_OUTPUT', source=[gmock, gmock_main, - gmock_ex, gmock_main_ex, - gmock_no_rtti, gmock_main_no_rtti, - gmock_use_own_tuple, - gmock_main_use_own_tuple]) - -############################################################# -# Test targets using the standard environment. -GtestTest(env, 'gmock-actions_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-cardinalities_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-generated-actions_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-generated-function-mockers_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-generated-internal-utils_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-generated-matchers_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-internal-utils_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-matchers_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-more-actions_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-nice-strict_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-port_test', [gtest, gmock_main]) -GtestTest(env, 'gmock-spec-builders_test', [gtest, gmock_main]) -GtestTest(env, 'gmock_leak_test_', [gtest, gmock_main]) -GtestTest(env, 'gmock_link_test', [gtest, gmock_main], - ['../test/gmock_link2_test.cc']) -GtestTest(env, 'gmock_output_test_', [gtest, gmock]) -#GtestTest(env, 'gmock_stress_test', [gtest, gmock]) -GtestTest(env, 'gmock_test', [gtest, gmock_main]) -# gmock_all_test is commented to save time building and running tests. -# Uncomment if necessary. -#GtestTest(env, 'gmock_all_test', [gtest, gmock_main]) - -############################################################ -# Tests targets using custom environments. -GtestBinary(env_with_exceptions, - 'gmock-more-actions-ex_test', - [gtest_ex, gmock_main_ex], - ['../test/gmock-more-actions_test.cc']) - -GtestBinary(env_without_rtti, - 'gmock_no_rtti_test', - [gtest_no_rtti, gmock_main_no_rtti], - ['../test/gmock-spec-builders_test.cc']) - -GtestBinary(env_use_own_tuple, - 'gmock_use_own_tuple_test', - [gtest_use_own_tuple, gmock_main_use_own_tuple], - ['../test/gmock-spec-builders_test.cc']) diff --git a/scons/SConstruct b/scons/SConstruct deleted file mode 100644 index 8f67d704..00000000 --- a/scons/SConstruct +++ /dev/null @@ -1,96 +0,0 @@ -# -*- Python -*- -# Copyright 2008 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: joi@google.com (Joi Sigurdsson) -# Author: vladl@google.com (Vlad Losev) -# -# Build file for Google Mock and its tests. -# -# Usage: -# cd to the directory with this file, then -# ./scons.py [OPTIONS] -# -# where frequently used command-line options include: -# -h print usage help. -# BUILD=all build all build types. -# BUILD=win-opt8 build the given build type. - -EnsurePythonVersion(2, 3) - -# Path to the Google Test code this Google Mock will use. -GTEST_DIR = '../gtest' - -# TODO(vladl@google.com): Factor the looping logic out for reuse. -def BuildGMockSelectedEnvironments(sconstruct_helper): - # Build using whichever environments the 'BUILD' option selected - for build_name in sconstruct_helper.env_base['BUILD']: - print 'BUILDING %s' % build_name - env = sconstruct_helper.env_dict[build_name] - - # Make sure SConscript files can refer to base build dir - env['MAIN_DIR'] = env.Dir(env['BUILD_DIR']) - - #print 'CCFLAGS: %s' % env.subst('$CCFLAGS') - #print 'LINK: %s' % env.subst('$LINK') - #print 'AR: %s' % env.subst('$AR') - #print 'CC: %s' % env.subst('$CC') - #print 'CXX: %s' % env.subst('$CXX') - #print 'LIBPATH: %s' % env.subst('$LIBPATH') - #print 'ENV:PATH: %s' % env['ENV']['PATH'] - #print 'ENV:INCLUDE: %s' % env['ENV']['INCLUDE'] - #print 'ENV:LIB: %s' % env['ENV']['LIB'] - #print 'ENV:TEMP: %s' % env['ENV']['TEMP'] - - env['GTEST_DIR'] = '#/' + GTEST_DIR - env['GTEST_BUILD_TESTS'] = False - Export('env') - # Invokes SConscript with variant_dir being build/. - # Counter-intuitively, src_dir is relative to the build dir and has - # to be '../..' to point to the scons directory. - VariantDir(env['BUILD_DIR'], '../..', duplicate=0) - gtest_exports = env.SConscript(env['BUILD_DIR'] + '/gtest/scons/SConscript') - Export('gtest_exports') - SConscript('SConscript', - src_dir='../..', - variant_dir=env['BUILD_DIR'], - duplicate=0) - -sconstruct_helper = SConscript(GTEST_DIR + '/scons/SConstruct.common') - -sconstruct_helper.Initialize(build_root_path='..', - support_multiple_win_builds=False) - -win_base = sconstruct_helper.MakeWinBaseEnvironment() - -sconstruct_helper.MakeWinDebugEnvironment(win_base, 'win-dbg8') -sconstruct_helper.MakeWinOptimizedEnvironment(win_base, 'win-opt8') - -sconstruct_helper.ConfigureGccEnvironments() - -BuildGMockSelectedEnvironments(sconstruct_helper) diff --git a/test/gmock-generated-matchers_test.cc b/test/gmock-generated-matchers_test.cc index 3a028040..600783c7 100644 --- a/test/gmock-generated-matchers_test.cc +++ b/test/gmock-generated-matchers_test.cc @@ -243,7 +243,7 @@ Matcher > LessThan() { TEST(ArgsTest, ExplainsMatchResultWithInnerExplanation) { const Matcher > m = Args<0, 2>(LessThan()); - EXPECT_EQ("whose fields (#0, #2) are ('a' (97), 42), " + EXPECT_EQ("whose fields (#0, #2) are ('a' (97, 0x61), 42), " "where the first value is 55 more than the second", Explain(m, make_tuple('a', 42, 42))); EXPECT_EQ("whose fields (#0, #2) are ('\\0', 43)", diff --git a/test/gmock-matchers_test.cc b/test/gmock-matchers_test.cc index f7a49c34..c2db86ca 100644 --- a/test/gmock-matchers_test.cc +++ b/test/gmock-matchers_test.cc @@ -3751,8 +3751,8 @@ TEST(MatcherTupleTest, ExplainsMatchFailure) { make_tuple(2, 'b'), &ss2); EXPECT_EQ(" Expected arg #0: is > 5\n" " Actual: 2, which is 3 less than 5\n" - " Expected arg #1: is equal to 'a' (97)\n" - " Actual: 'b' (98)\n", + " Expected arg #1: is equal to 'a' (97, 0x61)\n" + " Actual: 'b' (98, 0x62)\n", ss2.str()); // Failed match where both arguments need explanation. stringstream ss3;