T O P I C R E V I E W |
negritot |
Posted - Sep 29 2009 : 2:33:18 PM We do TDD in C++ using Google Test (http://code.google.com/p/googletest/). One area where both IntelliSense and Visual Assist fail is within the scope of the macros that Google Test uses to define test methods (i.e. the TEST and TEST_F macros). Not even local scope symbols are recognized; they don't appear the suggestion list, and auto-completion of their names or methods fails completely. The only thing that appears in the suggestion box are some other symbols that are completely irrelevant to the current code.
Has anyone run into the same problem and/or know of any workarounds? |
3 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Jan 27 2011 : 2:05:08 PM Can you post a code example showing your problem please?
I have downloaded and unpacked version 1.5 of Google Test, added it to the IDE stable include directories, and then copy and pasted the code from this example:
http://code.google.com/p/googletest/source/browse/trunk/samples/sample7_unittest.cc
into a cpp file using VA 1837, and I an not getting any underlining inside the TEST_P blocks. I am getting other underlining from VA since I have not got the required "prime_tables.h", since I have not tried to find it on the website. |
fsgs |
Posted - Jan 25 2011 : 03:25:44 AM I do also have a problem using Visual Assist with Google Test. All statements inside the TEST_P definition are underlined with red waves. Both of suggested solutions don't work for me.
Windows 7 x64, Visual Studio 2005, Visual Assist 10.6.1837.0
Any other ideas plz? |
accord |
Posted - Sep 29 2009 : 3:40:22 PM I've downloaded the test framework, and TEST_F is a highly complex and recursive macro. The problem with complex macros is that VA do not parses macros recursively by default. So if a macro contains a '{' somewhere in the macro and then calls an another macro to close the scope, it will confuse VA, since the scope will never be closed. For example:
#define MACRO1 } #define MACRO2 { MACRO1
This will confuse VA with default settings and it may brake even the recognition of local variables.
We have 2 solutions for this:
1. The easiest and safest solution is to replace these complex macros with empty ones for VA by placing
#define TEST #define TEST_F etc.
into VA's stdafx.h. You can learn more about this workaround here:
http://docs.wholetomato.com?W302
It will make VA skip the macros, so if these macros defines something you need (I saw a class in it) it won't be available for suggestions, but it will stop confusing the parser.
2. Instead of the first solution, you can try turning on recursive macro parsing:
http://docs.wholetomato.com?W363
If it works correctly (everything is recognized and VA doesn't slow down) it is a good solution, but needs a trial.
Recursive macro parsing is off by default, because it can cause major performance problems with extremely complex macros. |
|
|