Skip to content

Commit

Permalink
test: add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lsjbd committed May 16, 2022
1 parent d601095 commit 1fe6a81
Show file tree
Hide file tree
Showing 51 changed files with 3,365 additions and 10 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.16
go-version: 1.17

- uses: actions/cache@v2
with:
Expand All @@ -22,3 +22,6 @@ jobs:
- name: Benchmark
run: go test -bench=. -benchmem -run=none ./...

- name: Code Generation Test
run: make testall
7 changes: 4 additions & 3 deletions .github/workflows/push-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.16
go-version: 1.17

- uses: actions/cache@v2
with:
Expand All @@ -27,7 +27,8 @@ jobs:

- name: Lint
run: |
test -z "$(gofmt -s -l .)"
go install mvdan.cc/[email protected]
test -z "$(gofumpt -l -extra .)"
go vet -stdmethods=false $(go list ./...)
- name: Unit Test
Expand Down
4 changes: 4 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ header:
paths:
- '**/*.go'
- '**/*.s'
- '**/*.thrift'
- '**/*.sh'
- '**/Makefile'

paths-ignore:
- 'parser/AST.go'
- 'parser/thrift.peg.go'
- 'plugin/protocol.go'
- 'test/golang/cases_and_options/thrifttest/a.thrift'

comment: on-failure
43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2022 CloudWeGo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

OUT=$(PWD)/testdata
IDL=$(OUT)/x.thrift
COV_PROF=$(OUT)/cov.out

export IDL

.PHONY: all clean
all: lint test bench

lint:
go install mvdan.cc/[email protected]
test -z "$(gofumpt -l -extra .)"
go vet -stdmethods=false $(go list ./...)

bench:
go test -bench=. -benchmem -run=none ./...

test:
go test -race -covermode=atomic -coverprofile=$(COV_PROF) ./...

thriftgo:
go install

testall: thriftgo
@for d in test/*; do $(MAKE) -C $$d; done

clean:
rm -rf $(COV_PROF) $(IDL)

Loading

0 comments on commit 1fe6a81

Please sign in to comment.