#!/bin/sh

set -e

testdir=${AUTOPKGTEST_TMP:-/tmp}

testcases="calendar.ml nihongo.ml tree.ml"
for f in ${testcases}; do
    cp examples/${f} ${testdir}
done
cd ${testdir}
for f in ${testcases}; do
    echo -n "${f}: " 
    # switch off warning 10: expression should have type unit
    echo -n "bytecode "
    ocamlfind ocamlc -w -10 -package lablgtk3 -thread -linkpkg ${f}
    if [ -x /usr/bin/ocamlopt ]; then
	echo -n "native-code "
	ocamlfind ocamlopt -w -10 -package lablgtk3 -thread -linkpkg ${f}
    fi
    echo "ok."
done
