@@ -203,36 +203,36 @@ func testClientCancel(transport string, t *testing.T) {
203
203
wg .Wait ()
204
204
}
205
205
206
- // func TestClientSubscribeInvalidArg(t *testing.T) {
207
- // server := newTestServer()
208
- // defer server.Stop()
209
- // client := DialInProc(server)
210
- // defer client.Close()
211
- //
212
- // check := func(shouldPanic bool, arg interface{}) {
213
- // defer func() {
214
- // err := recover()
215
- // if shouldPanic && err == nil {
216
- // t.Errorf("EthSubscribe should've panicked for %#v", arg)
217
- // }
218
- // if !shouldPanic && err != nil {
219
- // t.Errorf("EthSubscribe shouldn't have panicked for %#v", arg)
220
- // buf := make([]byte, 1024*1024)
221
- // buf = buf[:runtime.Stack(buf, false)]
222
- // t.Error(err)
223
- // t.Error(string(buf))
224
- // }
225
- // }()
226
- // // todo
227
- // // client.EthSubscribe(context.Background(), arg, "foo_bar")
228
- // }
229
- // check(true, nil)
230
- // check(true, 1)
231
- // check(true, (chan int)(nil))
232
- // check(true, make(<-chan int))
233
- // check(false, make(chan int))
234
- // check(false, make(chan<- int))
235
- // }
206
+ func TestClientSubscribeInvalidArg (t * testing.T ) {
207
+ server := newTestServer ()
208
+ defer server .Stop ()
209
+ client := DialInProc (server )
210
+ defer client .Close ()
211
+
212
+ check := func (shouldPanic bool , arg interface {}) {
213
+ defer func () {
214
+ err := recover ()
215
+ if shouldPanic && err == nil {
216
+ t .Errorf ("EthSubscribe should've panicked for %#v" , arg )
217
+ }
218
+ if ! shouldPanic && err != nil {
219
+ t .Errorf ("EthSubscribe shouldn't have panicked for %#v" , arg )
220
+ buf := make ([]byte , 1024 * 1024 )
221
+ buf = buf [:runtime .Stack (buf , false )]
222
+ t .Error (err )
223
+ t .Error (string (buf ))
224
+ }
225
+ }()
226
+ // todo
227
+ client .EthSubscribe (context .Background (), arg , "foo_bar" )
228
+ }
229
+ check (true , nil )
230
+ check (true , 1 )
231
+ check (true , (chan int )(nil ))
232
+ check (true , make (<- chan int ))
233
+ check (false , make (chan int ))
234
+ check (false , make (chan <- int ))
235
+ }
236
236
237
237
func TestClientSubscribe (t * testing.T ) {
238
238
server := newTestServer ()
@@ -242,7 +242,7 @@ func TestClientSubscribe(t *testing.T) {
242
242
243
243
nc := make (chan int )
244
244
count := 10
245
- sub , err := client .Subscribe (context .Background (), "nftest" ,"someSubscription" , "" , "" , nc , count , 0 )
245
+ sub , err := client .Subscribe (context .Background (), "nftest" , nc , "someSubscription" , count , 0 )
246
246
247
247
if err != nil {
248
248
t .Fatal ("can't subscribe:" , err )
@@ -288,8 +288,7 @@ func TestClientSubscribeClose(t *testing.T) {
288
288
err error
289
289
)
290
290
go func () {
291
- // todo
292
- sub , err = client .Subscribe (context .Background (), "nftest2" , "hangSubscription" , "hangSubscription" , "hangSubscription" , nc )
291
+ sub , err = client .Subscribe (context .Background (), "nftest2" , nc , "hangSubscription" , 999 )
293
292
errc <- err
294
293
}()
295
294
@@ -319,8 +318,7 @@ func TestClientCloseUnsubscribeRace(t *testing.T) {
319
318
for i := 0 ; i < 20 ; i ++ {
320
319
client := DialInProc (server )
321
320
nc := make (chan int )
322
- // todo
323
- sub , err := client .Subscribe (context .Background (), "nftest" , "someSubscription" , "someSubscription" , "someSubscription" , nc )
321
+ sub , err := client .Subscribe (context .Background (), "nftest" , nc , "someSubscription" , 3 , 1 )
324
322
if err != nil {
325
323
t .Fatal (err )
326
324
}
@@ -349,8 +347,7 @@ func TestClientNotificationStorm(t *testing.T) {
349
347
// Subscribe on the server. It will start sending many notifications
350
348
// very quickly.
351
349
nc := make (chan int )
352
- // todo
353
- sub , err := client .Subscribe (ctx , "nftest" , "someSubscribe" , "" , "" , nc , count , 0 )
350
+ sub , err := client .Subscribe (ctx , "nftest" , nc , "someSubscription" , count , 0 )
354
351
if err != nil {
355
352
t .Fatal ("can't subscribe:" , err )
356
353
}
0 commit comments