#!/bin/sh

set -e

testdir=$(mktemp -d)
trap "rm -rf ${testdir}" 0 INT QUIT ABRT PIPE TERM
cd ${testdir}

cat <<EOF > test.ml
open ExtString
module S = String
let _ = assert (S.starts_with "foo" ~prefix:"f")
EOF

ocamlfind ocamlc -o byte-code-test -package extlib -linkpkg test.ml

echo "build: OK"

[ -x byte-code-test ]
./byte-code-test

echo "run: OK"
