Files
xls_doc/scripts/smoke.sh
2026-06-18 20:03:47 +08:00

32 lines
914 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TMP="$(mktemp -d "${TMPDIR:-/tmp}/docfill-smoke.XXXXXX")"
cleanup() {
rm -rf "$TMP"
}
trap cleanup EXIT
cd "$ROOT"
go test -count=1 ./...
go build -o "$TMP/docfill" ./cmd/docfill
cp -R examples "$TMP/examples"
go run ./scripts/smoke-fixtures --base "$TMP/examples"
"$TMP/docfill" run -c "$TMP/examples/excel-to-word/task.json" --var date=2026-06-18
"$TMP/docfill" run -c "$TMP/examples/sqlite-to-excel/task.json" --var date=2026-06-18
test -f "$TMP/examples/excel-to-word/out/daily_2026-06-18_张三_1.docx"
test -f "$TMP/examples/excel-to-word/out/daily_2026-06-18_李四_2.docx"
xlsx_count="$(find "$TMP/examples/sqlite-to-excel/out" -type f -name '*.xlsx' | wc -l | tr -d ' ')"
if [[ "$xlsx_count" != "2" ]]; then
echo "expected 2 sqlite-to-excel outputs, got $xlsx_count" >&2
exit 1
fi
echo "smoke ok"