Skip to content

Commit 4f201c1

Browse files
authored
Merge pull request #122 from rosstimothy/tross/remove_testing
Move hexDecode test helper into a test file
2 parents ebae973 + 5d1cc26 commit 4f201c1

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

signerverifier/utils.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"encoding/pem"
99
"errors"
1010
"hash"
11-
"testing"
1211

1312
"github.com/secure-systems-lab/go-securesystemslib/cjson"
1413
)
@@ -141,12 +140,3 @@ func hashBeforeSigning(data []byte, h hash.Hash) []byte {
141140
h.Write(data)
142141
return h.Sum(nil)
143142
}
144-
145-
func hexDecode(t *testing.T, data string) []byte {
146-
t.Helper()
147-
b, err := hex.DecodeString(data)
148-
if err != nil {
149-
t.Fatal(err)
150-
}
151-
return b
152-
}

signerverifier/utils_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
package signerverifier
22

33
import (
4+
"encoding/hex"
45
"os"
56
"path/filepath"
67
"testing"
78

89
"github.com/stretchr/testify/assert"
910
)
1011

12+
func hexDecode(t *testing.T, data string) []byte {
13+
t.Helper()
14+
b, err := hex.DecodeString(data)
15+
if err != nil {
16+
t.Fatal(err)
17+
}
18+
return b
19+
}
20+
1121
func TestLoadKeyFromSSLibBytes(t *testing.T) {
1222
t.Run("RSA public key", func(t *testing.T) {
1323
contents, err := os.ReadFile(filepath.Join("test-data", "rsa-test-key.pub"))

0 commit comments

Comments
 (0)