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 b"; 17 const unsigned cursor_pos = 2; 18 Args args(command); 19 const int arg_index = 1; 20 const int arg_cursor_pos = 0; 21 const int match_start = 2345; 22 const int match_max_return = 12345; 23 bool word_complete = false; 24 StringList matches; 25 CompletionRequest request(command, cursor_pos, args, arg_index, 26 arg_cursor_pos, match_start, match_max_return, 27 word_complete, matches); 28 29 EXPECT_STREQ(request.GetRawLine().str().c_str(), command.c_str()); 30 EXPECT_EQ(request.GetRawCursorPos(), cursor_pos); 31 EXPECT_EQ(request.GetCursorIndex(), arg_index); 32 EXPECT_EQ(request.GetCursorCharPosition(), arg_cursor_pos); 33 EXPECT_EQ(request.GetMatchStartPoint(), match_start); 34 EXPECT_EQ(request.GetMaxReturnElements(), match_max_return); 35 EXPECT_EQ(request.GetWordComplete(), word_complete); 36 // This is the generated matches should be equal to our passed string list. 37 EXPECT_EQ(&request.GetMatches(), &matches); 38 } 39