1
1
mirror of https://github.com/wader/fq.git synced 2024-12-22 21:01:37 +03:00

Rename and move cli test to pkg/cli

This commit is contained in:
Mattias Wadman 2021-09-18 18:23:28 +02:00
parent 1557e14ec7
commit e4e269b162
3 changed files with 10 additions and 9 deletions

View File

@ -8,7 +8,7 @@ fq:
.PHONY: test
# figure out all go pakges with test files
test: PKGS=$(shell find . -name "*_test.go" | xargs -n 1 dirname | sort | uniq)
test: testjq testfqbin
test: testjq testcli
go test ${VERBOSE} ${COVER} ${PKGS}
testwrite: export WRITE_ACTUAL=1
@ -29,9 +29,9 @@ testjq:
go run main.go -L "$$(dirname $$f)" -f "$$f" -n -r ; \
done
.PHONY: testfqbin
testfqbin:
dev/fqbin-test.sh
.PHONY: testcli
testcli:
@pkg/cli/test.sh pkg/cli/test.exp
.PHONY: doc
doc: doc/file.mp3 doc/file.mp4

View File

@ -1,6 +1,7 @@
#!/usr/bin/env expect
# TODO: move this script somehwere else
# TODO: run without NODECODEPROGRESS
# TODO: test interrupt?
log_user 1
set timeout 1

View File

@ -1,17 +1,17 @@
#!/bin/sh
set -eu
if which expect >/dev/null 2>&1; then
TEMPDIR=$(mktemp -d)
go build -o "${TEMPDIR}/fq" main.go
PATH="${TEMPDIR}:${PATH}" expect dev/fqbin-test.exp >"${TEMPDIR}/fq.log"
EXIT="$?"
if [ $EXIT != "0" ]; then
PATH="${TEMPDIR}:${PATH}" expect "$1" >"${TEMPDIR}/fq.log" && FAIL=0 || FAIL=1
if [ $FAIL = "1" ]; then
cat "${TEMPDIR}/fq.log"
fi
rm -rf "${TEMPDIR}"
if [ $EXIT != "0" ]; then
if [ $FAIL = "1" ]; then
exit 1
fi
else
echo "fq-test.sh: skip as expect is not installed"
echo "skip as expect is not installed"
fi