From a5e2ebaa6bb05bd03cb691fdff128c2edc2a3c55 Mon Sep 17 00:00:00 2001 From: David Holm Date: Sat, 17 May 2014 15:25:13 +0200 Subject: [PATCH] vala: better test case Closes Homebrew/homebrew#29339. Signed-off-by: Adam Vandenberg --- Formula/vala.rb | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Formula/vala.rb b/Formula/vala.rb index 7df75b1f3b..6ef74c0654 100644 --- a/Formula/vala.rb +++ b/Formula/vala.rb @@ -6,7 +6,6 @@ class Vala < Formula url "http://ftp.acc.umu.se/pub/gnome/sources/vala/0.24/vala-0.24.0.tar.xz" sha1 "33a71a21e12e80cf1f4e0aa3b6a6523ff38e92c8" - depends_on "pkg-config" => :build depends_on "gettext" depends_on "glib" @@ -19,6 +18,26 @@ class Vala < Formula end test do - system "#{bin}/valac", "--version" + test_string = "Hello Homebrew\n" + path = testpath/"hello.vala" + path.write <<-EOS + void main () { + print ("#{test_string}"); + } + EOS + valac_args = [# Build with debugging symbols. + "-g", + # Use Homebrew's default C compiler. + "--cc=#{ENV.cc}", + # Save generated C source code. + "--save-temps", + # Vala source code path. + "#{path}"] + system "#{bin}/valac", *valac_args + assert File.exist?(testpath/"hello.c") + + output = `#{testpath}/hello` + assert_equal test_string, output + assert_equal 0, $?.exitstatus end end