1 //===-- CompletionRequestTest.cpp -------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "gtest/gtest.h"
11 
12 #include "lldb/Utility/CompletionRequest.h"
13 using namespace lldb_private;
14 
15 TEST(CompletionRequest, Constructor) {
16   std::string command = "a bad c";
17   const unsigned cursor_pos = 3;
18   const int arg_index = 1;
19   const int arg_cursor_pos = 1;
20   const int match_start = 2345;
21   const int match_max_return = 12345;
22   StringList matches;
23 
24   CompletionRequest request(command, cursor_pos, match_start, match_max_return,
25                             matches);
26 
27   EXPECT_STREQ(request.GetRawLine().str().c_str(), command.c_str());
28   EXPECT_EQ(request.GetRawCursorPos(), cursor_pos);
29   EXPECT_EQ(request.GetCursorIndex(), arg_index);
30   EXPECT_EQ(request.GetCursorCharPosition(), arg_cursor_pos);
31   EXPECT_EQ(request.GetMatchStartPoint(), match_start);
32   EXPECT_EQ(request.GetMaxReturnElements(), match_max_return);
33   EXPECT_EQ(request.GetWordComplete(), false);
34 
35   EXPECT_EQ(request.GetPartialParsedLine().GetArgumentCount(), 2u);
36   EXPECT_STREQ(request.GetPartialParsedLine().GetArgumentAtIndex(1), "b");
37 
38   // This is the generated matches should be equal to our passed string list.
39   EXPECT_EQ(&request.GetMatches(), &matches);
40 }
41