Skip to content

Commit c409a67

Browse files
devajithvsRoot Persona
authored andcommitted
Add test for autocomplete functionality
1 parent e33dee6 commit c409a67

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/AutoComplete/AutoComplete.C

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//------------------------------------------------------------------------------
2+
// CLING - the C++ LLVM-based InterpreterG :)
3+
//
4+
// This file is dual-licensed: you can choose to license it under the University
5+
// of Illinois Open Source License or the GNU Lesser General Public License. See
6+
// LICENSE.TXT for details.
7+
//------------------------------------------------------------------------------
8+
9+
// RUN: cat %s | %cling 2>&1 | FileCheck %s
10+
11+
// Test to check autocomplete functionality (adapted from CppInterOp)
12+
13+
#include "cling/Interpreter/Interpreter.h"
14+
15+
gCling->process("int foo = 12;");
16+
std::vector<std::string> cc;
17+
size_t cursor = 1;
18+
gCling->codeComplete("f", cursor, cc);
19+
20+
// We check only for 'float' and 'foo', because they
21+
// must be present in the result. Other hints may appear
22+
// there, depending on the implementation, but these two
23+
// are required to say that the test is working.
24+
size_t cnt = 0;
25+
for (auto& r : cc) {
26+
if (r == "float" || r == "[#int#]foo") cnt++;
27+
}
28+
29+
cnt
30+
// CHECK: (unsigned long) 2
31+
.q

0 commit comments

Comments
 (0)