aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorBaptiste Fontaine2015-03-10 00:45:33 +0100
committerMike McQuaid2015-03-18 18:25:08 +0000
commit9d6e0a328aa61324a571216758b0f4fc35e8199c (patch)
treed793e19e307b5fd14bb58ea8a01aa5b837e9ddfe /Library/Formula
parentd62e97a3e5af2c9a62cbde21760cbd4d401d17f9 (diff)
downloadhomebrew-9d6e0a328aa61324a571216758b0f4fc35e8199c.tar.bz2
qdbm: test added
Closes #37547. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/qdbm.rb44
1 files changed, 37 insertions, 7 deletions
diff --git a/Library/Formula/qdbm.rb b/Library/Formula/qdbm.rb
index 08380f7d7..48dd669b8 100644
--- a/Library/Formula/qdbm.rb
+++ b/Library/Formula/qdbm.rb
@@ -1,9 +1,7 @@
-require 'formula'
-
class Qdbm < Formula
- homepage 'http://fallabs.com/qdbm'
- url 'http://fallabs.com/qdbm/qdbm-1.8.78.tar.gz'
- sha1 '8c2ab938c2dad8067c29b0aa93efc6389f0e7076'
+ homepage "http://fallabs.com/qdbm"
+ url "http://fallabs.com/qdbm/qdbm-1.8.78.tar.gz"
+ sha256 "b466fe730d751e4bfc5900d1f37b0fb955f2826ac456e70012785e012cdcb73e"
def install
system "./configure", "--disable-debug",
@@ -11,7 +9,39 @@ class Qdbm < Formula
"--enable-bzip",
"--enable-zlib",
"--enable-iconv"
- system "make mac"
- system "make install-mac"
+ system "make", "mac"
+ system "make", "check-mac"
+ system "make", "install-mac"
+ end
+
+ test do
+ (testpath/"test.c").write <<-EOS.undent
+ #include <depot.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+
+ #define NAME "mike"
+ #define NUMBER "00-12-34-56"
+ #define DBNAME "book"
+
+ int main(void) {
+ DEPOT *depot;
+ char *val;
+
+ if(!(depot = dpopen(DBNAME, DP_OWRITER | DP_OCREAT, -1))) { return 1; }
+ if(!dpput(depot, NAME, -1, NUMBER, -1, DP_DOVER)) { return 1; }
+ if(!(val = dpget(depot, NAME, -1, 0, -1, NULL))) { return 1; }
+
+ printf("%s, %s\\n", NAME, val);
+ free(val);
+
+ if(!dpclose(depot)) { return 1; }
+
+ return 0;
+ }
+ EOS
+
+ system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lqdbm", "-o", "test"
+ assert_equal "mike, 00-12-34-56", shell_output("./test").chomp
end
end