summaryrefslogtreecommitdiff
path: root/vendor/github.com/golang/mock/sample/concurrent/concurrent_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2019-07-02 12:12:53 +0200
committerDimitri Sokolyuk <demon@dim13.org>2019-07-02 12:12:53 +0200
commit473acc61c8392dc7ae303d91568e179c4f105a76 (patch)
treea2070cba25f918cda460387e587dd60551b23894 /vendor/github.com/golang/mock/sample/concurrent/concurrent_test.go
parentdd45f63209a8e51979b11182253ee80b5289c10a (diff)
add black list
Diffstat (limited to 'vendor/github.com/golang/mock/sample/concurrent/concurrent_test.go')
-rw-r--r--vendor/github.com/golang/mock/sample/concurrent/concurrent_test.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/vendor/github.com/golang/mock/sample/concurrent/concurrent_test.go b/vendor/github.com/golang/mock/sample/concurrent/concurrent_test.go
deleted file mode 100644
index e4b271e..0000000
--- a/vendor/github.com/golang/mock/sample/concurrent/concurrent_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package concurrent
-
-import (
- "testing"
-
- "github.com/golang/mock/gomock"
- "golang.org/x/net/context"
-
- mock "github.com/golang/mock/sample/concurrent/mock"
-)
-
-func call(ctx context.Context, m Math) (int, error) {
- result := make(chan int)
- go func() {
- result <- m.Sum(1, 2)
- close(result)
- }()
- select {
- case r := <-result:
- return r, nil
- case <-ctx.Done():
- return 0, ctx.Err()
- }
-}
-
-// testConcurrentFails is expected to fail (and is disabled). It
-// demonstrates how to use gomock.WithContext to interrupt the test
-// from a different goroutine.
-func testConcurrentFails(t *testing.T) {
- ctrl, ctx := gomock.WithContext(context.Background(), t)
- defer ctrl.Finish()
- m := mock.NewMockMath(ctrl)
- if _, err := call(ctx, m); err != nil {
- t.Error("call failed:", err)
- }
-}
-
-func TestConcurrentWorks(t *testing.T) {
- ctrl, ctx := gomock.WithContext(context.Background(), t)
- defer ctrl.Finish()
- m := mock.NewMockMath(ctrl)
- m.EXPECT().Sum(1, 2).Return(3)
- if _, err := call(ctx, m); err != nil {
- t.Error("call failed:", err)
- }
-}