aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorShaun Jackman2014-11-12 14:50:02 -0800
committerMike McQuaid2014-11-13 08:32:56 +0000
commit7f24470ca8e36795d296d07f7e1fdec193a99759 (patch)
tree769e14224e52fb1d321c206448332ca2858b9be7 /Library/Formula
parentbf9c87fde11791cd09dfc23996c3fc263a6fac18 (diff)
downloadhomebrew-7f24470ca8e36795d296d07f7e1fdec193a99759.tar.bz2
gcc: Test compiling C and C++ code
Closes #34139. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/gcc.rb22
1 files changed, 22 insertions, 0 deletions
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 <stdio.h>
+ 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 <iostream>
+ 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