(t *testing.T)
| 31 | ) |
| 32 | |
| 33 | func TestNavigateAST(t *testing.T) { |
| 34 | tests := []struct { |
| 35 | expr string |
| 36 | descendantCount int |
| 37 | callCount int |
| 38 | maxDepth int |
| 39 | maxID int64 |
| 40 | }{ |
| 41 | { |
| 42 | expr: `'a' == 'b'`, |
| 43 | descendantCount: 3, |
| 44 | callCount: 1, |
| 45 | maxDepth: 1, |
| 46 | maxID: 4, |
| 47 | }, |
| 48 | { |
| 49 | expr: `'a'.size()`, |
| 50 | descendantCount: 2, |
| 51 | callCount: 1, |
| 52 | maxDepth: 1, |
| 53 | maxID: 3, |
| 54 | }, |
| 55 | { |
| 56 | expr: `[1, 2, 3]`, |
| 57 | descendantCount: 4, |
| 58 | callCount: 0, |
| 59 | maxDepth: 1, |
| 60 | maxID: 5, |
| 61 | }, |
| 62 | { |
| 63 | expr: `[1, 2, 3][0]`, |
| 64 | descendantCount: 6, |
| 65 | callCount: 1, |
| 66 | maxDepth: 2, |
| 67 | maxID: 7, |
| 68 | }, |
| 69 | { |
| 70 | expr: `{1u: 'hello'}`, |
| 71 | descendantCount: 3, |
| 72 | callCount: 0, |
| 73 | maxDepth: 1, |
| 74 | maxID: 5, |
| 75 | }, |
| 76 | { |
| 77 | expr: `{'hello': 'world'}.hello`, |
| 78 | descendantCount: 4, |
| 79 | callCount: 0, |
| 80 | maxDepth: 2, |
| 81 | maxID: 6, |
| 82 | }, |
| 83 | { |
| 84 | expr: `type(1) == int`, |
| 85 | descendantCount: 4, |
| 86 | callCount: 2, |
| 87 | maxDepth: 2, |
| 88 | maxID: 5, |
| 89 | }, |
| 90 | { |
nothing calls this directly
no test coverage detected