Skip to content

Commit cbbae07

Browse files
committed
Add test for Windows resize
1 parent 3121e10 commit cbbae07

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pty/pty_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func newPty() (PTY, error) {
4141
}
4242
ptyWindows.outputRead, ptyWindows.outputWrite, err = os.Pipe()
4343

44-
consoleSize := uintptr((int32(20) << 16) | int32(20))
44+
consoleSize := uintptr(80) + (uintptr(80) << 16)
4545
ret, _, err := procCreatePseudoConsole.Call(
4646
consoleSize,
4747
uintptr(ptyWindows.inputRead.Fd()),

pty/start_windows_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,19 @@ import (
1010
"github.com/coder/coder/pty/ptytest"
1111
)
1212

13+
func TestMain(m *testing.M) {
14+
goleak.VerifyTestMain(m)
15+
}
16+
1317
func TestStart(t *testing.T) {
1418
t.Run("Echo", func(t *testing.T) {
1519
pty := ptytest.Start(t, exec.Command("cmd.exe", "/c", "echo", "test"))
1620
pty.ExpectMatch("test")
1721
})
22+
23+
t.Run("Resize", func(t *testing.T) {
24+
pty := ptytest.Start(t, exec.Command("cmd.exe"))
25+
err := pty.Resize(100, 50)
26+
require.NoError(t, err)
27+
})
1828
}

0 commit comments

Comments
 (0)