cpptest: add test

Closes Homebrew/homebrew#35395.
This commit is contained in:
Xu Cheng 2014-12-31 21:26:00 +08:00 committed by Mike McQuaid
parent 5a6e6e1848
commit a9d72713c4

View file

@ -15,4 +15,28 @@ class Cpptest < Formula
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <assert.h>
#include <cpptest.h>
class TestCase: public Test::Suite
{
public:
TestCase() { TEST_ADD(TestCase::test); }
void test() { TEST_ASSERT(1 + 1 == 2); }
};
int main()
{
TestCase ts;
Test::TextOutput output(Test::TextOutput::Verbose);
assert(ts.run(output));
return 0;
}
EOS
system ENV.cxx, "test.cpp", "-lcpptest", "-o", "test"
system "./test"
end
end