From 68faf98419ec907dc54d7ad5351da2f8bf3fcaa3 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 12 Mar 2012 17:51:27 -0500 Subject: glib: add test Signed-off-by: Jack Nagel --- Library/Formula/glib.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Library/Formula') diff --git a/Library/Formula/glib.rb b/Library/Formula/glib.rb index d21585a59..dfe368631 100644 --- a/Library/Formula/glib.rb +++ b/Library/Formula/glib.rb @@ -89,4 +89,27 @@ class Glib < Formula (share+'gtk-doc').rmtree end + + def test + mktemp do + (Pathname.pwd/'test.c').write <<-EOS.undent + #include + #include + + int main(void) + { + gchar *result_1, *result_2; + char *str = "string"; + + result_1 = g_convert(str, strlen(str), "ASCII", "UTF-8", NULL, NULL, NULL); + result_2 = g_convert(result_1, strlen(result_1), "UTF-8", "ASCII", NULL, NULL, NULL); + + return (strcmp(str, result_2) == 0) ? 0 : 1; + } + EOS + system "clang", "-o", "test", "test.c", + *`pkg-config --cflags --libs glib-2.0`.split + system "./test" + end + end end -- cgit v1.2.3