Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d526405

Browse filesBrowse files
authored
Merge pull request #19 from codecov/add-tests
Add tests
2 parents 86bfeda + ce83fb4 commit d526405
Copy full SHA for d526405

File tree

Expand file treeCollapse file tree

3 files changed

+20
-5
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+20
-5
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# [Codecov](https://codecov.io) Go Example
2+
3+
[![codecov](https://codecov.io/gh/codecov/example-go/branch/master/graph/badge.svg)](https://codecov.io/gh/codecov/example-go)
4+
[![Build Status](https://travis-ci.org/codecov/example-go.svg?branch=master)](https://travis-ci.org/codecov/example-go)
25
[![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)
36

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

6265

6366
## License
64-
[![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)
67+
[![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)

‎example_go.go

Copy file name to clipboardExpand all lines: example_go.go
+14-4Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,29 @@ import "github.com/codecov/example-go/awesome"
55
var result string
66

77
func Setup() {
8-
98
// Comment
10-
119
result = awesome.Smile()
1210

1311
}
1412

1513
func GetResult() string {
16-
1714
/*
1815
Comment
1916
*/
20-
2117
return result
18+
}
2219

20+
func UncoveredTest() int {
21+
x := 1
22+
x = x + 1
23+
return x
2324
}
25+
26+
func CoveredTest(num int) int {
27+
x := num + num
28+
return x
29+
}
30+
31+
func UncoveredSimpleTest() int { return 0 }
32+
33+
func CoveredSimpleTest() int { return 1 }

‎example_go_test.go

Copy file name to clipboardExpand all lines: example_go_test.go
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ var _ = Describe("Example", func() {
1111
It("should result :)", func() {
1212
Setup()
1313
Expect(GetResult()).To(Equal(":)"))
14+
Expect(CoveredTest(1)).To(Equal(2))
15+
Expect(CoveredSimpleTest()).To(Equal(1))
1416
})
1517
})
1618
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.