...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package layout
16
17 import (
18 "testing"
19 )
20
21 func TestRead(t *testing.T) {
22 lp, err := FromPath(testPath)
23 if err != nil {
24 t.Fatalf("FromPath() = %v", err)
25 }
26 if testPath != lp.path() {
27 t.Errorf("unexpected path %s", lp.path())
28 }
29 }
30
31 func TestReadErrors(t *testing.T) {
32 if _, err := FromPath(bogusPath); err == nil {
33 t.Errorf("FromPath(%s) = nil, expected err", bogusPath)
34 }
35
36
37
38 invalidPath := "double-null-padded-string\x00\x00"
39 if _, err := FromPath(invalidPath); err == nil {
40 t.Errorf("FromPath(%s) = nil, expected err", bogusPath)
41 }
42 }
43
View as plain text