From 7f24470ca8e36795d296d07f7e1fdec193a99759 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Wed, 12 Nov 2014 14:50:02 -0800 Subject: gcc: Test compiling C and C++ code Closes #34139. Signed-off-by: Mike McQuaid --- Library/Formula/gcc.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Library/Formula') diff --git a/Library/Formula/gcc.rb b/Library/Formula/gcc.rb index ceddaabf8..fcb57006a 100644 --- a/Library/Formula/gcc.rb +++ b/Library/Formula/gcc.rb @@ -189,6 +189,28 @@ class Gcc < Formula end test do + (testpath/"hello-c.c").write <<-EOS.undent + #include + int main() + { + puts("Hello, world!"); + return 0; + } + EOS + system "#{bin}/gcc-#{version_suffix}", "-o", "hello-c", "hello-c.c" + assert_equal "Hello, world!\n", `./hello-c` + + (testpath/"hello-cc.cc").write <<-'EOS'.undent + #include + int main() + { + std::cout << "Hello, world!\n"; + return 0; + } + EOS + system "#{bin}/g++-#{version_suffix}", "-o", "hello-cc", "hello-cc.cc" + assert_equal "Hello, world!\n", `./hello-cc` + if build.with?("fortran") || build.with?("all-languages") fixture = <<-EOS.undent integer,parameter::m=10000 -- cgit v1.2.3