jansson: add test

Closes Homebrew/homebrew#35324.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Xu Cheng 2014-12-29 08:54:45 +08:00 committed by Jack Nagel
parent 197e2369c4
commit 3bfe41e88f

View file

@ -18,4 +18,23 @@ class Jansson < Formula
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <jansson.h>
#include <assert.h>
int main()
{
json_t *json;
json_error_t error;
json = json_loads("\\"foo\\"", JSON_DECODE_ANY, &error);
assert(json && json_is_string(json));
json_decref(json);
return 0;
}
EOS
system ENV.cc, "test.c", "-ljansson", "-o", "test"
system "./test"
end
end