catch2 2.8.0 (new formula)
Closes #40431. Signed-off-by: Chongyu Zhu <i@lembacon.com>
This commit is contained in:
parent
30254b7e23
commit
9a8bfb0575
1 changed files with 34 additions and 0 deletions
34
Formula/catch2.rb
Normal file
34
Formula/catch2.rb
Normal 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
|
Loading…
Reference in a new issue