mirror of
https://github.com/wader/fq.git
synced 2025-01-03 19:19:43 +03:00
fq: Add cli sanity test
This commit is contained in:
parent
1fe5d95307
commit
46d37eff88
6
Makefile
6
Makefile
@ -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
|
||||
test: testjq testfqbin
|
||||
go test ${VERBOSE} ${COVER} ${PKGS}
|
||||
|
||||
testwrite: export WRITE_ACTUAL=1
|
||||
@ -29,6 +29,10 @@ testjq:
|
||||
go run main.go -L "$$(dirname $$f)" -f "$$f" -n -r ; \
|
||||
done
|
||||
|
||||
.PHONY: testfqbin
|
||||
testfqbin:
|
||||
dev/fqbin-test.sh
|
||||
|
||||
.PHONY: doc
|
||||
doc: doc/file.mp3 doc/file.mp4
|
||||
$(eval REPODIR=$(shell pwd))
|
||||
|
28
dev/fqbin-test.exp
Executable file
28
dev/fqbin-test.exp
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env expect
|
||||
# TODO: move this script somehwere else
|
||||
# TODO: run without NODECODEPROGRESS
|
||||
|
||||
log_user 1
|
||||
set timeout 1
|
||||
|
||||
expect_after {
|
||||
timeout {exit 1}
|
||||
}
|
||||
|
||||
spawn sh -c "NODECODEPROGRESS=1 fq -o color=false -i . pkg/interp/testdata/test.mp3 2>&1"
|
||||
|
||||
expect "mp3> "
|
||||
|
||||
send ".\n"
|
||||
expect "footers"
|
||||
expect "mp3> "
|
||||
|
||||
send ".frames | mp3_fr\t"
|
||||
expect "mp3_frame"
|
||||
send "\n"
|
||||
expect "side_info"
|
||||
|
||||
# ctrl-d
|
||||
send "\x04"
|
||||
|
||||
expect eof
|
17
dev/fqbin-test.sh
Executable file
17
dev/fqbin-test.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
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
|
||||
cat "${TEMPDIR}/fq.log"
|
||||
fi
|
||||
rm -rf "${TEMPDIR}"
|
||||
if [ $EXIT != "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "fq-test.sh: skip as expect is not installed"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user