Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65dfbdd

Browse files
committed
wasm: Add dial timeout test
1 parent6840778 commit65dfbdd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎ws_js_test.go‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,19 @@ func TestWasm(t *testing.T) {
3636
err=c.Close(websocket.StatusNormalClosure,"")
3737
assert.Success(t,err)
3838
}
39+
40+
funcTestWasmDialTimeout(t*testing.T) {
41+
t.Parallel()
42+
43+
ctx,cancel:=context.WithTimeout(context.Background(),time.Millisecond)
44+
defercancel()
45+
46+
beforeDial:=time.Now()
47+
_,_,err:=websocket.Dial(ctx,"ws://example.com:9893",&websocket.DialOptions{
48+
Subprotocols: []string{"echo"},
49+
})
50+
assert.Error(t,err)
51+
iftime.Since(beforeDial)>=time.Second {
52+
t.Fatal("wasm context dial timeout is not working",time.Since(beforeDial))
53+
}
54+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp