diff options
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/cmake/gmock.pc.in | 2 | ||||
-rw-r--r-- | googlemock/cmake/gmock_main.pc.in | 2 | ||||
-rw-r--r-- | googlemock/docs/pump_manual.md | 21 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 2 | ||||
-rwxr-xr-x | googlemock/scripts/pump.py | 13 |
5 files changed, 19 insertions, 21 deletions
diff --git a/googlemock/cmake/gmock.pc.in b/googlemock/cmake/gmock.pc.in index 2ef0fbc..5780fca 100644 --- a/googlemock/cmake/gmock.pc.in +++ b/googlemock/cmake/gmock.pc.in @@ -7,4 +7,4 @@ Version: @PROJECT_VERSION@ URL: https://github.com/google/googletest Requires: gtest Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ diff --git a/googlemock/cmake/gmock_main.pc.in b/googlemock/cmake/gmock_main.pc.in index 04658fe..f2dfe69 100644 --- a/googlemock/cmake/gmock_main.pc.in +++ b/googlemock/cmake/gmock_main.pc.in @@ -7,4 +7,4 @@ Version: @PROJECT_VERSION@ URL: https://github.com/google/googletest Requires: gmock Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ diff --git a/googlemock/docs/pump_manual.md b/googlemock/docs/pump_manual.md index 10b3c5f..cdf7c57 100644 --- a/googlemock/docs/pump_manual.md +++ b/googlemock/docs/pump_manual.md @@ -6,18 +6,15 @@ Template and macro libraries often need to define many classes, functions, or macros that vary only (or almost only) in the number of arguments they take. It's a lot of repetitive, mechanical, and error-prone work. -Variadic templates and variadic macros can alleviate the problem. However, while -both are being considered by the C++ committee, neither is in the standard yet -or widely supported by compilers. Thus they are often not a good choice, -especially when your code needs to be portable. And their capabilities are still -limited. - -As a result, authors of such libraries often have to write scripts to generate -their implementation. However, our experience is that it's tedious to write such -scripts, which tend to reflect the structure of the generated code poorly and -are often hard to read and edit. For example, a small change needed in the -generated code may require some non-intuitive, non-trivial changes in the -script. This is especially painful when experimenting with the code. +Our experience is that it's tedious to write custom scripts, which tend to +reflect the structure of the generated code poorly and are often hard to read +and edit. For example, a small change needed in the generated code may require +some non-intuitive, non-trivial changes in the script. This is especially +painful when experimenting with the code. + +This script may be useful for generating meta code, for example a series of +macros of FOO1, FOO2, etc. Nevertheless, please make it your last resort +technique by favouring C++ template metaprogramming or variadic macros. # Our Solution diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index b8ec24d..e71570b 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -1323,7 +1323,7 @@ class PredicateFormatterFromMatcher { << "Expected: "; matcher.DescribeTo(&ss); - // Rerun the matcher to "PrintAndExain" the failure. + // Rerun the matcher to "PrintAndExplain" the failure. StringMatchResultListener listener; if (MatchPrintAndExplain(x, matcher, &listener)) { ss << "\n The matcher failed on the initial attempt; but passed when " diff --git a/googlemock/scripts/pump.py b/googlemock/scripts/pump.py index 66e3217..5523a19 100755 --- a/googlemock/scripts/pump.py +++ b/googlemock/scripts/pump.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. @@ -64,6 +64,7 @@ GRAMMAR: from __future__ import print_function +import io import os import re import sys @@ -834,7 +835,7 @@ def main(argv): sys.exit(1) file_path = argv[-1] - output_str = ConvertFromPumpSource(file(file_path, 'r').read()) + output_str = ConvertFromPumpSource(io.open(file_path, 'r').read()) if file_path.endswith('.pump'): output_file_path = file_path[:-5] else: @@ -842,11 +843,11 @@ def main(argv): if output_file_path == '-': print(output_str,) else: - output_file = file(output_file_path, 'w') - output_file.write('// This file was GENERATED by command:\n') - output_file.write('// %s %s\n' % + output_file = io.open(output_file_path, 'w') + output_file.write(u'// This file was GENERATED by command:\n') + output_file.write(u'// %s %s\n' % (os.path.basename(__file__), os.path.basename(file_path))) - output_file.write('// DO NOT EDIT BY HAND!!!\n\n') + output_file.write(u'// DO NOT EDIT BY HAND!!!\n\n') output_file.write(output_str) output_file.close() |