vala: better test case

Closes Homebrew/homebrew#29339.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
David Holm 2014-05-17 15:25:13 +02:00 committed by Adam Vandenberg
parent 8b82e219f2
commit a5e2ebaa6b

View file

@ -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" url "http://ftp.acc.umu.se/pub/gnome/sources/vala/0.24/vala-0.24.0.tar.xz"
sha1 "33a71a21e12e80cf1f4e0aa3b6a6523ff38e92c8" sha1 "33a71a21e12e80cf1f4e0aa3b6a6523ff38e92c8"
depends_on "pkg-config" => :build depends_on "pkg-config" => :build
depends_on "gettext" depends_on "gettext"
depends_on "glib" depends_on "glib"
@ -19,6 +18,26 @@ class Vala < Formula
end end
test do 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
end end