(t *testing.T)
| 133 | } |
| 134 | |
| 135 | func TestCodeRun(t *testing.T) { |
| 136 | var query = search.Query{ |
| 137 | Keywords: []string{"map"}, |
| 138 | Kind: "code", |
| 139 | Limit: 30, |
| 140 | Qualifiers: search.Qualifiers{ |
| 141 | Language: "go", |
| 142 | Repo: []string{"cli/cli"}, |
| 143 | }, |
| 144 | } |
| 145 | tests := []struct { |
| 146 | errMsg string |
| 147 | name string |
| 148 | opts *CodeOptions |
| 149 | tty bool |
| 150 | wantErr bool |
| 151 | wantStderr string |
| 152 | wantStdout string |
| 153 | wantBrowse string |
| 154 | }{ |
| 155 | { |
| 156 | name: "displays results tty", |
| 157 | opts: &CodeOptions{ |
| 158 | Query: query, |
| 159 | Searcher: &search.SearcherMock{ |
| 160 | CodeFunc: func(query search.Query) (search.CodeResult, error) { |
| 161 | return search.CodeResult{ |
| 162 | IncompleteResults: false, |
| 163 | Items: []search.Code{ |
| 164 | { |
| 165 | Name: "context.go", |
| 166 | Path: "context/context.go", |
| 167 | Repository: search.Repository{ |
| 168 | FullName: "cli/cli", |
| 169 | }, |
| 170 | TextMatches: []search.TextMatch{ |
| 171 | { |
| 172 | Fragment: "\t}\n\n\tvar repos []*api.Repository\n\trepoMap := map[string]bool{}\n\n\tadd := func(r *api.Repository) {\n\t\tfn := ghrepo.FullName(r)", |
| 173 | Matches: []search.Match{ |
| 174 | { |
| 175 | Text: "Map", |
| 176 | Indices: []int{38, 41}, |
| 177 | }, |
| 178 | { |
| 179 | Text: "map", |
| 180 | Indices: []int{45, 48}, |
| 181 | }, |
| 182 | }, |
| 183 | }, |
| 184 | }, |
| 185 | }, |
| 186 | { |
| 187 | Name: "pr.go", |
| 188 | Path: "pkg/cmd/pr/pr.go", |
| 189 | Repository: search.Repository{ |
| 190 | FullName: "cli/cli", |
| 191 | }, |
| 192 | TextMatches: []search.TextMatch{ |
nothing calls this directly
no test coverage detected