Change how word splitting works when completing

Previously, I relied on replxx to correctly split words based on
word-splitting characters. However, as completion gets more complex and
completions possibly insert word-splitting characters, it starts to do
weird stuff like deleting some of your input. Fortunately, replxx allows
you to set the context length for completion - that is, how many
character it should consider as part of the word you're completing.

Change-Id: I035ac5059c8ab125efedb90cbeb2910f20da04a7
diff --git a/tests/command_completion.cpp b/tests/command_completion.cpp
index 015b4db..d439394 100644
--- a/tests/command_completion.cpp
+++ b/tests/command_completion.cpp
@@ -8,6 +8,7 @@
 
 #include "trompeloeil_doctest.h"
 #include "parser.hpp"
+#include "pretty_printers.hpp"
 #include "static_schema.hpp"
 
 TEST_CASE("command completion")
@@ -16,49 +17,57 @@
     Parser parser(schema);
     std::string input;
     std::ostringstream errorStream;
-    std::set<std::string> expected;
+    std::set<std::string> expectedCompletions;
+    int expectedContextLength;
     SECTION("")
     {
         input = "";
-        expected = {"cd", "create", "delete", "set", "commit", "get", "ls", "discard", "help"};
+        expectedCompletions = {"cd", "create", "delete", "set", "commit", "get", "ls", "discard", "help"};
+        expectedContextLength = 0;
     }
 
     SECTION(" ")
     {
         input = " ";
-        expected = {"cd", "create", "delete", "set", "commit", "get", "ls", "discard", "help"};
+        expectedCompletions = {"cd", "create", "delete", "set", "commit", "get", "ls", "discard", "help"};
+        expectedContextLength = 0;
     }
 
     SECTION("c")
     {
         input = "c";
-        expected = {"cd", "commit", "create"};
+        expectedCompletions = {"cd", "commit", "create"};
+        expectedContextLength = 1;
     }
 
     SECTION("d")
     {
         input = "d";
-        expected = {"delete", "discard"};
+        expectedCompletions = {"delete", "discard"};
+        expectedContextLength = 1;
     }
 
     SECTION("x")
     {
         input = "x";
-        expected = {};
+        expectedCompletions = {};
+        expectedContextLength = 1;
     }
 
     SECTION("cd")
     {
         input = "cd";
         // TODO: depending on how Readline works, this will have to be changed to include a space
-        expected = {"cd"};
+        expectedCompletions = {"cd"};
+        expectedContextLength = 2;
     }
 
     SECTION("create")
     {
         input = "create";
-        expected = {"create"};
+        expectedCompletions = {"create"};
+        expectedContextLength = 6;
     }
 
-    REQUIRE(parser.completeCommand(input, errorStream) == expected);
+    REQUIRE(parser.completeCommand(input, errorStream) == (Completions{expectedCompletions, expectedContextLength}));
 }