(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func TestBodyPartialContent(t *testing.T) { |
| 19 | tests := []struct { |
| 20 | src string |
| 21 | schema *hcl.BodySchema |
| 22 | want *hcl.BodyContent |
| 23 | diagCount int |
| 24 | }{ |
| 25 | { |
| 26 | `{}`, |
| 27 | &hcl.BodySchema{}, |
| 28 | &hcl.BodyContent{ |
| 29 | Attributes: map[string]*hcl.Attribute{}, |
| 30 | MissingItemRange: hcl.Range{ |
| 31 | Filename: "test.json", |
| 32 | Start: hcl.Pos{Line: 1, Column: 2, Byte: 1}, |
| 33 | End: hcl.Pos{Line: 1, Column: 3, Byte: 2}, |
| 34 | }, |
| 35 | }, |
| 36 | 0, |
| 37 | }, |
| 38 | { |
| 39 | `[]`, |
| 40 | &hcl.BodySchema{}, |
| 41 | &hcl.BodyContent{ |
| 42 | Attributes: map[string]*hcl.Attribute{}, |
| 43 | MissingItemRange: hcl.Range{ |
| 44 | Filename: "test.json", |
| 45 | Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, |
| 46 | End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, |
| 47 | }, |
| 48 | }, |
| 49 | 0, |
| 50 | }, |
| 51 | { |
| 52 | `[{}]`, |
| 53 | &hcl.BodySchema{}, |
| 54 | &hcl.BodyContent{ |
| 55 | Attributes: map[string]*hcl.Attribute{}, |
| 56 | MissingItemRange: hcl.Range{ |
| 57 | Filename: "test.json", |
| 58 | Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, |
| 59 | End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, |
| 60 | }, |
| 61 | }, |
| 62 | 0, |
| 63 | }, |
| 64 | { |
| 65 | `[[]]`, |
| 66 | &hcl.BodySchema{}, |
| 67 | &hcl.BodyContent{ |
| 68 | Attributes: map[string]*hcl.Attribute{}, |
| 69 | MissingItemRange: hcl.Range{ |
| 70 | Filename: "test.json", |
| 71 | Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, |
| 72 | End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, |
| 73 | }, |
| 74 | }, |
| 75 | 1, // elements of root array must be objects |
nothing calls this directly
no test coverage detected