aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/cpptest.rb
diff options
context:
space:
mode:
authorXu Cheng2014-12-31 21:26:00 +0800
committerMike McQuaid2014-12-31 14:58:28 +0000
commit4a7683f7ffd11d4a641e7c92549f9a5371353a85 (patch)
treecd8c3adc45c085a3b70655fabb6b3b33a1612c1e /Library/Formula/cpptest.rb
parent948a726423bbafffbf86bf5c2a0e8f66a6a1960c (diff)
downloadhomebrew-4a7683f7ffd11d4a641e7c92549f9a5371353a85.tar.bz2
cpptest: add test
Closes #35395.
Diffstat (limited to 'Library/Formula/cpptest.rb')
-rw-r--r--Library/Formula/cpptest.rb24
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