diff --git a/Formula/cpptest.rb b/Formula/cpptest.rb index 092bfcd72b..14989de144 100644 --- a/Formula/cpptest.rb +++ b/Formula/cpptest.rb @@ -15,4 +15,28 @@ class Cpptest < Formula "--prefix=#{prefix}" system "make", "install" end + + test do + (testpath/"test.cpp").write <<-EOS.undent + #include + #include + + 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