Snap! Catch2

The Catch2 logo from the catch2 project.

Many of our C++ test make use of catch.hpp which is a standalone C++ header allowing us to very quickly develop unit tests against our code.

We also have our own extensions in the snapcatch2.hpp file so we can very quickly create new tests with our standard set of command line extensions, verbose sections, etc.

The Ubuntu system is often quite behind with the version of Catch2 (actually, it is not even available on Ubuntu 16.04, which only offers version 1.x) so we decided to create our own package with the latest release.

The original source is available on github.

We just keep a tarball of the latest release and generate a new package with it whenever a new version is available.

You can find our package in our Snap! C++ Laucnhpad project. This is for Ubuntu 16.04 at this time, but we intend to move to 18.04 at some point and maybe even jump directly to 20.04 once available. We are able to recompile everything under 19.04 so we know that it would work in 18.04.



  • Upgraded to the Release 2.9.1 of Catch2.
  • Added the CATCH_REQUIRE_LONG_STRING() macro so long strings can be shown in a way where you can see the difference at once.


  • Upgraded to the Release 2.8.0 of Catch2. This fixes a few problems with CMake.
  • Moved the safe_setenv class to the snapdev library.
  • Added our own snapcatch2.hpp header to include our own common extensions.
  • Added the ExceptionWatcher so we can in one go specify (1) the exception type and (2) the exception message.


  • First version we generated so we can use v2 on 16.04 and 18.04.
  • We still have to convert all of our existing tests to v2, though.

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly