1
1
mirror of https://github.com/walles/moar.git synced 2024-11-23 14:07:18 +03:00

Add initial integration tests

This commit is contained in:
Johan Walles 2019-06-09 18:42:25 +02:00
parent 1112b75e0e
commit 680045fbc1
4 changed files with 42 additions and 6 deletions

View File

@ -54,12 +54,18 @@ you can send questions to <johan.walles@gmail.com>.
Developing
----------
Build + test + run:
Build+ run:
```bash
./moar.sh
```
Run integration tests:
```bash
./test.sh
```
Making a new Release
--------------------

View File

@ -0,0 +1,17 @@
#!/bin/bash
# Verify sending the output to a file
set -e -o pipefail
echo Test redirecting a file by name into file by redirecting stdout...
RESULT="$(mktemp)"
./moar moar.go > "$RESULT"
diff -u moar.go "$RESULT"
rm "$RESULT"
echo Test reading from redirected stdin, writing to redirected stdout...
RESULT="$(mktemp)"
./moar < moar.go > "$RESULT"
diff -u moar.go "$RESULT"
rm "$RESULT"

View File

@ -2,14 +2,10 @@
set -e -o pipefail
# Ensure we can cross compile
GOOS=linux GOARCH=amd64 go build
GOOS=linux GOARCH=386 go build
GOOS=darwin GOARCH=amd64 go build
rm -f moar
go test
# Make sure we're built for the current platform
go build
./moar "$@"

17
test.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -e
# Ensure we can cross compile
GOOS=linux GOARCH=386 go build
GOOS=darwin GOARCH=amd64 go build
# Unit tests first...
go test
# ... then integration.
go build
for TEST in integration-tests/*.sh ; do
echo "Executing: $(basename "$TEST")..."
"$TEST"
done