Update to the batch_test_for_codecompletion_v2.patch
Currently, the default file: cc_function_decls.cpp is used for testing.
The contents of cc_function_decls.cpp is below:
#include <string>
#include <vector>
extern "C"
{
double ExternallyC(double* my_double, std::vector<int> int_vec)
{
// nothing
return 1.0;
}
}
class TheClass
{
public:
TheClass () { ; }
virtual ~TheClass () { ; }
int GetInt (size_t idx) const { int i=0; return i; }
const TheClass* GetClass (const TheClass& tc) { return this; }
static void StaticVoid() { ; }
void Void (void* pVoid) { ; }
};
extern int ExternInt(TheClass* the_class, int my_int);
int InternInt(TheClass* the_class, int my_int)
{
// nothing
return 42;
}
void VoidFunction(void* my_void_pointer, int my_int)
{
// nothing
}
std::string GetString(TheClass* the_class, const std::string& in_str)
{
std::string str(in_str);
return str;
}
const float& ConstFloatRef(void)
{
// nothing
static float f = 0.0;
return f;
}
static int StaticInt(const int& in_int)
{
// nothing
int i = 1;
return i;
}
struct S
{
int i;
};
S g_S;
TheClass tc;
std::string str;
std::vector<TheClass> vt;
// str. //size,length
// tc.GetI //GetInt
// tc.GetC //GetClass
// tc.St //StaticVoid
// tc.Vo //Void
// g_ //g_S
// g_S. //i
// vt[1]. //GetInt
Please look at the last lines of the file:
// str. //size,length
// tc.GetI //GetInt
// tc.GetC //GetClass
// tc.St //StaticVoid
// tc.Vo //Void
// g_ //g_S
// g_S. //i
// vt[1]. //GetInt
These are the test cases, the grammar is quite simple, E.g.
The string between the double backslash is the statement "str.", it is expected that the user put the caret after the statement, and press the CTRL+SPACE key to let the CodeCompletion plugin to list the auto suggestion list.
The string after the second double backslash is the match cases. In the above example, the auto suggestion list should/must contains "size" and "length". If yes, then this test case passes, otherwise, this test case failed.
You can change the test case in the cc_test's wxScintilla control, and press "parse" button again to run the new tests.
Currently, all the parsing messages are logged out, so if you are parsing a cpp file which contains an include file, then all the include files will be parsed recursively(this is the correct way of parsing a cpp file as a normal compiler does), in such cases, you get thousands of log messages.
Comments are welcome.
BTW: the attachment is in git format(generated from Tortoisegit/msysgit), because I'm currently maintain a local git branch to implement this feature.