From 797b54070f41cca0fdcc6dde954f96fe5f6af4b8 Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Sat, 8 Feb 2014 15:08:14 +0700 Subject: ocaml-yojson: add tests --- ocaml/ocaml-yojson.spec | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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}/ -- cgit