Skip to content

Commit 149c8e9

Browse files
committed
feat(examples): Add expected CLI output for given inputs
1 parent 6fdd7a1 commit 149c8e9

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.github/workflows/ci-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,10 @@ jobs:
4040
- name: Run tests
4141
run: |
4242
make test
43+
- name: Check examples
44+
run: |
45+
make clean-examples
46+
make examples
47+
git diff --exit-code examples
48+
49+

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
include common.mk
22

3+
EXAMPLES := $(patsubst %.in,%.out,$(wildcard examples/*.in))
4+
35
# Check if Go's linkers flags are set in common.mk and add them as extra flags.
46
ifneq ($(GOLDFLAGS),)
57
GO_EXTRA_FLAGS += -ldflags $(GOLDFLAGS)
@@ -13,6 +15,15 @@ build:
1315
@$(ECHO) "$(MAGENTA)*** Building Go code...$(OFF)"
1416
@$(GO) build -v -o oasis $(GOFLAGS) $(GO_EXTRA_FLAGS)
1517

18+
examples: build $(EXAMPLES)
19+
20+
examples/%.out: examples/%.in
21+
@rm -f $@
22+
@scripts/gen_example.sh $< $@
23+
24+
clean-examples:
25+
@rm -f examples/*.out
26+
1627
# Format code.
1728
fmt:
1829
@$(ECHO) "$(CYAN)*** Running Go formatters...$(OFF)"
@@ -64,6 +75,8 @@ clean:
6475
# List of targets that are not actual files.
6576
.PHONY: \
6677
all build \
78+
examples \
79+
clean-examples \
6780
fmt \
6881
$(lint-targets) lint \
6982
$(test-targets) test \

0 commit comments

Comments
 (0)