Skip to content

Instantly share code, notes, and snippets.

@markstgodard
Last active April 25, 2019 20:18
Show Gist options
  • Save markstgodard/b2089fe13750000e081a1f23f7b60437 to your computer and use it in GitHub Desktop.
Save markstgodard/b2089fe13750000e081a1f23f7b60437 to your computer and use it in GitHub Desktop.
wat.go
package wat
// exporting only for testing
var Hello = hello
package wat
import "fmt"
// non exported function
func hello() error {
fmt.Println("hello")
return nil
}
package wat_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/markstgodard/wat"
)
var _ = Describe("Wat", func() {
Describe("hello", func() {
It("can test a private function by exporting for test only", func() {
err := wat.Hello()
Expect(err).NotTo(HaveOccurred())
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment