orcli/tests/completions.sh

20 lines
377 B
Bash
Raw Permalink Normal View History

2022-12-04 00:39:53 +01:00
#!/bin/bash
t="completions"
# create tmp directory
tmpdir="$(mktemp -d)"
trap '{ rm -rf "${tmpdir}"; }' 0 2 3 15
# assertion
cat << "DATA" > "${tmpdir}/${t}.assert"
# orcli completion -*- shell-script -*-
DATA
# action
cd "${tmpdir}" || exit 1
orcli completions | head -n1 > "${t}.output"
# test
diff -u "${t}.assert" "${t}.output"