rj_schema 0.2.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rj_schema/rapidjson/CMakeLists.txt +9 -4
- data/ext/rj_schema/rapidjson/RapidJSONConfig.cmake.in +10 -0
- data/ext/rj_schema/rapidjson/appveyor.yml +22 -9
- data/ext/rj_schema/rapidjson/bin/data/abcde.txt +1 -0
- data/ext/rj_schema/rapidjson/bin/unittestschema/address.json +139 -0
- data/ext/rj_schema/rapidjson/bin/unittestschema/allOf_address.json +7 -0
- data/ext/rj_schema/rapidjson/bin/unittestschema/anyOf_address.json +7 -0
- data/ext/rj_schema/rapidjson/bin/unittestschema/oneOf_address.json +7 -0
- data/ext/rj_schema/rapidjson/contrib/natvis/rapidjson.natvis +2 -2
- data/ext/rj_schema/rapidjson/doc/dom.md +1 -0
- data/ext/rj_schema/rapidjson/doc/dom.zh-cn.md +1 -0
- data/ext/rj_schema/rapidjson/doc/faq.md +3 -3
- data/ext/rj_schema/rapidjson/doc/faq.zh-cn.md +8 -8
- data/ext/rj_schema/rapidjson/doc/internals.md +1 -1
- data/ext/rj_schema/rapidjson/doc/internals.zh-cn.md +2 -2
- data/ext/rj_schema/rapidjson/doc/pointer.zh-cn.md +1 -1
- data/ext/rj_schema/rapidjson/doc/sax.md +1 -1
- data/ext/rj_schema/rapidjson/doc/sax.zh-cn.md +2 -2
- data/ext/rj_schema/rapidjson/doc/stream.md +1 -1
- data/ext/rj_schema/rapidjson/doc/tutorial.md +1 -1
- data/ext/rj_schema/rapidjson/doc/tutorial.zh-cn.md +7 -6
- data/ext/rj_schema/rapidjson/example/CMakeLists.txt +1 -0
- data/ext/rj_schema/rapidjson/example/schemavalidator/schemavalidator.cpp +118 -0
- data/ext/rj_schema/rapidjson/example/sortkeys/sortkeys.cpp +62 -0
- data/ext/rj_schema/rapidjson/example/tutorial/tutorial.cpp +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/allocators.h +6 -6
- data/ext/rj_schema/rapidjson/include/rapidjson/cursorstreamwrapper.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/document.h +124 -35
- data/ext/rj_schema/rapidjson/include/rapidjson/encodedstream.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/encodings.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/error/en.h +49 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/error/error.h +56 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/filereadstream.h +2 -2
- data/ext/rj_schema/rapidjson/include/rapidjson/filewritestream.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/fwd.h +2 -2
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/biginteger.h +2 -2
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/clzll.h +71 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/diyfp.h +3 -17
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/dtoa.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/ieee754.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/itoa.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/meta.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/pow10.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/regex.h +20 -13
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/stack.h +4 -3
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/strfunc.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/strtod.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/swap.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/istreamwrapper.h +50 -35
- data/ext/rj_schema/rapidjson/include/rapidjson/memorybuffer.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/memorystream.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/ostreamwrapper.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/pointer.h +63 -5
- data/ext/rj_schema/rapidjson/include/rapidjson/prettywriter.h +2 -2
- data/ext/rj_schema/rapidjson/include/rapidjson/rapidjson.h +63 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/reader.h +67 -53
- data/ext/rj_schema/rapidjson/include/rapidjson/schema.h +318 -164
- data/ext/rj_schema/rapidjson/include/rapidjson/stream.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/stringbuffer.h +1 -1
- data/ext/rj_schema/rapidjson/include/rapidjson/writer.h +10 -10
- data/ext/rj_schema/rapidjson/readme.md +51 -1
- data/ext/rj_schema/rapidjson/readme.zh-cn.md +2 -2
- data/ext/rj_schema/rapidjson/test/perftest/misctest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/perftest/perftest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/perftest/perftest.h +1 -1
- data/ext/rj_schema/rapidjson/test/perftest/platformtest.cpp +2 -2
- data/ext/rj_schema/rapidjson/test/perftest/rapidjsontest.cpp +75 -1
- data/ext/rj_schema/rapidjson/test/unittest/CMakeLists.txt +1 -0
- data/ext/rj_schema/rapidjson/test/unittest/allocatorstest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/bigintegertest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/clzlltest.cpp +34 -0
- data/ext/rj_schema/rapidjson/test/unittest/cursorstreamwrappertest.cpp +19 -19
- data/ext/rj_schema/rapidjson/test/unittest/documenttest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/dtoatest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/encodedstreamtest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/encodingstest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/filestreamtest.cpp +45 -2
- data/ext/rj_schema/rapidjson/test/unittest/fwdtest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/istreamwrappertest.cpp +10 -10
- data/ext/rj_schema/rapidjson/test/unittest/itoatest.cpp +8 -8
- data/ext/rj_schema/rapidjson/test/unittest/jsoncheckertest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/namespacetest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/ostreamwrappertest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/pointertest.cpp +157 -16
- data/ext/rj_schema/rapidjson/test/unittest/prettywritertest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/readertest.cpp +113 -75
- data/ext/rj_schema/rapidjson/test/unittest/regextest.cpp +2 -1
- data/ext/rj_schema/rapidjson/test/unittest/schematest.cpp +593 -78
- data/ext/rj_schema/rapidjson/test/unittest/simdtest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/strfunctest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/stringbuffertest.cpp +5 -5
- data/ext/rj_schema/rapidjson/test/unittest/strtodtest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/unittest.cpp +1 -1
- data/ext/rj_schema/rapidjson/test/unittest/unittest.h +4 -1
- data/ext/rj_schema/rapidjson/test/unittest/valuetest.cpp +12 -12
- data/ext/rj_schema/rapidjson/test/unittest/writertest.cpp +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/BUILD.bazel +175 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/CMakeLists.txt +18 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/CONTRIBUTING.md +160 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/LICENSE +28 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/Makefile.am +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/README.md +16 -35
- data/ext/rj_schema/rapidjson/thirdparty/gtest/WORKSPACE +8 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/appveyor.yml +104 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-autotools.sh +44 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-bazel.sh +36 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-linux.sh +41 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-osx.sh +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/get-nprocessors.sh +48 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-linux.sh +49 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-osx.sh +39 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/log-config.sh +51 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/travis.sh +44 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/configure.ac +16 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CHANGES +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +72 -32
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/README.md +53 -42
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock.pc.in +9 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock_main.pc.in +9 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/configure.ac +4 -4
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +6 -4
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +117 -132
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +7 -4
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +20 -12
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +1 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +83 -26
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +262 -68
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +45 -6
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +650 -366
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +76 -20
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +308 -229
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +18 -15
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +87 -26
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +33 -16
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +1209 -353
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +33 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +159 -88
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +2 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +3 -4
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +16 -9
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +71 -8
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +7 -11
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +69 -6
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +2 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +69 -6
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +83 -8
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +63 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +63 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +76 -3
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +4 -5
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +3 -3
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +36 -6
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +210 -135
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +108 -48
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +23 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/BUILD.bazel +123 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +166 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +64 -62
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +43 -18
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +11 -9
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +91 -36
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +33 -14
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +1286 -167
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +85 -83
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +102 -15
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +136 -9
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +24 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +8 -5
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +20 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +8 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +3 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +44 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +5 -7
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +40 -14
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/Makefile.am +60 -31
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/README.md +232 -171
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest.pc.in +9 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest_main.pc.in +10 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +54 -16
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/configure.ac +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Pkgconfig.md +146 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +2 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +6 -6
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{AdvancedGuide.md → advanced.md} +260 -26
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{FAQ.md → faq.md} +62 -57
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{Primer.md → primer.md} +43 -9
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{Samples.md → samples.md} +0 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +53 -5
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +1 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +30 -36
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +8 -17
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +140 -51
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +2 -3
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +4 -3
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +126 -30
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +6 -7
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +8 -5
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +6 -5
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +4 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +13 -57
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +1 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +98 -59
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +34 -41
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +3 -10
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +9 -17
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +8 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +232 -99
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +3 -3
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +17 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +17 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.sln +55 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj +149 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.sln +55 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj +149 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj +154 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj +162 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj +199 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters +26 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj +191 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters +26 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj +188 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj +180 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +6 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +0 -4
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +2 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +2 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +7 -6
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +5 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +3 -3
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +2 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +10 -22
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +2 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +0 -3
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +10 -10
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +226 -32
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +5 -7
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +21 -29
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +85 -67
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +93 -8
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +1 -9
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +1 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +622 -164
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/BUILD.bazel +396 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +12 -15
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +2 -12
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +6 -8
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +1 -5
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +84 -29
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +1 -5
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +11 -12
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +165 -63
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +13 -13
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_assert_by_exception_test.cc +119 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +1 -3
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +1 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +0 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +1 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +0 -8
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +6 -4
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +0 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +0 -3
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +20 -18
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +0 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_outfiles_test.py +162 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_output_unittest.py +611 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_test_utils.py +60 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +4 -4
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +2 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +11 -7
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +17 -12
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +104 -66
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +2 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +2 -19
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +0 -6
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +12 -14
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test.py +65 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test_.cc +44 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +4 -5
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +2 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +240 -149
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +0 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +0 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +15 -7
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +100 -30
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +0 -2
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +25 -23
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.cc +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.h +1 -1
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +4 -4
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +47 -0
- data/ext/rj_schema/rapidjson/travis-doxygen.sh +13 -6
- data/ext/rj_schema/rj_schema.cpp +161 -17
- data/lib/rj_schema.rb +1 -1
- metadata +63 -58
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DevGuide.md +0 -132
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CheatSheet.md +0 -525
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CookBook.md +0 -3250
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/Documentation.md +0 -11
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/ForDummies.md +0 -439
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/FrequentlyAskedQuestions.md +0 -624
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CheatSheet.md +0 -534
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CookBook.md +0 -3342
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/Documentation.md +0 -12
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/ForDummies.md +0 -439
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/FrequentlyAskedQuestions.md +0 -628
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CheatSheet.md +0 -556
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CookBook.md +0 -3432
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/Documentation.md +0 -12
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/ForDummies.md +0 -439
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/FrequentlyAskedQuestions.md +0 -628
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/DevGuide.md +0 -126
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Documentation.md +0 -14
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_AdvancedGuide.md +0 -2096
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Documentation.md +0 -12
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_FAQ.md +0 -886
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Primer.md +0 -497
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_PumpManual.md +0 -177
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_XcodeGuide.md +0 -93
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_AdvancedGuide.md +0 -2178
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Documentation.md +0 -14
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_FAQ.md +0 -1038
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Primer.md +0 -501
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_PumpManual.md +0 -177
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Samples.md +0 -14
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_XcodeGuide.md +0 -93
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_AdvancedGuide.md +0 -2181
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Documentation.md +0 -14
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_FAQ.md +0 -1082
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Primer.md +0 -501
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_PumpManual.md +0 -177
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Samples.md +0 -14
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_XcodeGuide.md +0 -93
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.sln +0 -45
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.vcproj +0 -126
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.sln +0 -45
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.vcproj +0 -126
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main-md.vcproj +0 -129
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main.vcproj +0 -129
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test-md.vcproj +0 -164
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test.vcproj +0 -164
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest-md.vcproj +0 -147
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest.vcproj +0 -147
- data/ext/rj_schema/rapidjson/thirdparty/gtest/travis.sh +0 -15
@@ -0,0 +1,9 @@
|
|
1
|
+
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
2
|
+
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
3
|
+
|
4
|
+
Name: gmock
|
5
|
+
Description: GoogleMock (without main() function)
|
6
|
+
Version: @PROJECT_VERSION@
|
7
|
+
URL: https://github.com/google/googletest
|
8
|
+
Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@
|
9
|
+
Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
|
@@ -0,0 +1,9 @@
|
|
1
|
+
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
2
|
+
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
3
|
+
|
4
|
+
Name: gmock_main
|
5
|
+
Description: GoogleMock (with main() function)
|
6
|
+
Version: @PROJECT_VERSION@
|
7
|
+
URL: https://github.com/google/googletest
|
8
|
+
Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@
|
9
|
+
Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
|
@@ -1,7 +1,7 @@
|
|
1
1
|
m4_include(../googletest/m4/acx_pthread.m4)
|
2
2
|
|
3
3
|
AC_INIT([Google C++ Mocking Framework],
|
4
|
-
[1.
|
4
|
+
[1.8.0],
|
5
5
|
[googlemock@googlegroups.com],
|
6
6
|
[gmock])
|
7
7
|
|
@@ -101,7 +101,7 @@ AC_ARG_VAR([GTEST_VERSION],
|
|
101
101
|
[The version of Google Test available.])
|
102
102
|
HAVE_BUILT_GTEST="no"
|
103
103
|
|
104
|
-
GTEST_MIN_VERSION="1.
|
104
|
+
GTEST_MIN_VERSION="1.8.0"
|
105
105
|
|
106
106
|
AS_IF([test "x${enable_external_gtest}" = "xyes"],
|
107
107
|
[# Begin filling in variables as we are able.
|
@@ -129,8 +129,8 @@ AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"],
|
|
129
129
|
GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
|
130
130
|
GTEST_LIBS=`${GTEST_CONFIG} --libs`
|
131
131
|
GTEST_VERSION=`${GTEST_CONFIG} --version`],
|
132
|
-
[
|
133
|
-
# GTEST_CONFIG needs to be executable both in a Makefile
|
132
|
+
[
|
133
|
+
# GTEST_CONFIG needs to be executable both in a Makefile environment and
|
134
134
|
# in a shell script environment, so resolve an absolute path for it here.
|
135
135
|
GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config"
|
136
136
|
GTEST_CPPFLAGS='-I$(top_srcdir)/../googletest/include'
|
@@ -65,7 +65,7 @@ can specify it by appending `_WITH_CALLTYPE` to any of the macros
|
|
65
65
|
described in the previous two sections and supplying the calling
|
66
66
|
convention as the first argument to the macro. For example,
|
67
67
|
```
|
68
|
-
|
68
|
+
MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n));
|
69
69
|
MOCK_CONST_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, Bar, int(double x, double y));
|
70
70
|
```
|
71
71
|
where `STDMETHODCALLTYPE` is defined by `<objbase.h>` on Windows.
|
@@ -178,6 +178,8 @@ divided into several categories:
|
|
178
178
|
|`Ne(value)` |`argument != value`|
|
179
179
|
|`IsNull()` |`argument` is a `NULL` pointer (raw or smart).|
|
180
180
|
|`NotNull()` |`argument` is a non-null pointer (raw or smart).|
|
181
|
+
|`VariantWith<T>(m)` |`argument` is `variant<>` that holds the alternative of
|
182
|
+
type T with a value matching `m`.|
|
181
183
|
|`Ref(variable)` |`argument` is a reference to `variable`.|
|
182
184
|
|`TypedEq<type>(value)`|`argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)` when the mock function is overloaded.|
|
183
185
|
|
@@ -227,7 +229,7 @@ The `argument` can be either a C string or a C++ string object:
|
|
227
229
|
|
228
230
|
`ContainsRegex()` and `MatchesRegex()` use the regular expression
|
229
231
|
syntax defined
|
230
|
-
[here](../../googletest/docs/
|
232
|
+
[here](../../googletest/docs/advanced.md#regular-expression-syntax).
|
231
233
|
`StrCaseEq()`, `StrCaseNe()`, `StrEq()`, and `StrNe()` work for wide
|
232
234
|
strings as well.
|
233
235
|
|
@@ -249,7 +251,7 @@ match them more flexibly, or get more informative messages, you can use:
|
|
249
251
|
| `SizeIs(m)` | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2))`. |
|
250
252
|
| `UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under some permutation each element matches an `ei` (for a different `i`), which can be a value or a matcher. 0 to 10 arguments are allowed. |
|
251
253
|
| `UnorderedElementsAreArray({ e0, e1, ..., en })`, `UnorderedElementsAreArray(array)`, or `UnorderedElementsAreArray(array, count)` | The same as `UnorderedElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, or C-style array. |
|
252
|
-
| `WhenSorted(m)` | When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSorted(
|
254
|
+
| `WhenSorted(m)` | When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSorted(ElementsAre(1, 2, 3))` verifies that `argument` contains elements `1`, `2`, and `3`, ignoring order. |
|
253
255
|
| `WhenSortedBy(comparator, m)` | The same as `WhenSorted(m)`, except that the given comparator instead of `<` is used to sort `argument`. E.g. `WhenSortedBy(std::greater<int>(), ElementsAre(3, 2, 1))`. |
|
254
256
|
|
255
257
|
Notes:
|
@@ -347,7 +349,7 @@ You can make a matcher from one or more other matchers:
|
|
347
349
|
|
348
350
|
## Matchers as Test Assertions ##
|
349
351
|
|
350
|
-
|`ASSERT_THAT(expression, m)`|Generates a [fatal failure](../../googletest/docs/
|
352
|
+
|`ASSERT_THAT(expression, m)`|Generates a [fatal failure](../../googletest/docs/primer.md#assertions) if the value of `expression` doesn't match matcher `m`.|
|
351
353
|
|:---------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------|
|
352
354
|
|`EXPECT_THAT(expression, m)`|Generates a non-fatal failure if the value of `expression` doesn't match matcher `m`. |
|
353
355
|
|
@@ -18,8 +18,9 @@ You must always put a mock method definition (`MOCK_METHOD*`) in a
|
|
18
18
|
`public:` section of the mock class, regardless of the method being
|
19
19
|
mocked being `public`, `protected`, or `private` in the base class.
|
20
20
|
This allows `ON_CALL` and `EXPECT_CALL` to reference the mock function
|
21
|
-
from outside of the mock class. (Yes, C++ allows a subclass to
|
22
|
-
|
21
|
+
from outside of the mock class. (Yes, C++ allows a subclass to specify
|
22
|
+
a different access level than the base class on a virtual function.)
|
23
|
+
Example:
|
23
24
|
|
24
25
|
```
|
25
26
|
class Foo {
|
@@ -147,7 +148,7 @@ Note that the mock class doesn't define `AppendPacket()`, unlike the
|
|
147
148
|
real class. That's fine as long as the test doesn't need to call it.
|
148
149
|
|
149
150
|
Next, you need a way to say that you want to use
|
150
|
-
`ConcretePacketStream` in production code
|
151
|
+
`ConcretePacketStream` in production code and to use `MockPacketStream`
|
151
152
|
in tests. Since the functions are not virtual and the two classes are
|
152
153
|
unrelated, you must specify your choice at _compile time_ (as opposed
|
153
154
|
to run time).
|
@@ -218,7 +219,7 @@ per-function syntactic overhead will be much lower.
|
|
218
219
|
|
219
220
|
If you are concerned about the performance overhead incurred by
|
220
221
|
virtual functions, and profiling confirms your concern, you can
|
221
|
-
combine this with the recipe for [mocking non-virtual methods](#
|
222
|
+
combine this with the recipe for [mocking non-virtual methods](#mocking-nonvirtual-methods).
|
222
223
|
|
223
224
|
## The Nice, the Strict, and the Naggy ##
|
224
225
|
|
@@ -226,7 +227,7 @@ If a mock method has no `EXPECT_CALL` spec but is called, Google Mock
|
|
226
227
|
will print a warning about the "uninteresting call". The rationale is:
|
227
228
|
|
228
229
|
* New methods may be added to an interface after a test is written. We shouldn't fail a test just because a method it doesn't know about is called.
|
229
|
-
* However, this may also mean there's a bug in the test, so Google Mock shouldn't be silent either. If the user believes these calls are harmless,
|
230
|
+
* However, this may also mean there's a bug in the test, so Google Mock shouldn't be silent either. If the user believes these calls are harmless, they can add an `EXPECT_CALL()` to suppress the warning.
|
230
231
|
|
231
232
|
However, sometimes you may want to suppress all "uninteresting call"
|
232
233
|
warnings, while sometimes you may want the opposite, i.e. to treat all
|
@@ -294,7 +295,7 @@ There are some caveats though (I don't like them just as much as the
|
|
294
295
|
next guy, but sadly they are side effects of C++'s limitations):
|
295
296
|
|
296
297
|
1. `NiceMock<MockFoo>` and `StrictMock<MockFoo>` only work for mock methods defined using the `MOCK_METHOD*` family of macros **directly** in the `MockFoo` class. If a mock method is defined in a **base class** of `MockFoo`, the "nice" or "strict" modifier may not affect it, depending on the compiler. In particular, nesting `NiceMock` and `StrictMock` (e.g. `NiceMock<StrictMock<MockFoo> >`) is **not** supported.
|
297
|
-
1. The constructors of the base mock (`MockFoo`) cannot have arguments passed by non-const reference, which happens to be banned by the [Google C++ style guide](
|
298
|
+
1. The constructors of the base mock (`MockFoo`) cannot have arguments passed by non-const reference, which happens to be banned by the [Google C++ style guide](https://google.github.io/styleguide/cppguide.html).
|
298
299
|
1. During the constructor or destructor of `MockFoo`, the mock object is _not_ nice or strict. This may cause surprises if the constructor or destructor calls a mock method on `this` object. (This behavior, however, is consistent with C++'s general rule: if a constructor or destructor calls a virtual method of `this` object, that method is treated as non-virtual. In other words, to the base class's constructor or destructor, `this` object behaves like an instance of the base class, not the derived class. This rule is required for safety. Otherwise a base constructor may use members of a derived class before they are initialized, or a base destructor may use members of a derived class after they have been destroyed.)
|
299
300
|
|
300
301
|
Finally, you should be **very cautious** about when to use naggy or strict mocks, as they tend to make tests more brittle and harder to maintain. When you refactor your code without changing its externally visible behavior, ideally you should't need to update any tests. If your code interacts with a naggy mock, however, you may start to get spammed with warnings as the result of your change. Worse, if your code interacts with a strict mock, your tests may start to fail and you'll be forced to fix them. Our general recommendation is to use nice mocks (not yet the default) most of the time, use naggy mocks (the current default) when developing or debugging tests, and use strict mocks only as the last resort.
|
@@ -705,7 +706,7 @@ type `m` accepts):
|
|
705
706
|
1. When both `T` and `U` are built-in arithmetic types (`bool`, integers, and floating-point numbers), the conversion from `T` to `U` is not lossy (in other words, any value representable by `T` can also be represented by `U`); and
|
706
707
|
1. When `U` is a reference, `T` must also be a reference (as the underlying matcher may be interested in the address of the `U` value).
|
707
708
|
|
708
|
-
The code won't compile if any of these conditions
|
709
|
+
The code won't compile if any of these conditions aren't met.
|
709
710
|
|
710
711
|
Here's one example:
|
711
712
|
|
@@ -1029,9 +1030,10 @@ a value that satisfies matcher `m`.
|
|
1029
1030
|
|
1030
1031
|
For example:
|
1031
1032
|
|
1032
|
-
|
1033
|
+
| Expression | Description |
|
1033
1034
|
|:-----------------------------|:-----------------------------------|
|
1034
|
-
|
1035
|
+
| `Field(&Foo::number, Ge(3))` | Matches `x` where `x.number >= 3`. |
|
1036
|
+
| `Property(&Foo::name, StartsWith("John "))` | Matches `x` where `x.name()` starts with `"John "`. |
|
1035
1037
|
|
1036
1038
|
Note that in `Property(&Foo::baz, ...)`, method `baz()` must take no
|
1037
1039
|
argument and be declared as `const`.
|
@@ -1229,7 +1231,7 @@ that references the implementation object dies, the implementation
|
|
1229
1231
|
object will be deleted.
|
1230
1232
|
|
1231
1233
|
Therefore, if you have some complex matcher that you want to use again
|
1232
|
-
and again, there is no need to build it
|
1234
|
+
and again, there is no need to build it every time. Just assign it to a
|
1233
1235
|
matcher variable and use that variable repeatedly! For example,
|
1234
1236
|
|
1235
1237
|
```
|
@@ -1401,7 +1403,7 @@ edge from node A to node B wherever A must occur before B, we can get
|
|
1401
1403
|
a DAG. We use the term "sequence" to mean a directed path in this
|
1402
1404
|
DAG. Now, if we decompose the DAG into sequences, we just need to know
|
1403
1405
|
which sequences each `EXPECT_CALL()` belongs to in order to be able to
|
1404
|
-
reconstruct the
|
1406
|
+
reconstruct the original DAG.
|
1405
1407
|
|
1406
1408
|
So, to specify the partial order on the expectations we need to do two
|
1407
1409
|
things: first to define some `Sequence` objects, and then for each
|
@@ -1680,7 +1682,7 @@ This also works when the argument is an output iterator:
|
|
1680
1682
|
|
1681
1683
|
```
|
1682
1684
|
using ::testing::_;
|
1683
|
-
using ::testing::
|
1685
|
+
using ::testing::SetArrayArgument;
|
1684
1686
|
|
1685
1687
|
class MockRolodex : public Rolodex {
|
1686
1688
|
public:
|
@@ -1919,9 +1921,9 @@ using ::testing::_;
|
|
1919
1921
|
// second argument DoThis() receives.
|
1920
1922
|
```
|
1921
1923
|
|
1922
|
-
Arghh, you need to refer to a mock function argument but
|
1923
|
-
|
1924
|
-
really?
|
1924
|
+
Arghh, you need to refer to a mock function argument but your version
|
1925
|
+
of C++ has no lambdas, so you have to define your own action. :-(
|
1926
|
+
Or do you really?
|
1925
1927
|
|
1926
1928
|
Well, Google Mock has an action to solve _exactly_ this problem:
|
1927
1929
|
|
@@ -2180,7 +2182,7 @@ the implementation object dies, the implementation object will be
|
|
2180
2182
|
deleted.
|
2181
2183
|
|
2182
2184
|
If you have some complex action that you want to use again and again,
|
2183
|
-
you may not have to build it from scratch
|
2185
|
+
you may not have to build it from scratch every time. If the action
|
2184
2186
|
doesn't have an internal state (i.e. if it always does the same thing
|
2185
2187
|
no matter how many times it has been called), you can assign it to an
|
2186
2188
|
action variable and use that variable repeatedly. For example:
|
@@ -2227,13 +2229,20 @@ versus
|
|
2227
2229
|
|
2228
2230
|
## Mocking Methods That Use Move-Only Types ##
|
2229
2231
|
|
2230
|
-
C++11 introduced
|
2232
|
+
C++11 introduced *move-only types*. A move-only-typed value can be moved from
|
2233
|
+
one object to another, but cannot be copied. `std::unique_ptr<T>` is
|
2234
|
+
probably the most commonly used move-only type.
|
2231
2235
|
|
2232
|
-
Mocking a method that takes and/or returns move-only types presents some
|
2236
|
+
Mocking a method that takes and/or returns move-only types presents some
|
2237
|
+
challenges, but nothing insurmountable. This recipe shows you how you can do it.
|
2238
|
+
Note that the support for move-only method arguments was only introduced to
|
2239
|
+
gMock in April 2017; in older code, you may find more complex
|
2240
|
+
[workarounds](#LegacyMoveOnly) for lack of this feature.
|
2233
2241
|
|
2234
|
-
Let’s say we are working on a fictional project that lets one post and share
|
2242
|
+
Let’s say we are working on a fictional project that lets one post and share
|
2243
|
+
snippets called “buzzes”. Your code uses these types:
|
2235
2244
|
|
2236
|
-
```
|
2245
|
+
```cpp
|
2237
2246
|
enum class AccessLevel { kInternal, kPublic };
|
2238
2247
|
|
2239
2248
|
class Buzz {
|
@@ -2245,59 +2254,46 @@ class Buzz {
|
|
2245
2254
|
class Buzzer {
|
2246
2255
|
public:
|
2247
2256
|
virtual ~Buzzer() {}
|
2248
|
-
virtual std::unique_ptr<Buzz> MakeBuzz(
|
2249
|
-
virtual bool ShareBuzz(std::unique_ptr<Buzz> buzz,
|
2257
|
+
virtual std::unique_ptr<Buzz> MakeBuzz(StringPiece text) = 0;
|
2258
|
+
virtual bool ShareBuzz(std::unique_ptr<Buzz> buzz, int64_t timestamp) = 0;
|
2250
2259
|
...
|
2251
2260
|
};
|
2252
2261
|
```
|
2253
2262
|
|
2254
|
-
A `Buzz` object represents a snippet being posted.
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
```
|
2259
|
-
class MockBuzzer : public Buzzer {
|
2260
|
-
public:
|
2261
|
-
MOCK_METHOD1(MakeBuzz, std::unique_ptr<Buzz>(const std::string& text));
|
2262
|
-
…
|
2263
|
-
};
|
2264
|
-
```
|
2265
|
-
|
2266
|
-
However, if you attempt to use the same `MOCK_METHOD` pattern to mock a method that takes a move-only parameter, you’ll get a compiler error currently:
|
2267
|
-
|
2268
|
-
```
|
2269
|
-
// Does NOT compile!
|
2270
|
-
MOCK_METHOD2(ShareBuzz, bool(std::unique_ptr<Buzz> buzz, Time timestamp));
|
2271
|
-
```
|
2272
|
-
|
2273
|
-
While it’s highly desirable to make this syntax just work, it’s not trivial and the work hasn’t been done yet. Fortunately, there is a trick you can apply today to get something that works nearly as well as this.
|
2263
|
+
A `Buzz` object represents a snippet being posted. A class that implements the
|
2264
|
+
`Buzzer` interface is capable of creating and sharing `Buzz`es. Methods in
|
2265
|
+
`Buzzer` may return a `unique_ptr<Buzz>` or take a
|
2266
|
+
`unique_ptr<Buzz>`. Now we need to mock `Buzzer` in our tests.
|
2274
2267
|
|
2275
|
-
|
2268
|
+
To mock a method that accepts or returns move-only types, you just use the
|
2269
|
+
familiar `MOCK_METHOD` syntax as usual:
|
2276
2270
|
|
2277
|
-
```
|
2271
|
+
```cpp
|
2278
2272
|
class MockBuzzer : public Buzzer {
|
2279
2273
|
public:
|
2280
|
-
MOCK_METHOD1(MakeBuzz, std::unique_ptr<Buzz>(
|
2281
|
-
MOCK_METHOD2(
|
2282
|
-
bool ShareBuzz(std::unique_ptr<Buzz> buzz, Time timestamp) {
|
2283
|
-
return DoShareBuzz(buzz.get(), timestamp);
|
2284
|
-
}
|
2274
|
+
MOCK_METHOD1(MakeBuzz, std::unique_ptr<Buzz>(StringPiece text));
|
2275
|
+
MOCK_METHOD2(ShareBuzz, bool(std::unique_ptr<Buzz> buzz, int64_t timestamp));
|
2285
2276
|
};
|
2286
2277
|
```
|
2287
2278
|
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2279
|
+
Now that we have the mock class defined, we can use it in tests. In the
|
2280
|
+
following code examples, we assume that we have defined a `MockBuzzer` object
|
2281
|
+
named `mock_buzzer_`:
|
2291
2282
|
|
2292
|
-
```
|
2283
|
+
```cpp
|
2293
2284
|
MockBuzzer mock_buzzer_;
|
2294
2285
|
```
|
2295
2286
|
|
2296
|
-
First let’s see how we can set expectations on the `MakeBuzz()` method, which
|
2287
|
+
First let’s see how we can set expectations on the `MakeBuzz()` method, which
|
2288
|
+
returns a `unique_ptr<Buzz>`.
|
2297
2289
|
|
2298
|
-
As usual, if you set an expectation without an action (i.e. the `.WillOnce()` or
|
2290
|
+
As usual, if you set an expectation without an action (i.e. the `.WillOnce()` or
|
2291
|
+
`.WillRepeated()` clause), when that expectation fires, the default action for
|
2292
|
+
that method will be taken. Since `unique_ptr<>` has a default constructor
|
2293
|
+
that returns a null `unique_ptr`, that’s what you’ll get if you don’t specify an
|
2294
|
+
action:
|
2299
2295
|
|
2300
|
-
```
|
2296
|
+
```cpp
|
2301
2297
|
// Use the default action.
|
2302
2298
|
EXPECT_CALL(mock_buzzer_, MakeBuzz("hello"));
|
2303
2299
|
|
@@ -2305,32 +2301,13 @@ As usual, if you set an expectation without an action (i.e. the `.WillOnce()` or
|
|
2305
2301
|
EXPECT_EQ(nullptr, mock_buzzer_.MakeBuzz("hello"));
|
2306
2302
|
```
|
2307
2303
|
|
2308
|
-
If you are not happy with the default action, you can tweak it
|
2309
|
-
|
2310
|
-
```
|
2311
|
-
// Sets the default action for return type std::unique_ptr<Buzz> to
|
2312
|
-
// creating a new Buzz every time.
|
2313
|
-
DefaultValue<std::unique_ptr<Buzz>>::SetFactory(
|
2314
|
-
[] { return MakeUnique<Buzz>(AccessLevel::kInternal); });
|
2315
|
-
|
2316
|
-
// When this fires, the default action of MakeBuzz() will run, which
|
2317
|
-
// will return a new Buzz object.
|
2318
|
-
EXPECT_CALL(mock_buzzer_, MakeBuzz("hello")).Times(AnyNumber());
|
2304
|
+
If you are not happy with the default action, you can tweak it as usual; see
|
2305
|
+
[Setting Default Actions](#OnCall).
|
2319
2306
|
|
2320
|
-
|
2321
|
-
|
2322
|
-
EXPECT_NE(nullptr, buzz1);
|
2323
|
-
EXPECT_NE(nullptr, buzz2);
|
2324
|
-
EXPECT_NE(buzz1, buzz2);
|
2307
|
+
If you just need to return a pre-defined move-only value, you can use the
|
2308
|
+
`Return(ByMove(...))` action:
|
2325
2309
|
|
2326
|
-
|
2327
|
-
// to avoid interfere with other tests.
|
2328
|
-
DefaultValue<std::unique_ptr<Buzz>>::Clear();
|
2329
|
-
```
|
2330
|
-
|
2331
|
-
What if you want the method to do something other than the default action? If you just need to return a pre-defined move-only value, you can use the `Return(ByMove(...))` action:
|
2332
|
-
|
2333
|
-
```
|
2310
|
+
```cpp
|
2334
2311
|
// When this fires, the unique_ptr<> specified by ByMove(...) will
|
2335
2312
|
// be returned.
|
2336
2313
|
EXPECT_CALL(mock_buzzer_, MakeBuzz("world"))
|
@@ -2341,81 +2318,87 @@ What if you want the method to do something other than the default action? If y
|
|
2341
2318
|
|
2342
2319
|
Note that `ByMove()` is essential here - if you drop it, the code won’t compile.
|
2343
2320
|
|
2344
|
-
Quiz time!
|
2321
|
+
Quiz time! What do you think will happen if a `Return(ByMove(...))` action is
|
2322
|
+
performed more than once (e.g. you write
|
2323
|
+
`….WillRepeatedly(Return(ByMove(...)));`)? Come think of it, after the first
|
2324
|
+
time the action runs, the source value will be consumed (since it’s a move-only
|
2325
|
+
value), so the next time around, there’s no value to move from -- you’ll get a
|
2326
|
+
run-time error that `Return(ByMove(...))` can only be run once.
|
2345
2327
|
|
2346
|
-
If you need your mock method to do more than just moving a pre-defined value,
|
2328
|
+
If you need your mock method to do more than just moving a pre-defined value,
|
2329
|
+
remember that you can always use a lambda or a callable object, which can do
|
2330
|
+
pretty much anything you want:
|
2347
2331
|
|
2348
|
-
```
|
2332
|
+
```cpp
|
2349
2333
|
EXPECT_CALL(mock_buzzer_, MakeBuzz("x"))
|
2350
|
-
.WillRepeatedly(
|
2351
|
-
return
|
2352
|
-
})
|
2334
|
+
.WillRepeatedly([](StringPiece text) {
|
2335
|
+
return MakeUnique<Buzz>(AccessLevel::kInternal);
|
2336
|
+
});
|
2353
2337
|
|
2354
2338
|
EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x"));
|
2355
2339
|
EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x"));
|
2356
2340
|
```
|
2357
2341
|
|
2358
|
-
Every time this `EXPECT_CALL` fires, a new `unique_ptr<Buzz>` will be
|
2342
|
+
Every time this `EXPECT_CALL` fires, a new `unique_ptr<Buzz>` will be
|
2343
|
+
created and returned. You cannot do this with `Return(ByMove(...))`.
|
2359
2344
|
|
2360
|
-
|
2345
|
+
That covers returning move-only values; but how do we work with methods
|
2346
|
+
accepting move-only arguments? The answer is that they work normally, although
|
2347
|
+
some actions will not compile when any of method's arguments are move-only. You
|
2348
|
+
can always use `Return`, or a [lambda or functor](#FunctionsAsActions):
|
2361
2349
|
|
2362
|
-
```
|
2363
|
-
|
2350
|
+
```cpp
|
2351
|
+
using ::testing::Unused;
|
2364
2352
|
|
2365
|
-
|
2366
|
-
|
2367
|
-
|
2368
|
-
|
2369
|
-
|
2353
|
+
EXPECT_CALL(mock_buzzer_, ShareBuzz(NotNull(), _)) .WillOnce(Return(true));
|
2354
|
+
EXPECT_TRUE(mock_buzzer_.ShareBuzz(MakeUnique<Buzz>(AccessLevel::kInternal)),
|
2355
|
+
0);
|
2356
|
+
|
2357
|
+
EXPECT_CALL(mock_buzzer_, ShareBuzz(_, _)) .WillOnce(
|
2358
|
+
[](std::unique_ptr<Buzz> buzz, Unused) { return buzz != nullptr; });
|
2359
|
+
EXPECT_FALSE(mock_buzzer_.ShareBuzz(nullptr, 0));
|
2370
2360
|
```
|
2371
2361
|
|
2372
|
-
|
2362
|
+
Many built-in actions (`WithArgs`, `WithoutArgs`,`DeleteArg`, `SaveArg`, ...)
|
2363
|
+
could in principle support move-only arguments, but the support for this is not
|
2364
|
+
implemented yet. If this is blocking you, please file a bug.
|
2373
2365
|
|
2374
|
-
|
2366
|
+
A few actions (e.g. `DoAll`) copy their arguments internally, so they can never
|
2367
|
+
work with non-copyable objects; you'll have to use functors instead.
|
2375
2368
|
|
2376
|
-
|
2369
|
+
##### Legacy workarounds for move-only types {#LegacyMoveOnly}
|
2377
2370
|
|
2378
|
-
|
2371
|
+
Support for move-only function arguments was only introduced to gMock in April
|
2372
|
+
2017. In older code, you may encounter the following workaround for the lack of
|
2373
|
+
this feature (it is no longer necessary - we're including it just for
|
2374
|
+
reference):
|
2375
|
+
|
2376
|
+
```cpp
|
2379
2377
|
class MockBuzzer : public Buzzer {
|
2380
2378
|
public:
|
2381
|
-
MockBuzzer() {
|
2382
|
-
// Since DoShareBuzz(buzz, time) is supposed to take ownership of
|
2383
|
-
// buzz, define a default behavior for DoShareBuzz(buzz, time) to
|
2384
|
-
// delete buzz.
|
2385
|
-
ON_CALL(*this, DoShareBuzz(_, _))
|
2386
|
-
.WillByDefault(Invoke([](Buzz* buzz, Time timestamp) {
|
2387
|
-
delete buzz;
|
2388
|
-
return true;
|
2389
|
-
}));
|
2390
|
-
}
|
2391
|
-
|
2392
|
-
MOCK_METHOD1(MakeBuzz, std::unique_ptr<Buzz>(const std::string& text));
|
2393
|
-
|
2394
|
-
// Takes ownership of buzz.
|
2395
2379
|
MOCK_METHOD2(DoShareBuzz, bool(Buzz* buzz, Time timestamp));
|
2396
|
-
bool ShareBuzz(std::unique_ptr<Buzz> buzz, Time timestamp) {
|
2397
|
-
return DoShareBuzz(buzz.
|
2380
|
+
bool ShareBuzz(std::unique_ptr<Buzz> buzz, Time timestamp) override {
|
2381
|
+
return DoShareBuzz(buzz.get(), timestamp);
|
2398
2382
|
}
|
2399
2383
|
};
|
2400
2384
|
```
|
2401
2385
|
|
2402
|
-
|
2386
|
+
The trick is to delegate the `ShareBuzz()` method to a mock method (let’s call
|
2387
|
+
it `DoShareBuzz()`) that does not take move-only parameters. Then, instead of
|
2388
|
+
setting expectations on `ShareBuzz()`, you set them on the `DoShareBuzz()` mock
|
2389
|
+
method:
|
2403
2390
|
|
2404
|
-
```
|
2405
|
-
|
2406
|
-
EXPECT_CALL(mock_buzzer_, DoShareBuzz(NotNull(), _))
|
2407
|
-
.WillOnce(Invoke([&intercepted_buzz](Buzz* buzz, Time timestamp) {
|
2408
|
-
// Save buzz in intercepted_buzz for analysis later.
|
2409
|
-
intercepted_buzz.reset(buzz);
|
2410
|
-
return false;
|
2411
|
-
}));
|
2391
|
+
```cpp
|
2392
|
+
MockBuzzer mock_buzzer_;
|
2393
|
+
EXPECT_CALL(mock_buzzer_, DoShareBuzz(NotNull(), _));
|
2412
2394
|
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2395
|
+
// When one calls ShareBuzz() on the MockBuzzer like this, the call is
|
2396
|
+
// forwarded to DoShareBuzz(), which is mocked. Therefore this statement
|
2397
|
+
// will trigger the above EXPECT_CALL.
|
2398
|
+
mock_buzzer_.ShareBuzz(MakeUnique<Buzz>(AccessLevel::kInternal), 0);
|
2416
2399
|
```
|
2417
2400
|
|
2418
|
-
|
2401
|
+
|
2419
2402
|
|
2420
2403
|
## Making the Compilation Faster ##
|
2421
2404
|
|
@@ -2482,12 +2465,12 @@ MockFoo::~MockFoo() {}
|
|
2482
2465
|
|
2483
2466
|
## Forcing a Verification ##
|
2484
2467
|
|
2485
|
-
When it's being
|
2468
|
+
When it's being destroyed, your friendly mock object will automatically
|
2486
2469
|
verify that all expectations on it have been satisfied, and will
|
2487
2470
|
generate [Google Test](../../googletest/) failures
|
2488
2471
|
if not. This is convenient as it leaves you with one less thing to
|
2489
2472
|
worry about. That is, unless you are not sure if your mock object will
|
2490
|
-
be
|
2473
|
+
be destroyed.
|
2491
2474
|
|
2492
2475
|
How could it be that your mock object won't eventually be destroyed?
|
2493
2476
|
Well, it might be created on the heap and owned by the code you are
|
@@ -3347,6 +3330,7 @@ For example, when using an `ACTION` as a stub action for mock function:
|
|
3347
3330
|
int DoSomething(bool flag, int* ptr);
|
3348
3331
|
```
|
3349
3332
|
we have:
|
3333
|
+
|
3350
3334
|
| **Pre-defined Symbol** | **Is Bound To** |
|
3351
3335
|
|:-----------------------|:----------------|
|
3352
3336
|
| `arg0` | the value of `flag` |
|
@@ -3508,6 +3492,7 @@ is asked to infer the type of `x`?
|
|
3508
3492
|
If you are writing a function that returns an `ACTION` object, you'll
|
3509
3493
|
need to know its type. The type depends on the macro used to define
|
3510
3494
|
the action and the parameter types. The rule is relatively simple:
|
3495
|
+
|
3511
3496
|
| **Given Definition** | **Expression** | **Has Type** |
|
3512
3497
|
|:---------------------|:---------------|:-------------|
|
3513
3498
|
| `ACTION(Foo)` | `Foo()` | `FooAction` |
|
@@ -3515,7 +3500,7 @@ the action and the parameter types. The rule is relatively simple:
|
|
3515
3500
|
| `ACTION_P(Bar, param)` | `Bar(int_value)` | `BarActionP<int>` |
|
3516
3501
|
| `ACTION_TEMPLATE(Bar, HAS_m_TEMPLATE_PARAMS(...), AND_1_VALUE_PARAMS(p1))` | `Bar<t1, ..., t_m>(int_value)` | `FooActionP<t1, ..., t_m, int>` |
|
3517
3502
|
| `ACTION_P2(Baz, p1, p2)` | `Baz(bool_value, int_value)` | `BazActionP2<bool, int>` |
|
3518
|
-
| `ACTION_TEMPLATE(Baz, HAS_m_TEMPLATE_PARAMS(...), AND_2_VALUE_PARAMS(p1, p2))
|
3503
|
+
| `ACTION_TEMPLATE(Baz, HAS_m_TEMPLATE_PARAMS(...), AND_2_VALUE_PARAMS(p1, p2))`| `Baz<t1, ..., t_m>(bool_value, int_value)` | `FooActionP2<t1, ..., t_m, bool, int>` |
|
3519
3504
|
| ... | ... | ... |
|
3520
3505
|
|
3521
3506
|
Note that we have to pick different suffixes (`Action`, `ActionP`,
|
@@ -3670,6 +3655,6 @@ This printer knows how to print built-in C++ types, native arrays, STL
|
|
3670
3655
|
containers, and any type that supports the `<<` operator. For other
|
3671
3656
|
types, it prints the raw bytes in the value and hopes that you the
|
3672
3657
|
user can figure it out.
|
3673
|
-
[Google Test's advanced guide](../../googletest/docs/
|
3658
|
+
[Google Test's advanced guide](../../googletest/docs/advanced.md#teaching-google-test-how-to-print-your-values)
|
3674
3659
|
explains how to extend the printer to do a better job at
|
3675
3660
|
printing your particular type than to dump the bytes.
|