Skip to content

Commit c1dcc98

Browse files
committed
feat(examples): Add expected CLI output for given inputs
1 parent c60fc0e commit c1dcc98

171 files changed

Lines changed: 2435 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ 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

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
include common.mk
22

3+
# Each Oasis CLI example's input .in must have a corresponding output .out.
4+
EXAMPLES := $(patsubst %.in,%.out,$(wildcard examples/*.in))
5+
36
# Check if Go's linkers flags are set in common.mk and add them as extra flags.
47
ifneq ($(GOLDFLAGS),)
58
GO_EXTRA_FLAGS += -ldflags $(GOLDFLAGS)
@@ -9,10 +12,20 @@ endif
912
all: build
1013

1114
# Build.
12-
build:
15+
build: oasis
16+
oasis: $(shell find -name "*.go" -type f) go.sum go.mod
1317
@$(ECHO) "$(MAGENTA)*** Building Go code...$(OFF)"
1418
@$(GO) build -v -o oasis $(GOFLAGS) $(GO_EXTRA_FLAGS)
1519

20+
examples: $(EXAMPLES)
21+
22+
examples/%.out: examples/%.in oasis
23+
@rm -f $@
24+
@scripts/gen_example.sh $< $@
25+
26+
clean-examples:
27+
@rm -f examples/*.out
28+
1629
# Format code.
1730
fmt:
1831
@$(ECHO) "$(CYAN)*** Running Go formatters...$(OFF)"
@@ -64,6 +77,8 @@ clean:
6477
# List of targets that are not actual files.
6578
.PHONY: \
6679
all build \
80+
examples \
81+
clean-examples \
6782
fmt \
6883
$(lint-targets) lint \
6984
$(test-targets) test \

examples/README.md

Lines changed: 53 additions & 0 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oasis account allow logan -- -10
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
You are about to sign the following transaction:
2+
Method: staking.Allow
3+
Body:
4+
Beneficiary: oasis1qpl4axynedmdrrgrg7dpw3yxc4a8crevr5dkuksl
5+
Amount change: -10.0 TEST
6+
Nonce: 0
7+
Fee:
8+
Amount: 0.0 TEST
9+
Gas limit: 1288
10+
(gas price: 0.0 TEST per gas unit)
11+
12+
Network: testnet
13+
ParaTime: none (consensus layer)
14+
Account: oscar
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oasis account from-public-key NcPzNW3YU2T+ugNUtUWtoQnRvbOL9dYSaBfbjHLP1pE=
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oasis1qrec770vrek0a9a5lcrv0zvt22504k68svq7kzve

examples/account.00.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oasis account show

examples/account.00.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Address: oasis1qp87hflmelnpqhzcqcw8rhzakq4elj7jzv090p3e
2+
Nonce: 0
3+
4+
=== CONSENSUS LAYER (testnet) ===
5+
Total: 0.0 TEST
6+
Available: 0.0 TEST
7+
8+

examples/account.01.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oasis account show orlando

0 commit comments

Comments
 (0)