orcli/tests/info.sh

26 lines
386 B
Bash

#!/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"
# assertion
cat << "DATA" > "${tmpdir}/${t}.assert"
a
b
c
DATA
# action
cd "${tmpdir}" || exit 1
orcli import csv "${t}.csv"
orcli info "${t} csv" | jq -r .columns[] > "${t}.output"
# test
diff -u "${t}.assert" "${t}.output"