(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestDocumentSymbol(t *testing.T) { |
| 13 | testCases := []struct { |
| 14 | name string |
| 15 | content string |
| 16 | symbols []*protocol.DocumentSymbol |
| 17 | }{ |
| 18 | { |
| 19 | name: "empty file", |
| 20 | content: "", |
| 21 | symbols: []*protocol.DocumentSymbol{}, |
| 22 | }, |
| 23 | { |
| 24 | name: "empty services block", |
| 25 | content: "services:", |
| 26 | symbols: []*protocol.DocumentSymbol{}, |
| 27 | }, |
| 28 | { |
| 29 | name: "services block", |
| 30 | content: `services: |
| 31 | web: |
| 32 | build: . |
| 33 | redis: |
| 34 | image: "redis:alpine"`, |
| 35 | symbols: []*protocol.DocumentSymbol{ |
| 36 | { |
| 37 | Name: "web", |
| 38 | Kind: protocol.SymbolKindClass, |
| 39 | Range: protocol.Range{ |
| 40 | Start: protocol.Position{Line: 1, Character: 2}, |
| 41 | End: protocol.Position{Line: 1, Character: 5}, |
| 42 | }, |
| 43 | SelectionRange: protocol.Range{ |
| 44 | Start: protocol.Position{Line: 1, Character: 2}, |
| 45 | End: protocol.Position{Line: 1, Character: 5}, |
| 46 | }, |
| 47 | }, |
| 48 | { |
| 49 | Name: "redis", |
| 50 | Kind: protocol.SymbolKindClass, |
| 51 | Range: protocol.Range{ |
| 52 | Start: protocol.Position{Line: 3, Character: 2}, |
| 53 | End: protocol.Position{Line: 3, Character: 7}, |
| 54 | }, |
| 55 | SelectionRange: protocol.Range{ |
| 56 | Start: protocol.Position{Line: 3, Character: 2}, |
| 57 | End: protocol.Position{Line: 3, Character: 7}, |
| 58 | }, |
| 59 | }, |
| 60 | }, |
| 61 | }, |
| 62 | { |
| 63 | name: "services block with a piped scalar value", |
| 64 | content: `services: |
| 65 | web: | |
| 66 | this is a string`, |
| 67 | symbols: []*protocol.DocumentSymbol{ |
| 68 | { |
| 69 | Name: "web", |
nothing calls this directly
no test coverage detected