orcli/tests/import-csv.sh

22 lines
372 B
Bash
Raw Normal View History

2022-11-30 23:49:54 +01:00
#!/bin/bash
2022-12-03 01:30:01 +01:00
t="import-csv"
2022-11-30 23:49:54 +01:00
2022-12-04 00:39:53 +01:00
# create tmp directory
2022-12-03 01:30:01 +01:00
tmpdir="$(mktemp -d)"
trap '{ rm -rf "${tmpdir}"; }' 0 2 3 15
2022-12-04 00:39:53 +01:00
# input
cp data/example.csv "${tmpdir}/${t}.csv"
# assertion
cp data/example.tsv "${tmpdir}/${t}.assert"
2022-11-30 23:49:54 +01:00
# action
2022-12-04 00:39:53 +01:00
cd "${tmpdir}" || exit 1
orcli import csv "${t}.csv"
2022-12-04 00:39:53 +01:00
orcli export tsv "${t} csv" > "${t}.output"
2022-11-30 23:49:54 +01:00
# test
2022-12-03 01:30:01 +01:00
diff -u "${t}.assert" "${t}.output"