[Pkg-ocaml-maint-commits] [ppx-deriving-yojson] 02/02: as-installed package test
Ralf Treinen
treinen at moszumanska.debian.org
Thu Jun 8 07:04:50 UTC 2017
This is an automated email from the git hooks/post-receive script.
treinen pushed a commit to branch master
in repository ppx-deriving-yojson.
commit 61fbae77f990e325c270f4ad8bff849eb65797fd
Author: Ralf Treinen <treinen at debian.org>
Date: Thu Jun 8 08:18:20 2017 +0200
as-installed package test
---
debian/tests/control | 2 ++
debian/tests/expected | 1 +
debian/tests/expr | 19 +++++++++++++++++++
debian/tests/expr.ml | 8 ++++++++
4 files changed, 30 insertions(+)
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..c15ebc8
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: expr
+Depends: ocaml-nox, libfindlib-ocaml, libyojson-ocaml-dev
diff --git a/debian/tests/expected b/debian/tests/expected
new file mode 100644
index 0000000..26fdae4
--- /dev/null
+++ b/debian/tests/expected
@@ -0,0 +1 @@
+["EAdd",["EConst",73],["EConst",42]]
diff --git a/debian/tests/expr b/debian/tests/expr
new file mode 100755
index 0000000..7798d1a
--- /dev/null
+++ b/debian/tests/expr
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+
+this=expr
+indir=debian/tests
+outdir=${ADT_ARTIFACTS:-/tmp}/${this}
+mkdir -p ${outdir}
+
+ppx='ppx_deriving_yojson,yojson'
+cp ${indir}/${this}.ml ${indir}/expected ${outdir}
+cd ${outdir}
+ocamlbuild -quiet -use-ocamlfind -pkgs ${ppx} ${this}.byte
+./${this}.byte > result
+diff result expected
+
+if [ -x /usr/bin/ocamlopt ]
+then ocamlbuild -quiet -use-ocamlfind -pkgs ${ppx} ${this}.native;
+ ./${this}.native > result
+ diff result expected
+fi
diff --git a/debian/tests/expr.ml b/debian/tests/expr.ml
new file mode 100644
index 0000000..8c2feeb
--- /dev/null
+++ b/debian/tests/expr.ml
@@ -0,0 +1,8 @@
+type expr =
+ | EConst of int
+ | EAdd of expr * expr
+ [@@deriving yojson]
+;;
+
+print_endline (Yojson.Safe.to_string
+ (expr_to_yojson (EAdd (EConst 73, EConst 42))));;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/ppx-deriving-yojson.git
More information about the Pkg-ocaml-maint-commits
mailing list