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:
parent
1112b75e0e
commit
680045fbc1
@ -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
|
||||
--------------------
|
||||
|
||||
|
17
integration-tests/test-to-file.sh
Executable file
17
integration-tests/test-to-file.sh
Executable 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"
|
6
moar.sh
6
moar.sh
@ -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
17
test.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user