Skip to content

Commit

Permalink
add testify testing library for go
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehoehns committed Nov 17, 2023
1 parent 991f2bf commit cd6523a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Tech Stack
- Go 1.21
- [Testify Assert](https://pkg.go.dev/github.com/stretchr/testify/assert)

## Common Commands
- `make init`
Expand Down
8 changes: 8 additions & 0 deletions go/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
module interview

go 1.21.2

require github.com/stretchr/testify v1.8.4

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 10 additions & 0 deletions go/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10 changes: 6 additions & 4 deletions go/main_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package main

import "testing"
import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestSayHello(t *testing.T) {
result := SayHello("world!")
if result != "Hello world!" {
t.Fatalf("Expected Hello world!, got=%s", result)
}
assert.Equal(t, "Hello world!", result)
}

0 comments on commit cd6523a

Please sign in to comment.