diff --git a/README.md b/README.md index b7aaf83..b93c88b 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ import "github.com/romdo/gomockctx" ## Usage +Match against a specific context or any of its child contexts: + ```go // Create a context with a gomockctx ID value. ctx := gomockctx.New(context.Background()) @@ -39,6 +41,22 @@ someMock.EXPECT(). someMock.Get(ctx, "foo") ``` +Match against a context containing a specific value: + +```go +someMock.EXPECT(). + Get(gomockctx.WithValue(myCtxKey, "hello"), "foo"). + Return("bar", nil) +``` + +Match against any context: + +```go +someMock.EXPECT(). + Get(gomockctx.Any(), "foo"). + Return("bar", nil) +``` + ## Documentation Please see the