1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
package ansi
import "testing"
func TestOscSequence_String(t *testing.T) {
tests := []struct {
name string
s OscSequence
want string
}{
{
name: "empty",
s: OscSequence{
Cmd: 0,
Data: []byte("0;"),
},
want: "\x1b]0;\a",
},
{
name: "with data",
s: OscSequence{
Cmd: 1,
Data: []byte("1;hello"),
},
want: "\x1b]1;hello\x07",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.s.String(); got != tt.want {
t.Errorf("OscSequence.String() = %q, want %q", got, tt.want)
}
})
}
}
|