Last active
February 1, 2022 10:07
-
-
Save AntonStoeckl/77f127eb0d88a30bc9d349623a43677f to your computer and use it in GitHub Desktop.
Example for blog post: Go bits: Magic with functions
This file contains hidden or 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 functionsandinterfaces_test | |
import ( | |
"testing" | |
"github.com/matryer/is" | |
. "go-bits/magic-with-functions/functionsandinterfaces" | |
) | |
func Test_isBigger_with_a_closure(t *testing.T) { | |
// Arrange | |
shouldBe := is.New(t) | |
realFunction := RegisterCustomer | |
castedFunction := ForRegisteringCustomersFunc(realFunction) | |
handler := NewCustomerRegistrationHTTPHandler(castedFunction) | |
// Act | |
err := handler.Handle("John Doe", "[email protected]") | |
// Assert | |
shouldBe.NoErr(err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment