(t *testing.T)
| 108 | } |
| 109 | |
| 110 | func TestAdvancedIssueSearchString(t *testing.T) { |
| 111 | tests := []struct { |
| 112 | name string |
| 113 | query Query |
| 114 | out string |
| 115 | }{ |
| 116 | { |
| 117 | name: "empty query", |
| 118 | out: "", |
| 119 | }, |
| 120 | { |
| 121 | name: "quotes keywords", |
| 122 | query: Query{ |
| 123 | Keywords: []string{"quote keywords"}, |
| 124 | }, |
| 125 | out: `"quote keywords"`, |
| 126 | }, |
| 127 | { |
| 128 | name: "quotes keywords that are qualifiers", |
| 129 | query: Query{ |
| 130 | Keywords: []string{"quote:keywords", "quote:multiword keywords"}, |
| 131 | }, |
| 132 | out: `quote:keywords quote:"multiword keywords"`, |
| 133 | }, |
| 134 | { |
| 135 | name: "quotes qualifiers", |
| 136 | query: Query{ |
| 137 | Qualifiers: Qualifiers{ |
| 138 | Label: []string{"quote qualifier"}, |
| 139 | }, |
| 140 | }, |
| 141 | out: `label:"quote qualifier"`, |
| 142 | }, |
| 143 | { |
| 144 | name: "respects immutable keywords", |
| 145 | query: Query{ |
| 146 | ImmutableKeywords: "immutable keyword that should be left as is", |
| 147 | }, |
| 148 | out: `immutable keyword that should be left as is`, |
| 149 | }, |
| 150 | { |
| 151 | name: "respects immutable keywords, with qualifiers", |
| 152 | query: Query{ |
| 153 | ImmutableKeywords: "immutable keyword that should be left as is", |
| 154 | Qualifiers: Qualifiers{ |
| 155 | Topic: []string{"quote qualifier"}, |
| 156 | }, |
| 157 | }, |
| 158 | out: `( immutable keyword that should be left as is ) topic:"quote qualifier"`, |
| 159 | }, |
| 160 | { |
| 161 | name: "prioritises immutable keywords over keywords slice", |
| 162 | query: Query{ |
| 163 | Keywords: []string{"foo", "bar"}, |
| 164 | ImmutableKeywords: "immutable keyword", |
| 165 | }, |
| 166 | out: `immutable keyword`, |
| 167 | }, |
nothing calls this directly
no test coverage detected