1 //===-- CompletionRequestTest.cpp -------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "gtest/gtest.h"
12 #include "lldb/Utility/CompletionRequest.h"
13 using namespace lldb_private;
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;
24 CompletionRequest request(command, cursor_pos, match_start, match_max_return,
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);
35 EXPECT_EQ(request.GetPartialParsedLine().GetArgumentCount(), 2u);
36 EXPECT_STREQ(request.GetPartialParsedLine().GetArgumentAtIndex(1), "b");
38 // This is the generated matches should be equal to our passed string list.
39 EXPECT_EQ(&request.GetMatches(), &matches);