aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/glib.rb
diff options
context:
space:
mode:
authorJack Nagel2013-02-01 23:12:36 -0600
committerJack Nagel2013-02-01 23:38:51 -0600
commit6828bdeeff04b59e1a49ded6815fa7c2aafb0dac (patch)
tree1e9c5083d27c52c20fdc6bbf6892b8b068aab5a1 /Library/Formula/glib.rb
parent957ab9cfd9ce4771da932c04a4e16fcf1f130bb4 (diff)
downloadhomebrew-6828bdeeff04b59e1a49ded6815fa7c2aafb0dac.tar.bz2
glib: use test DSL
Diffstat (limited to 'Library/Formula/glib.rb')
-rw-r--r--Library/Formula/glib.rb42
1 files changed, 20 insertions, 22 deletions
diff --git a/Library/Formula/glib.rb b/Library/Formula/glib.rb
index 535c98956..10469dcf2 100644
--- a/Library/Formula/glib.rb
+++ b/Library/Formula/glib.rb
@@ -71,27 +71,25 @@ 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
- flags = *`pkg-config --cflags --libs glib-2.0`.split
- flags += ENV.cflags.split
- system ENV.cc, "-o", "test", "test.c", *flags
- system "./test"
- end
+ test do
+ (testpath/'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
+ flags = *`pkg-config --cflags --libs glib-2.0`.split
+ flags += ENV.cflags.split
+ system ENV.cc, "-o", "test", "test.c", *flags
+ system "./test"
end
end