Skip to content

Commit e3333b0

Browse files
add test for examples (#21)
Co-authored-by: Thomas Jungblut <tjungblu@redhat.com>
1 parent 84bb616 commit e3333b0

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.github/workflows/unit-test.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ jobs:
1515
go-version: 1.19
1616
- name: Go vet
1717
run: make vet
18-
- name: Test
18+
- name: Unit Test
1919
run: make unit-test
20+
- name: Example Test
21+
run: make example-test

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ linear-simpledb:
7676
$(GO) clean -testcache
7777
$(GO) test -v -timeout 30m --tags simpleDBlinear $(GOFLAGS) ./simpledb/porcupine $(TESTFLAGS)
7878

79+
.PHONY: example-test
80+
example-test:
81+
/bin/bash test_examples.sh
82+
7983
.PHONY: generate-test-files
8084
generate-test-files:
8185
@echo

test_examples.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
ex_files=$(ls _examples/*.go)
4+
for f_name in $ex_files; do
5+
echo "running $f_name"
6+
go run $f_name
7+
if [ $? -ne 0 ]; then
8+
echo "failure while running $f_name"
9+
exit 1
10+
fi
11+
done

0 commit comments

Comments
 (0)