Skip to content

Commit

Permalink
Merge pull request #19 from codecov/add-tests
Browse files Browse the repository at this point in the history
Add tests
  • Loading branch information
thomasrockhu committed Sep 17, 2020
2 parents 86bfeda + ce83fb4 commit d526405
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# [Codecov](https://codecov.io) Go Example

[![codecov](https://codecov.io/gh/codecov/example-go/branch/master/graph/badge.svg)](https://codecov.io/gh/codecov/example-go)
[![Build Status](https://travis-ci.org/codecov/example-go.svg?branch=master)](https://travis-ci.org/codecov/example-go)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-go.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-go?ref=badge_shield)

> Note: use `-covermode=atomic` or `-covermode=count` to show how many times a statement was executed.
Expand Down Expand Up @@ -61,4 +64,4 @@ Repository tokens are required for (a) all private repos, (b) public repos not u


## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-go.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-go?ref=badge_large)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-go.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-go?ref=badge_large)
18 changes: 14 additions & 4 deletions example_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,29 @@ import "github.com/codecov/example-go/awesome"
var result string

func Setup() {

// Comment

result = awesome.Smile()

}

func GetResult() string {

/*
Comment
*/

return result
}

func UncoveredTest() int {
x := 1
x = x + 1
return x
}

func CoveredTest(num int) int {
x := num + num
return x
}

func UncoveredSimpleTest() int { return 0 }

func CoveredSimpleTest() int { return 1 }
2 changes: 2 additions & 0 deletions example_go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ var _ = Describe("Example", func() {
It("should result :)", func() {
Setup()
Expect(GetResult()).To(Equal(":)"))
Expect(CoveredTest(1)).To(Equal(2))
Expect(CoveredSimpleTest()).To(Equal(1))
})
})
})
Expand Down

0 comments on commit d526405

Please sign in to comment.