Last active
April 25, 2019 20:18
-
-
Save markstgodard/b2089fe13750000e081a1f23f7b60437 to your computer and use it in GitHub Desktop.
wat.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wat | |
// exporting only for testing | |
var Hello = hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wat | |
import "fmt" | |
// non exported function | |
func hello() error { | |
fmt.Println("hello") | |
return nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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