[PATCH] D33059: Create an shared include directory for gtest helper functions

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 13:00:01 PDT 2017


zturner created this revision.

Often different tests in different test executables need to do the same thing.  Historically, we have always just copied large blocks of code between tests to solve this.  For example, if a function returns an `llvm::Error`, then we would like to have some set of `EXPECT` / `ASSERT` macros that can handle them in the canonical gtest fashion, and these should be shared among all tests.  Currently we have no such place to put code of this nature.

This patch adds such a location in `llvm/Support/gtest`.  For now it's header only, but in the future it could be extended to have a library component as well that is force linked into all unittest targets.

Additional use cases of this could include adding asserts and expect macros for `std::error_code`, or adding various mock objects to be used alongside gmock (think: `ASSERT_THAT(ElementExists(Vec, 7))`.

In this patch, I take two instances of the same copied file that contains macros for expecting and asserting on `llvm::Error`s, and move them to this shared directory, then include the shared file.


https://reviews.llvm.org/D33059

Files:
  llvm/include/llvm/gtest/ErrorChecking.h
  llvm/unittests/DebugInfo/CodeView/ErrorChecking.h
  llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp
  llvm/unittests/DebugInfo/PDB/ErrorChecking.h
  llvm/unittests/DebugInfo/PDB/HashTableTest.cpp
  llvm/unittests/DebugInfo/PDB/MSFBuilderTest.cpp
  llvm/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp
  llvm/unittests/DebugInfo/PDB/StringTableBuilderTest.cpp
  llvm/unittests/DebugInfo/PDB/TypeServerHandlerTest.cpp
  llvm/unittests/Support/BinaryStreamTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33059.98507.patch
Type: text/x-patch
Size: 18221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170510/c2fa7d65/attachment.bin>


More information about the llvm-commits mailing list