mirror of
https://github.com/mistydemeo/tigerbrew.git
synced 2026-12-02 05:29:47 -05:00
glib: use test DSL
This commit is contained in:
1 parent
957ab9cfd9
commit
6828bdeeff
1 file changed
+17
-19
+17
-19
@@ -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>
|
||||
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";
|
||||
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);
|
||||
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
|
||||
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
|
||||
Reference in new issue
Block a user