orcli/tests/info.sh

26 lines
386 B
Bash
Raw Normal View History

2022-12-04 00:39:53 +01:00
#!/bin/bash
t="info"
# create tmp directory
tmpdir="$(mktemp -d)"
trap '{ rm -rf "${tmpdir}"; }' 0 2 3 15
# input
cp data/example.csv "${tmpdir}/${t}.csv"
2022-12-06 17:21:11 +01:00
# assertion
cat << "DATA" > "${tmpdir}/${t}.assert"
a
b
c
DATA
2022-12-04 00:39:53 +01:00
# action
cd "${tmpdir}" || exit 1
orcli import csv "${t}.csv"
2022-12-06 17:21:11 +01:00
orcli info "${t} csv" | jq -r .columns[] > "${t}.output"
2022-12-04 00:39:53 +01:00
# test
2022-12-06 17:21:11 +01:00
diff -u "${t}.assert" "${t}.output"