(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func TestParser_ParseFrom(t *testing.T) { |
| 105 | type Expected struct { |
| 106 | sources map[string][]string |
| 107 | aliases map[string]string |
| 108 | err error |
| 109 | } |
| 110 | |
| 111 | type Case struct { |
| 112 | input string |
| 113 | expected Expected |
| 114 | } |
| 115 | |
| 116 | u, err := user.Current() |
| 117 | if err != nil { |
| 118 | // TODO: If we can't get the current user, should we fatal or just return? |
| 119 | return |
| 120 | } |
| 121 | |
| 122 | cases := []Case{ |
| 123 | { |
| 124 | input: "WHERE", |
| 125 | expected: Expected{ |
| 126 | sources: map[string][]string{ |
| 127 | "include": {"."}, |
| 128 | "exclude": {}, |
| 129 | }, |
| 130 | aliases: map[string]string{}, |
| 131 | err: nil, |
| 132 | }, |
| 133 | }, |
| 134 | |
| 135 | { |
| 136 | input: "FROM .", |
| 137 | expected: Expected{ |
| 138 | sources: map[string][]string{ |
| 139 | "include": {"."}, |
| 140 | "exclude": {}, |
| 141 | }, |
| 142 | aliases: map[string]string{}, |
| 143 | err: nil, |
| 144 | }, |
| 145 | }, |
| 146 | |
| 147 | { |
| 148 | input: "FROM ~/foo, -./.git/", |
| 149 | expected: Expected{ |
| 150 | sources: map[string][]string{ |
| 151 | "include": {u.HomeDir + "/foo"}, |
| 152 | "exclude": {".git"}, |
| 153 | }, |
| 154 | aliases: map[string]string{}, |
| 155 | err: nil, |
| 156 | }, |
| 157 | }, |
| 158 | |
| 159 | { |
| 160 | input: "FROM ./foo/ AS foo", |
| 161 | expected: Expected{ |
nothing calls this directly
no test coverage detected