From 4a7683f7ffd11d4a641e7c92549f9a5371353a85 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Wed, 31 Dec 2014 21:26:00 +0800 Subject: cpptest: add test Closes #35395. --- Library/Formula/cpptest.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Library/Formula/cpptest.rb') diff --git a/Library/Formula/cpptest.rb b/Library/Formula/cpptest.rb index 092bfcd72..14989de14 100644 --- a/Library/Formula/cpptest.rb +++ b/Library/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 -- cgit v1.2.3