@@ -26,8 +26,8 @@ void CliTestRunner::runTests() {
2626 testHelp ();
2727 }
2828
29- SECTION (" Autocomplete" ) {
30- testAutocomplete ();
29+ SECTION (" Autocomplete enabled " ) {
30+ testAutocompleteEnabled ();
3131 }
3232
3333 SECTION (" Escape sequences" ) {
@@ -46,6 +46,35 @@ void CliTestRunner::runTests() {
4646 }
4747}
4848
49+ void CliTestRunner::testAutocompleteDisabled () {
50+ embeddedCliProcess (cli);
51+
52+ mock.addCommandBinding (" set" );
53+
54+ SECTION (" Live autocomplete disabled" ) {
55+ mock.sendStr (" s" );
56+
57+ embeddedCliProcess (cli);
58+
59+ size_t cursor = 0 ;
60+ auto lines = mock.getLines (false , &cursor);
61+
62+ REQUIRE (lines.size () == 1 );
63+ REQUIRE (lines[0 ] == " > s" );
64+ REQUIRE (cursor == 3 );
65+
66+ mock.sendStr (" \t " );
67+
68+ embeddedCliProcess (cli);
69+
70+ lines = mock.getLines (true , &cursor);
71+
72+ REQUIRE (lines.size () == 1 );
73+ REQUIRE (lines[0 ] == " > set" );
74+ REQUIRE (cursor == 6 );
75+ }
76+ }
77+
4978void CliTestRunner::testBase () {
5079 auto &commands = mock.getReceivedCommands ();
5180
@@ -179,7 +208,7 @@ void CliTestRunner::testHistory() {
179208
180209 SECTION (" When history is present, can navigate" ) {
181210 std::vector<std::string> cmds = {" command" , " get" , " reset" , " exit" };
182- for (auto &cmd : cmds) {
211+ for (auto &cmd: cmds) {
183212 mock.sendLine (cmd);
184213 }
185214 embeddedCliProcess (cli);
@@ -203,7 +232,7 @@ void CliTestRunner::testHistory() {
203232
204233 SECTION (" Sending command multiple times, doesn't create duplicates" ) {
205234 std::vector<std::string> cmds = {" command" , " get" , " command" , " command" };
206- for (auto &cmd : cmds) {
235+ for (auto &cmd: cmds) {
207236 mock.sendLine (cmd);
208237 }
209238 embeddedCliProcess (cli);
@@ -231,7 +260,7 @@ void CliTestRunner::testHistory() {
231260
232261 SECTION (" Sending command resets history cursor" ) {
233262 std::vector<std::string> cmds = {" command" , " get" };
234- for (auto &cmd : cmds) {
263+ for (auto &cmd: cmds) {
235264 mock.sendLine (cmd);
236265 }
237266 embeddedCliProcess (cli);
@@ -258,7 +287,7 @@ void CliTestRunner::testHistory() {
258287 }
259288}
260289
261- void CliTestRunner::testAutocomplete () {
290+ void CliTestRunner::testAutocompleteEnabled () {
262291 mock.addCommandBinding (" get" );
263292 mock.addCommandBinding (" set" );
264293 mock.addCommandBinding (" get-new" );
0 commit comments