diff options
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/glib.rb | 23 |
1 files changed, 23 insertions, 0 deletions
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 <string.h> + #include <glib.h> + + 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 |
