#!/usr/bin/env bash

PATH=${SCRIPT%/*}:${PATH}
func=${SCRIPT##*/}

eval "$(command "${func}" -cr1 --bash="${func}" --path="${DATADIR}/repo")"
eval "$(command "${func}" -cr1 --posix "${func}-posix" --path="${DATADIR}/repo")"

declare -f "${func}" "_${func}" "${func}-posix"

"${func}"
[[ ${PWD} == */repo ]] || fail "${PWD} is not in */repo"

"${func}-posix" test
[[ ${PWD} == */repo/dev-test/test ]] || fail "${PWD} is not in */repo/dev-test/test"

COMP_WORDS=("${func}" -c -1 te)
COMP_CWORD=3
COMPREPLY=()
_"${func}" '' te
[[ ${COMPREPLY[0]:-} == test ]] || fail "COMPREPLY is not 'test'"
