MCPcopy
hub / github.com/cli/cli / TestStandardSearchString

Function TestStandardSearchString

pkg/search/query_test.go:11–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9var trueBool = true
10
11func TestStandardSearchString(t *testing.T) {
12 tests := []struct {
13 name string
14 query Query
15 out string
16 }{
17 {
18 name: "empty query",
19 out: "",
20 },
21 {
22 name: "converts query to string",
23 query: Query{
24 Keywords: []string{"some", "keywords"},
25 Qualifiers: Qualifiers{
26 Archived: &trueBool,
27 AuthorEmail: "foo@example.com",
28 CommitterDate: "2021-02-28",
29 Created: "created",
30 Extension: "go",
31 Filename: ".vimrc",
32 Followers: "1",
33 Fork: "true",
34 Forks: "2",
35 GoodFirstIssues: "3",
36 HelpWantedIssues: "4",
37 In: []string{"description", "readme"},
38 Language: "language",
39 License: []string{"license"},
40 Pushed: "updated",
41 Size: "5",
42 Stars: "6",
43 Topic: []string{"topic"},
44 Topics: "7",
45 User: []string{"user1", "user2"},
46 Is: []string{"public"},
47 },
48 },
49 out: "some keywords archived:true author-email:foo@example.com committer-date:2021-02-28 " +
50 "created:created extension:go filename:.vimrc followers:1 fork:true forks:2 good-first-issues:3 help-wanted-issues:4 " +
51 "in:description in:readme is:public language:language license:license pushed:updated size:5 " +
52 "stars:6 topic:topic topics:7 user:user1 user:user2",
53 },
54 {
55 name: "quotes keywords",
56 query: Query{
57 Keywords: []string{"quote keywords"},
58 },
59 out: `"quote keywords"`,
60 },
61 {
62 name: "quotes keywords that are qualifiers",
63 query: Query{
64 Keywords: []string{"quote:keywords", "quote:multiword keywords"},
65 },
66 out: `quote:keywords quote:"multiword keywords"`,
67 },
68 {

Callers

nothing calls this directly

Calls 3

EqualMethod · 0.80
StandardSearchStringMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected