-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
|
||
language: go | ||
go_import_path: github.com/qmuntal/gopc | ||
|
||
go: | ||
- 1.10.x | ||
- 1.11.x | ||
|
||
env: | ||
- GO111MODULE=on | ||
|
||
notifications: | ||
- email: false | ||
|
||
before_script: | ||
- make setup | ||
|
||
script: | ||
- go test ./... -coverprofile=coverage.out -race -timeout=5s | ||
- $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.PHONY: setup | ||
setup: ## Install all the build and lint dependencies | ||
go get -u github.com/mattn/goveralls | ||
go get -u golang.org/x/tools/cmd/cover | ||
go get -t -v ./... | ||
|
||
.PHONY: setup-dev | ||
setup-dev: setup ## Install all the build, lint and dev dependencies | ||
go install github.com/golang/mock/mockgen | ||
|
||
.PHONY: verify | ||
verify: ## Verify module | ||
go mod tidy | ||
go mod verify | ||
|
||
.PHONY: gen | ||
gen: ## RUn go generate in all the directories | ||
go generate ./... | ||
|
||
.PHONY: test | ||
test: ## Run all the tests | ||
go test ./... -timeout=5s | ||
|
||
.PHONY: cover | ||
cover: ## Run all the tests with race detection and opens the coverage report | ||
go test ./... -coverprofile=coverage.out -race -timeout=5s | ||
go tool cover -html=coverage.out | ||
|
||
.PHONY: ci | ||
ci: ## Run all the tests and code checks | ||
verify | ||
lint | ||
test | ||
|
||
.PHONY: build | ||
build: ## Build a version | ||
go build -v ./... | ||
|
||
.PHONY: clean | ||
clean: ## Remove temporary files | ||
go clean | ||
|
||
.DEFAULT_GOAL := build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module github.com/qmuntal/gopc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package gopc | ||
|
||
// Relationship defines an OPC Package Relationship Object. | ||
type Relationship struct { | ||
} | ||
|
||
// NewRelationship creates a new relationship. | ||
func NewRelationship() *Relationship { | ||
return new(Relationship) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package gopc | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestNewRelationship(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
want *Relationship | ||
}{ | ||
{"new", new(Relationship)}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := NewRelationship(); !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("NewRelationship() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |