Skip to content

Commit 76218f0

Browse files
committed
Fix tty test and pkg doc
1 parent 04d7943 commit 76218f0

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ func TestRemoteStdin(t *testing.T) {
4343

4444
header, body := proto.SplitMessage(msg)
4545

46-
assert.Equal(t, "stdin body", body, []byte(tcase), bytecmp)
47-
assert.Equal(t, "stdin header", header, []byte(`{"type":"stdin"}`), bytecmp)
46+
assert.Equal(t, "stdin body", []byte(tcase), body, bytecmp)
47+
assert.Equal(t, "stdin header", []byte(`{"type":"stdin"}`), header, bytecmp)
4848
}
4949
}
5050

doc.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Package wsep provides server and client interfaces
2+
// for transmitting Linux command execution over a Websocket connection.
3+
4+
// It provides stdin, stdout, stderr, tty operations, and exit code information.
5+
6+
package wsep

internal/proto/protocol_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestWithHeader(t *testing.T) {
3737
assert.Success(t, "read buffer", err)
3838

3939
header, body := SplitMessage(msg)
40-
assert.Equal(t, "header is expected value", header, tcase.header, bytecmp)
41-
assert.Equal(t, "body is expected value", body, tcase.body, bytecmp)
40+
assert.Equal(t, "header is expected value", tcase.header, header, bytecmp)
41+
assert.Equal(t, "body is expected value", tcase.body, body, bytecmp)
4242
}
4343
}

localexec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func testExecer(ctx context.Context, t *testing.T, execer Execer) {
4343

4444
stderr, err := ioutil.ReadAll(process.Stderr())
4545
assert.Success(t, "read stderr", err)
46-
assert.Equal(t, "len stderr", 0, len(stderr))
46+
assert.True(t, "len stderr", len(stderr) == 0)
4747
}()
4848

4949
err = process.Wait()

tty_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ func testTTY(ctx context.Context, t *testing.T, e Execer) {
3737

3838
stdout, err := ioutil.ReadAll(process.Stdout())
3939
assert.Success(t, "read stdout", err)
40+
4041
t.Logf("bash tty stdout = %s", stdout)
41-
assert.True(t, `bash "$" prompt found`, strings.HasSuffix(string(stdout), "$ "))
42+
prompt := string(stdout)
43+
assert.True(t, `bash "$" prompt found`,
44+
strings.HasSuffix(prompt, "$ ") || strings.HasSuffix(prompt, "# "))
4245
}()
4346
go func() {
4447
wg.Add(1)

0 commit comments

Comments
 (0)