Skip to content

Commit c1949bb

Browse files
committed
remove gotest.tools for testing
Reduce the number of dependencies for this module. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 53d9b52 commit c1949bb

File tree

5 files changed

+274
-122
lines changed

5 files changed

+274
-122
lines changed

ascii_test.go

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
11
package term
22

33
import (
4+
"bytes"
45
"testing"
5-
6-
"gotest.tools/v3/assert"
7-
is "gotest.tools/v3/assert/cmp"
86
)
97

108
func TestToBytes(t *testing.T) {
119
codes, err := ToBytes("ctrl-a,a")
12-
assert.NilError(t, err)
13-
assert.Check(t, is.DeepEqual([]byte{1, 97}, codes))
10+
if err != nil {
11+
t.Error(err)
12+
}
13+
expected := []byte{1, 97}
14+
if !bytes.Equal(codes, expected) {
15+
t.Errorf("expected: %+v, got: %+v", expected, codes)
16+
}
1417

1518
_, err = ToBytes("shift-z")
16-
assert.Check(t, is.ErrorContains(err, ""))
19+
if err == nil {
20+
t.Error("expected and error")
21+
}
1722

1823
codes, err = ToBytes("ctrl-@,ctrl-[,~,ctrl-o")
19-
assert.NilError(t, err)
20-
assert.Check(t, is.DeepEqual([]byte{0, 27, 126, 15}, codes))
24+
if err != nil {
25+
t.Error(err)
26+
}
27+
expected = []byte{0, 27, 126, 15}
28+
if !bytes.Equal(codes, expected) {
29+
t.Errorf("expected: %+v, got: %+v", expected, codes)
30+
}
2131

2232
codes, err = ToBytes("DEL,+")
23-
assert.NilError(t, err)
24-
assert.Check(t, is.DeepEqual([]byte{127, 43}, codes))
33+
if err != nil {
34+
t.Error(err)
35+
}
36+
expected = []byte{127, 43}
37+
if !bytes.Equal(codes, expected) {
38+
t.Errorf("expected: %+v, got: %+v", expected, codes)
39+
}
2540
}

go.mod

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,5 @@ go 1.18
55
require (
66
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1
77
github.com/creack/pty v1.1.11
8-
github.com/google/go-cmp v0.4.0
98
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
10-
gotest.tools/v3 v3.0.2
119
)
12-
13-
require github.com/pkg/errors v0.9.1 // indirect

go.sum

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,5 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOEl
22
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
33
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
44
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
5-
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
6-
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
7-
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
8-
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
9-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
10-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
11-
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
12-
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
13-
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
14-
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
15-
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
165
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio=
176
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
18-
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
19-
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
20-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
21-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
22-
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
23-
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=

0 commit comments

Comments
 (0)