Calls OpenCamliInclude to open path, and checks that it contains "test"
(t *testing.T, path string)
| 43 | |
| 44 | // Calls OpenCamliInclude to open path, and checks that it contains "test" |
| 45 | func checkOpen(t *testing.T, path string) { |
| 46 | found, e := findCamliInclude(path) |
| 47 | if e != nil { |
| 48 | t.Errorf("Failed to find %v", path) |
| 49 | return |
| 50 | } |
| 51 | var file *os.File |
| 52 | file, e = os.Open(found) |
| 53 | if e != nil { |
| 54 | t.Errorf("Failed to open %v", path) |
| 55 | } else { |
| 56 | var d [10]byte |
| 57 | if n, _ := file.Read(d[:]); n != 4 { |
| 58 | t.Errorf("Read incorrect number of chars from test.config, wrong file?") |
| 59 | } |
| 60 | if string(d[0:4]) != "test" { |
| 61 | t.Errorf("Wrong test file content: %v", string(d[0:4])) |
| 62 | } |
| 63 | file.Close() |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // Test for error when file doesn't exist |
| 68 | func TestOpenCamliIncludeNoFile(t *testing.T) { |
no test coverage detected