catch2 2.8.0 (new formula)

Closes #40431.

Signed-off-by: Chongyu Zhu <i@lembacon.com>
This commit is contained in:
Elio Ferri 2019-05-28 20:57:05 -07:00 committed by Chongyu Zhu
parent 30254b7e23
commit 9a8bfb0575
No known key found for this signature in database
GPG key ID: 1A43E3C9100B38F5

34
Formula/catch2.rb Normal file
View file

@ -0,0 +1,34 @@
class Catch2 < Formula
desc "Modern, C++-native, header-only, test framework"
homepage "https://github.com/catchorg/Catch2"
url "https://github.com/catchorg/Catch2/archive/v2.8.0.tar.gz"
sha256 "b567c37446cd22c8550bfeb7e2fe3f981b8f3ab8b2148499a522e7f61b8a481d"
depends_on "cmake" => :build
def install
mkdir "build" do
system "cmake", "..", "-DBUILD_TESTING=OFF", *std_cmake_args
system "cmake", "--build", ".", "--target", "install"
end
end
test do
(testpath/"test.cpp").write <<~EOS
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
TEST_CASE("Basic", "[catch2]") {
int x = 1;
SECTION("Test section 1") {
x = x + 1;
REQUIRE(x == 2);
}
SECTION("Test section 2") {
REQUIRE(x == 1);
}
}
EOS
system ENV.cxx, "test.cpp", "-std=c++11", "-o", "test"
system "./test"
end
end