From cd6523a49ffdf7f6ef58a72581900d9db4de3c32 Mon Sep 17 00:00:00 2001 From: Kyle Hoehns <9507268+kylehoehns@users.noreply.github.com> Date: Fri, 17 Nov 2023 14:02:19 +0000 Subject: [PATCH] add testify testing library for go --- go/README.md | 1 + go/go.mod | 8 ++++++++ go/go.sum | 10 ++++++++++ go/main_test.go | 10 ++++++---- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 go/go.sum diff --git a/go/README.md b/go/README.md index c12c01d..6d2e5f4 100644 --- a/go/README.md +++ b/go/README.md @@ -2,6 +2,7 @@ ## Tech Stack - Go 1.21 +- [Testify Assert](https://pkg.go.dev/github.com/stretchr/testify/assert) ## Common Commands - `make init` diff --git a/go/go.mod b/go/go.mod index 0b38219..bb6b293 100644 --- a/go/go.mod +++ b/go/go.mod @@ -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 +) diff --git a/go/go.sum b/go/go.sum new file mode 100644 index 0000000..fa4b6e6 --- /dev/null +++ b/go/go.sum @@ -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= diff --git a/go/main_test.go b/go/main_test.go index 36eeee3..090b539 100644 --- a/go/main_test.go +++ b/go/main_test.go @@ -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) }