mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
9f0b3f5609
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
25 lines
613 B
Go
25 lines
613 B
Go
package term // import "github.com/docker/docker/pkg/term"
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gotest.tools/v3/assert"
|
|
is "gotest.tools/v3/assert/cmp"
|
|
)
|
|
|
|
func TestToBytes(t *testing.T) {
|
|
codes, err := ToBytes("ctrl-a,a")
|
|
assert.NilError(t, err)
|
|
assert.Check(t, is.DeepEqual([]byte{1, 97}, codes))
|
|
|
|
_, err = ToBytes("shift-z")
|
|
assert.Check(t, is.ErrorContains(err, ""))
|
|
|
|
codes, err = ToBytes("ctrl-@,ctrl-[,~,ctrl-o")
|
|
assert.NilError(t, err)
|
|
assert.Check(t, is.DeepEqual([]byte{0, 27, 126, 15}, codes))
|
|
|
|
codes, err = ToBytes("DEL,+")
|
|
assert.NilError(t, err)
|
|
assert.Check(t, is.DeepEqual([]byte{127, 43}, codes))
|
|
}
|