blob: 511d922f5967c2b7db0b89c0b9f2a1e756c6e751 [file] [log] [blame]
Václav Kubernát4108e0d2018-10-29 13:32:22 +01001/*
2 * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
3 * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
4 *
5 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
6 *
7*/
8
Václav Kubernát26b56082020-02-03 18:28:56 +01009#include "trompeloeil_doctest.hpp"
Václav Kubernát43908fb2020-01-02 19:05:51 +010010#include "datastoreaccess_mock.hpp"
Václav Kubernát4108e0d2018-10-29 13:32:22 +010011#include "parser.hpp"
Václav Kubernát1ed4aa32020-01-23 13:13:28 +010012#include "pretty_printers.hpp"
Václav Kubernát4108e0d2018-10-29 13:32:22 +010013#include "static_schema.hpp"
14
15TEST_CASE("path_completion")
16{
17 auto schema = std::make_shared<StaticSchema>();
18 schema->addModule("example");
19 schema->addModule("second");
Václav Kubernátefcac932020-01-10 15:26:32 +010020 schema->addContainer("/", "example:ano");
21 schema->addContainer("/", "example:anoda");
22 schema->addList("/example:ano", "example:listInCont", {"number"});
23 schema->addContainer("/", "second:amelie");
24 schema->addContainer("/", "example:bota");
25 schema->addContainer("/example:ano", "example:a2");
26 schema->addContainer("/example:bota", "example:b2");
27 schema->addContainer("/example:ano/example:a2", "example:a3");
28 schema->addContainer("/example:bota/example:b2", "example:b3");
29 schema->addList("/", "example:list", {"number"});
Václav Kubernát3a99f002020-03-31 02:27:41 +020030 schema->addLeaf("/example:list", "example:number", yang::Int32{});
Václav Kubernátefcac932020-01-10 15:26:32 +010031 schema->addContainer("/example:list", "example:contInList");
Václav Kubernát7707cae2020-01-16 12:04:53 +010032 schema->addList("/", "example:ovoce", {"name"});
Václav Kubernát3a99f002020-03-31 02:27:41 +020033 schema->addLeaf("/example:ovoce", "example:name", yang::String{});
Václav Kubernát7707cae2020-01-16 12:04:53 +010034 schema->addList("/", "example:ovocezelenina", {"name"});
Václav Kubernát3a99f002020-03-31 02:27:41 +020035 schema->addLeaf("/example:ovocezelenina", "example:name", yang::String{});
Václav Kubernátefcac932020-01-10 15:26:32 +010036 schema->addList("/", "example:twoKeyList", {"number", "name"});
Václav Kubernát3a99f002020-03-31 02:27:41 +020037 schema->addLeaf("/example:twoKeyList", "example:name", yang::String{});
38 schema->addLeaf("/example:twoKeyList", "example:number", yang::Int32{});
39 schema->addLeaf("/", "example:leafInt", yang::Int32{});
Václav Kubernátabf52802020-05-19 01:31:17 +020040 schema->addLeaf("/", "example:readonly", yang::Int32{}, yang::AccessType::ReadOnly);
Václav Kubernát743d9eb2020-05-18 13:42:36 +020041 schema->addLeafList("/", "example:addresses", yang::String{});
Václav Kubernáte7248b22020-06-26 15:38:59 +020042 schema->addRpc("/", "second:fire");
43 schema->addLeaf("/second:fire", "second:whom", yang::String{});
Václav Kubernátce108db2021-01-25 10:05:40 +010044 schema->addContainer("/", "example:system");
45 schema->addContainer("/example:system", "example:thing");
46 schema->addContainer("/", "example:system-state");
Václav Kubernát43908fb2020-01-02 19:05:51 +010047 auto mockDatastore = std::make_shared<MockDatastoreAccess>();
48
49 // The parser will use DataQuery for key value completion, but I'm not testing that here, so I don't return anything.
50 ALLOW_CALL(*mockDatastore, listInstances("/example:list"))
51 .RETURN(std::vector<ListInstance>{});
52 ALLOW_CALL(*mockDatastore, listInstances("/example:twoKeyList"))
53 .RETURN(std::vector<ListInstance>{});
54
55 // DataQuery gets the schema from DatastoreAccess once
56 auto expectation = NAMED_REQUIRE_CALL(*mockDatastore, schema())
57 .RETURN(schema);
58 auto dataQuery = std::make_shared<DataQuery>(*mockDatastore);
59 expectation.reset();
Václav Kubernát28cf3362020-06-29 17:52:51 +020060 Parser parser(schema, WritableOps::No, dataQuery);
Václav Kubernát4108e0d2018-10-29 13:32:22 +010061 std::string input;
62 std::ostringstream errorStream;
Václav Kubernát1ed4aa32020-01-23 13:13:28 +010063
64 std::set<std::string> expectedCompletions;
65 // GCC complains here with -Wmaybe-uninitialized if I don't assign
66 // something here. I suspect it's because of nested SECTIONs. -1 is an
67 // invalid value (as in, I'll never expect expectedContextLength to be -1),
68 // so let's go with that.
69 int expectedContextLength = -1;
Václav Kubernát4108e0d2018-10-29 13:32:22 +010070
Václav Kubernát329c6c32019-02-06 16:41:53 +010071 SECTION("node name completion")
Václav Kubernát4108e0d2018-10-29 13:32:22 +010072 {
Václav Kubernát329c6c32019-02-06 16:41:53 +010073 SECTION("ls ")
74 {
75 input = "ls ";
Václav Kubernátce108db2021-01-25 10:05:40 +010076 expectedCompletions = {"example:addresses/", "example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list/", "example:ovoce/", "example:readonly ", "example:ovocezelenina/", "example:twoKeyList/", "second:amelie/", "second:fire/", "example:system/", "example:system-state/"};
Václav Kubernát1ed4aa32020-01-23 13:13:28 +010077 expectedContextLength = 0;
Václav Kubernát329c6c32019-02-06 16:41:53 +010078 }
79
80 SECTION("ls e")
81 {
82 input = "ls e";
Václav Kubernátce108db2021-01-25 10:05:40 +010083 expectedCompletions = {"example:addresses/", "example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list/", "example:ovoce/", "example:readonly ", "example:ovocezelenina/", "example:twoKeyList/", "example:system/", "example:system-state/"};
Václav Kubernát1ed4aa32020-01-23 13:13:28 +010084 expectedContextLength = 1;
Václav Kubernát329c6c32019-02-06 16:41:53 +010085 }
86
87 SECTION("ls example:ano")
88 {
89 input = "ls example:ano";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +010090 expectedCompletions = {"example:ano/", "example:anoda/"};
91 expectedContextLength = 11;
Václav Kubernát329c6c32019-02-06 16:41:53 +010092 }
93
Václav Kubernáte2d629f2020-04-28 11:01:54 +020094 SECTION("ls example:ano/a")
Václav Kubernát329c6c32019-02-06 16:41:53 +010095 {
Václav Kubernáte2d629f2020-04-28 11:01:54 +020096 input = "ls example:ano/a";
97 expectedCompletions = {"a2/"};
98 expectedContextLength = 1;
Václav Kubernát329c6c32019-02-06 16:41:53 +010099 }
100
101 SECTION("ls x")
102 {
103 input = "ls x";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100104 expectedCompletions = {};
105 expectedContextLength = 1;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100106 }
107
108 SECTION("ls /")
109 {
110 input = "ls /";
Václav Kubernátce108db2021-01-25 10:05:40 +0100111 expectedCompletions = {"example:addresses/", "example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list/", "example:ovoce/", "example:readonly ", "example:ovocezelenina/", "example:twoKeyList/", "second:amelie/", "second:fire/", "example:system/", "example:system-state/"};
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100112 expectedContextLength = 0;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100113 }
114
115 SECTION("ls /e")
116 {
117 input = "ls /e";
Václav Kubernátce108db2021-01-25 10:05:40 +0100118 expectedCompletions = {"example:addresses/", "example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list/", "example:ovoce/", "example:readonly ", "example:ovocezelenina/", "example:twoKeyList/", "example:system/", "example:system-state/"};
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100119 expectedContextLength = 1;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100120 }
121
Václav Kubernáte69133a2019-11-01 19:01:34 +0100122 SECTION("ls example:bota")
123 {
124 input = "ls example:bota";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100125 expectedCompletions = {"example:bota/"};
126 expectedContextLength = 12;
Václav Kubernáte69133a2019-11-01 19:01:34 +0100127 }
128
129 SECTION("ls /example:bota")
130 {
131 input = "ls /example:bota";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100132 expectedCompletions = {"example:bota/"};
133 expectedContextLength = 12;
Václav Kubernáte69133a2019-11-01 19:01:34 +0100134 }
135
Václav Kubernát329c6c32019-02-06 16:41:53 +0100136 SECTION("ls /s")
137 {
138 input = "ls /s";
Václav Kubernáte7248b22020-06-26 15:38:59 +0200139 expectedCompletions = {"second:amelie/", "second:fire/"};
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100140 expectedContextLength = 1;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100141 }
142
Václav Kubernát743d9eb2020-05-18 13:42:36 +0200143 SECTION("ls /example:list")
144 {
145 input = "ls /example:list";
146 expectedCompletions = {"example:list/"};
147 expectedContextLength = 12;
148 }
149
Václav Kubernát26be33a2020-02-13 13:30:14 +0100150 SECTION("ls /example:list/")
151 {
152 input = "ls /example:list/";
Václav Kubernáte2d629f2020-04-28 11:01:54 +0200153 expectedCompletions = {"contInList/", "number "};
Václav Kubernát26be33a2020-02-13 13:30:14 +0100154 expectedContextLength = 0;
155 }
156
Václav Kubernát329c6c32019-02-06 16:41:53 +0100157 SECTION("ls /example:list[number=3]/")
158 {
159 input = "ls /example:list[number=3]/";
Václav Kubernáte2d629f2020-04-28 11:01:54 +0200160 expectedCompletions = {"contInList/", "number "};
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100161 expectedContextLength = 0;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100162 }
163
164 SECTION("ls /example:list[number=3]/c")
165 {
Václav Kubernáte2d629f2020-04-28 11:01:54 +0200166 input = "ls /example:list[number=3]/c";
167 expectedCompletions = {"contInList/"};
168 expectedContextLength = 1;
169 }
170
171 SECTION("ls /example:list[number=3]/n")
172 {
173 input = "ls /example:list[number=3]/n";
174 expectedCompletions = {"number "};
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100175 expectedContextLength = 1;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100176 }
177
178 SECTION("ls /example:list[number=3]/a")
179 {
180 input = "ls /example:list[number=3]/a";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100181 expectedCompletions = {};
182 expectedContextLength = 1;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100183 }
Václav Kubernát26be33a2020-02-13 13:30:14 +0100184
Václav Kubernáte2d629f2020-04-28 11:01:54 +0200185 SECTION("ls /example:list/contInList/")
Václav Kubernát26be33a2020-02-13 13:30:14 +0100186 {
Václav Kubernáte2d629f2020-04-28 11:01:54 +0200187 input = "ls /example:list/contInList/";
Václav Kubernát26be33a2020-02-13 13:30:14 +0100188 expectedCompletions = {};
189 expectedContextLength = 0;
190 }
Václav Kubernátce108db2021-01-25 10:05:40 +0100191
192 SECTION("ls /example:system-")
193 {
194 input = "ls /example:system-";
195 expectedCompletions = {"example:system-state/"};
196 expectedContextLength = 15;
197 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100198 }
199
Václav Kubernát7eb47152020-11-12 16:57:03 +0100200 SECTION("get completion")
201 {
202 SECTION("get /example:ano/l")
203 {
204 input = "get /example:ano/l";
205 expectedCompletions = {"listInCont"};
206 expectedContextLength = 1;
207 }
Václav Kubernát85ba7382020-11-18 18:11:18 +0100208
209 SECTION("get /example:list/")
210 {
211 input = "get /example:list/";
212 expectedCompletions = {};
213 // The expectedContextLength is 13, because the completion isn't actually generated after the slash.
214 expectedContextLength = 13;
215 }
Václav Kubernát7eb47152020-11-12 16:57:03 +0100216 }
217
Václav Kubernát3200b862020-12-03 02:34:55 +0100218 SECTION("describe completion")
219 {
220 SECTION("path with list at the end")
221 {
222 input = "describe /example:list/";
223 expectedCompletions = {"contInList/", "number "};
224 expectedContextLength = 0;
225 }
226 }
227
Václav Kubernát329c6c32019-02-06 16:41:53 +0100228 SECTION("list keys completion")
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100229 {
Václav Kubernát329c6c32019-02-06 16:41:53 +0100230 SECTION("cd example:lis")
231 {
232 input = "cd example:lis";
Václav Kubernátcb3af402020-02-12 16:49:17 +0100233 expectedCompletions = {"example:list"};
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100234 expectedContextLength = 11;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100235 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100236
Václav Kubernát51853b22019-04-16 21:53:44 +0200237 SECTION("set example:list")
238 {
239 input = "set example:list";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100240 expectedCompletions = {"example:list["};
241 expectedContextLength = 12;
Václav Kubernát4c325482019-04-11 17:51:55 +0200242 }
243
244 SECTION("cd example:list")
245 {
246 input = "cd example:list";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100247 expectedCompletions = {"example:list["};
248 expectedContextLength = 12;
Václav Kubernát51853b22019-04-16 21:53:44 +0200249 }
250
Václav Kubernát329c6c32019-02-06 16:41:53 +0100251 SECTION("cd example:list[")
252 {
253 input = "cd example:list[";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100254 expectedCompletions = {"number="};
255 expectedContextLength = 0;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100256 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100257
Václav Kubernát329c6c32019-02-06 16:41:53 +0100258 SECTION("cd example:list[numb")
259 {
260 input = "cd example:list[numb";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100261 expectedCompletions = {"number="};
262 expectedContextLength = 4;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100263 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100264
Václav Kubernát329c6c32019-02-06 16:41:53 +0100265 SECTION("cd example:list[number")
266 {
267 input = "cd example:list[number";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100268 expectedCompletions = {"number="};
269 expectedContextLength = 6;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100270 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100271
Václav Kubernát117f7b52020-01-23 16:10:55 +0100272 SECTION("cd example:list[number=")
273 {
274 input = "cd example:list[number=";
Václav Kubernát43908fb2020-01-02 19:05:51 +0100275 expectedCompletions = {};
276 expectedContextLength = 0;
Václav Kubernát117f7b52020-01-23 16:10:55 +0100277 }
278
Václav Kubernát329c6c32019-02-06 16:41:53 +0100279 SECTION("cd example:list[number=12")
280 {
281 input = "cd example:list[number=12";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100282 expectedCompletions = {"]/"};
283 expectedContextLength = 0;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100284 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100285
Václav Kubernát329c6c32019-02-06 16:41:53 +0100286 SECTION("cd example:list[number=12]")
287 {
288 input = "cd example:list[number=12]";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100289 expectedCompletions = {"]/"};
290 expectedContextLength = 1;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100291 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100292
Václav Kubernát329c6c32019-02-06 16:41:53 +0100293 SECTION("cd example:twoKeyList[")
294 {
295 input = "cd example:twoKeyList[";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100296 expectedCompletions = {"name=", "number="};
297 expectedContextLength = 0;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100298 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100299
Václav Kubernát4c325482019-04-11 17:51:55 +0200300 SECTION("cd example:twoKeyList[name=\"AHOJ\"")
301 {
302 input = "cd example:twoKeyList[name=\"AHOJ\"";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100303 expectedCompletions = {"]["};
304 expectedContextLength = 0;
Václav Kubernát4c325482019-04-11 17:51:55 +0200305 }
306
307 SECTION("cd example:twoKeyList[name=\"AHOJ\"]")
308 {
309 input = "cd example:twoKeyList[name=\"AHOJ\"]";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100310 expectedCompletions = {"]["};
311 expectedContextLength = 1;
Václav Kubernát4c325482019-04-11 17:51:55 +0200312 }
313
Václav Kubernát329c6c32019-02-06 16:41:53 +0100314 SECTION("cd example:twoKeyList[name=\"AHOJ\"][")
315 {
316 input = "cd example:twoKeyList[name=\"AHOJ\"][";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100317 expectedCompletions = {"number="};
318 expectedContextLength = 0;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100319 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100320
Václav Kubernát329c6c32019-02-06 16:41:53 +0100321 SECTION("cd example:twoKeyList[number=42][")
322 {
323 input = "cd example:twoKeyList[number=42][";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100324 expectedCompletions = {"name="};
325 expectedContextLength = 0;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100326 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100327
Václav Kubernát329c6c32019-02-06 16:41:53 +0100328 SECTION("cd example:twoKeyList[name=\"AHOJ\"][number=123")
329 {
330 input = "cd example:twoKeyList[name=\"AHOJ\"][number=123";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100331 expectedCompletions = {"]/"};
332 expectedContextLength = 0;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100333 }
334
335 SECTION("cd example:twoKeyList[name=\"AHOJ\"][number=123]")
336 {
337 input = "cd example:twoKeyList[name=\"AHOJ\"][number=123]";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100338 expectedCompletions = {"]/"};
339 expectedContextLength = 1;
Václav Kubernát329c6c32019-02-06 16:41:53 +0100340 }
Václav Kubernát4c325482019-04-11 17:51:55 +0200341
342 SECTION("cd example:ovoce")
343 {
344 input = "cd example:ovoce";
Václav Kubernátcb3af402020-02-12 16:49:17 +0100345 expectedCompletions = {"example:ovoce", "example:ovocezelenina"};
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100346 expectedContextLength = 13;
Václav Kubernát4c325482019-04-11 17:51:55 +0200347 }
Václav Kubernátcb3af402020-02-12 16:49:17 +0100348
349 SECTION("cd example:ovoceze")
350 {
351 input = "cd example:ovoceze";
352 expectedCompletions = {"example:ovocezelenina"};
353 expectedContextLength = 15;
354 }
355
356 SECTION("cd example:ovocezelenina")
357 {
358 input = "cd example:ovocezelenina";
359 expectedCompletions = {"example:ovocezelenina["};
360 expectedContextLength = 21;
361 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100362 }
363
Václav Kubernátabf52802020-05-19 01:31:17 +0200364 SECTION("no readonly data leafs in set")
365 {
366 input = "set example:read";
367 expectedContextLength = 12;
368 }
369
Václav Kubernát8028f942019-09-25 16:03:23 +0200370 SECTION("clear completions when no longer inputting path")
371 {
372 input = "set example:leafInt ";
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100373 expectedCompletions = {};
374 expectedContextLength = 0;
Václav Kubernát8028f942019-09-25 16:03:23 +0200375 }
376
Václav Kubernátaa4250a2020-07-22 00:02:23 +0200377 SECTION("rpc input nodes NOT completed for prepare command")
Václav Kubernáte7248b22020-06-26 15:38:59 +0200378 {
Václav Kubernátaa4250a2020-07-22 00:02:23 +0200379 input = "prepare example:fire/";
Václav Kubernáte7248b22020-06-26 15:38:59 +0200380 expectedCompletions = {};
381 expectedContextLength = 13;
382 }
383
384 SECTION("rpc input nodes completed for set command")
385 {
386 parser.changeNode({{}, {{module_{"second"}, rpcNode_{"fire"}}}});
387 input = "set ";
388 expectedCompletions = {"whom "};
389 expectedContextLength = 0;
390 }
391
392 SECTION("completion for other stuff while inside an rpc")
393 {
394 parser.changeNode({{}, {{module_{"second"}, rpcNode_{"fire"}}}});
395 input = "set ../";
Václav Kubernátce108db2021-01-25 10:05:40 +0100396 expectedCompletions = {"example:addresses", "example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:ovocezelenina", "example:twoKeyList", "second:amelie/", "second:fire/", "example:system/", "example:system-state/"};
Václav Kubernáte7248b22020-06-26 15:38:59 +0200397 expectedContextLength = 0;
398 }
399
Václav Kubernát31029682020-10-29 08:23:04 +0100400 SECTION("rpc nodes not completed for the get command")
401 {
402 input = "get ";
Václav Kubernátce108db2021-01-25 10:05:40 +0100403 expectedCompletions = {"example:addresses", "example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:ovocezelenina", "example:readonly ", "example:twoKeyList", "second:amelie/", "example:system/", "example:system-state/"};
Václav Kubernát31029682020-10-29 08:23:04 +0100404 expectedContextLength = 0;
405 }
406
Václav Kubernát0d47e5e2020-11-17 12:27:05 +0100407 SECTION("leafs not completed for cd")
408 {
409 input = "cd ";
Václav Kubernátce108db2021-01-25 10:05:40 +0100410 expectedCompletions = {"example:addresses", "example:ano/", "example:anoda/", "example:bota/","example:list", "example:ovoce", "example:ovocezelenina", "example:twoKeyList", "second:amelie/", "example:system/", "example:system-state/"};
Václav Kubernát0d47e5e2020-11-17 12:27:05 +0100411 expectedContextLength = 0;
412 }
413
Václav Kubernát1ed4aa32020-01-23 13:13:28 +0100414 REQUIRE(parser.completeCommand(input, errorStream) == (Completions{expectedCompletions, expectedContextLength}));
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100415}