We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e0c90ac commit ed609baCopy full SHA for ed609ba
mmap/mmap_test.go
@@ -1,6 +1,7 @@
1
package mmap
2
3
import (
4
+ "bytes"
5
"os"
6
"testing"
7
)
@@ -32,3 +33,27 @@ func TestReadFile(t *testing.T) {
32
33
t.Fatal(err)
34
}
35
36
+
37
+func TestReadCustomFile(t *testing.T) {
38
+ name, ok := os.LookupEnv("SSGO_MMAP_TEST_FILE")
39
+ if !ok {
40
+ t.Skip("SSGO_MMAP_TEST_FILE is not set")
41
+ }
42
43
+ expectedData, err := os.ReadFile(name)
44
+ if err != nil {
45
+ t.Fatal(err)
46
47
48
+ data, close, err := ReadFile[[]byte](name)
49
50
51
52
+ if !bytes.Equal(data, expectedData) {
53
+ t.Errorf("data = %v, want %v", data, expectedData)
54
55
56
+ if err = close(); err != nil {
57
58
59
+}
0 commit comments