diff options
Diffstat (limited to 'Library/Formula/cpptest.rb')
| -rw-r--r-- | Library/Formula/cpptest.rb | 24 |
1 files changed, 24 insertions, 0 deletions
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 <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 |
