class Cxxtest < Formula desc "CxxTest Unit Testing Framework" homepage "http://cxxtest.com" url "https://github.com/CxxTest/cxxtest/releases/download/4.4/cxxtest-4.4.tar.gz" mirror "https://mirrors.kernel.org/debian/pool/main/c/cxxtest/cxxtest_4.4.orig.tar.gz" sha256 "1c154fef91c65dbf1cd4519af7ade70a61d85a923b6e0c0b007dc7f4895cf7d8" bottle do cellar :any sha256 "a69d95d4c027024e6c14a999c679106cf6259e22bb748205d93dbc5d0596a8e3" => :yosemite sha256 "2e8e487aac953d698f38f89ae9946572f8d072ec35b91683aa66bc147cec2fa4" => :mavericks sha256 "de1e98e94198507c65ecb17ae240b995ae8f03dadeafbde27bb704df2e10737c" => :mountain_lion end depends_on :python if MacOS.version <= :snow_leopard def install ENV["PYTHONPATH"] = lib+"python2.7/site-packages" ENV.prepend_create_path "PYTHONPATH", lib+"python2.7/site-packages" cd "./python" do system "python", *Language::Python.setup_install_args(prefix) end bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"]) include.install "cxxtest" doc.install Dir["doc/*"] end test do testfile = testpath/"MyTestSuite1.h" testfile.write <<-EOS.undent #include class MyTestSuite1 : public CxxTest::TestSuite { public: void testAddition(void) { TS_ASSERT(1 + 1 > 1); TS_ASSERT_EQUALS(1 + 1, 2); } }; EOS system bin/"cxxtestgen", "--error-printer", "-o", testpath/"runner.cpp", testfile system ENV.cxx, "-o", testpath/"runner", testpath/"runner.cpp" system testpath/"runner" end end