-
-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #56464. Signed-off-by: chenrui <chenrui333@gmail.com>
- Loading branch information
1 parent
d938182
commit 1b38378
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
class Doctest < Formula | ||
desc "The fastest feature-rich C++11/14/17/20 single-header testing framework" | ||
homepage "https://github.com/onqtam/doctest" | ||
url "https://github.com/onqtam/doctest/archive/2.3.8.tar.gz" | ||
sha256 "d7232437eceb46ad5de03cacdee770c80f2e53e7b8efc1c8a8ed29539f64efa5" | ||
|
||
depends_on "cmake" => :build | ||
|
||
def install | ||
mkdir "build" do | ||
system "cmake", "..", *std_cmake_args | ||
system "cmake", "--build", ".", "--target", "install" | ||
end | ||
end | ||
|
||
test do | ||
(testpath/"test.cpp").write <<~EOS | ||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN | ||
#include <doctest/doctest.h> | ||
TEST_CASE("Basic") { | ||
int x = 1; | ||
SUBCASE("Test section 1") { | ||
x = x + 1; | ||
REQUIRE(x == 2); | ||
} | ||
SUBCASE("Test section 2") { | ||
REQUIRE(x == 1); | ||
} | ||
} | ||
EOS | ||
system ENV.cxx, "test.cpp", "-std=c++11", "-o", "test" | ||
system "./test" | ||
end | ||
end |