| 36 | const expectedHeader = `{"camliVersion"` |
| 37 | |
| 38 | func TestJSON(t *testing.T) { |
| 39 | fileName := "schema_test.go" |
| 40 | fi, _ := os.Lstat(fileName) |
| 41 | m := NewCommonFileMap(fileName, fi) |
| 42 | json, err := m.JSON() |
| 43 | if err != nil { |
| 44 | t.Fatalf("Unexpected error: %v", err) |
| 45 | } |
| 46 | t.Logf("Got json: [%s]\n", json) |
| 47 | // TODO: test it parses back |
| 48 | |
| 49 | if !strings.HasPrefix(json, expectedHeader) { |
| 50 | t.Errorf("JSON doesn't start with expected header.") |
| 51 | } |
| 52 | |
| 53 | } |
| 54 | |
| 55 | func TestRegularFile(t *testing.T) { |
| 56 | fileName := "schema_test.go" |