1
1
mirror of https://github.com/wader/fq.git synced 2024-11-26 10:33:53 +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 .PHONY: test
# figure out all go pakges with test files # figure out all go pakges with test files
test: PKGS=$(shell find . -name "*_test.go" | xargs -n 1 dirname | sort | uniq) test: PKGS=$(shell find . -name "*_test.go" | xargs -n 1 dirname | sort | uniq)
test: testjq testfqbin test: testjq testcli
go test ${VERBOSE} ${COVER} ${PKGS} go test ${VERBOSE} ${COVER} ${PKGS}
testwrite: export WRITE_ACTUAL=1 testwrite: export WRITE_ACTUAL=1
@ -29,9 +29,9 @@ testjq:
go run main.go -L "$$(dirname $$f)" -f "$$f" -n -r ; \ go run main.go -L "$$(dirname $$f)" -f "$$f" -n -r ; \
done done
.PHONY: testfqbin .PHONY: testcli
testfqbin: testcli:
dev/fqbin-test.sh @pkg/cli/test.sh pkg/cli/test.exp
.PHONY: doc .PHONY: doc
doc: doc/file.mp3 doc/file.mp4 doc: doc/file.mp3 doc/file.mp4

View File

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

View File

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