summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Alexandre Salim <salimma@fedoraproject.org>2014-02-08 15:08:14 +0700
committerMichel Alexandre Salim <salimma@fedoraproject.org>2014-02-08 15:08:14 +0700
commit797b54070f41cca0fdcc6dde954f96fe5f6af4b8 (patch)
tree7f7237c0841f35f2646f6445561681d1d939fc8f
parentc2157f6a11a6b15afe19156ec9ca1802843640fb (diff)
downloadspecs-797b54070f41cca0fdcc6dde954f96fe5f6af4b8.tar.gz
specs-797b54070f41cca0fdcc6dde954f96fe5f6af4b8.tar.xz
specs-797b54070f41cca0fdcc6dde954f96fe5f6af4b8.zip
ocaml-yojson: add tests
-rw-r--r--ocaml/ocaml-yojson.spec13
1 files changed, 13 insertions, 0 deletions
diff --git a/ocaml/ocaml-yojson.spec b/ocaml/ocaml-yojson.spec
index 28e3f89..fa09af1 100644
--- a/ocaml/ocaml-yojson.spec
+++ b/ocaml/ocaml-yojson.spec
@@ -11,6 +11,9 @@ Summary: An optimized parsing and printing library for the JSON format
License: BSD
URL: http://mjambon.com/yojson.html
Source0: http://mjambon.com/releases/yojson/yojson-%{version}.tar.gz
+# Example JSON files for testing
+Source1: test-valid.json
+Source2: test-invalid.json
ExclusiveArch: %{ocaml_arches}
@@ -51,6 +54,7 @@ developing applications that use %{name}.
%build
+# not SMP-safe
make META all
%if %opt
make opt
@@ -66,6 +70,15 @@ mkdir -p $OCAMLFIND_DESTDIR
make install
+%check
+# Against valid JSON
+$RPM_BUILD_ROOT%{_bindir}/ydump %{SOURCE1} >/dev/null 2>valid-err.log
+[ -z "$(cat valid-err.log)" ]
+
+# Against invalid JSON
+[ ! $($RPM_BUILD_ROOT%{_bindir}/ydump %{SOURCE2} 2>/dev/null) ]
+
+
%files
%doc LICENSE
%{_libdir}/ocaml/%{libname}/