Skip to content

Commit

Permalink
add test for examples (#21)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Jungblut <[email protected]>
  • Loading branch information
thomasjungblut and tjungblu authored Feb 23, 2023
1 parent 84bb616 commit e3333b0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ jobs:
go-version: 1.19
- name: Go vet
run: make vet
- name: Test
- name: Unit Test
run: make unit-test
- name: Example Test
run: make example-test
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ linear-simpledb:
$(GO) clean -testcache
$(GO) test -v -timeout 30m --tags simpleDBlinear $(GOFLAGS) ./simpledb/porcupine $(TESTFLAGS)

.PHONY: example-test
example-test:
/bin/bash test_examples.sh

.PHONY: generate-test-files
generate-test-files:
@echo
Expand Down
11 changes: 11 additions & 0 deletions test_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

ex_files=$(ls _examples/*.go)
for f_name in $ex_files; do
echo "running $f_name"
go run $f_name
if [ $? -ne 0 ]; then
echo "failure while running $f_name"
exit 1
fi
done

0 comments on commit e3333b0

Please sign in to comment.