Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Suggestion list fails within Google Test macro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

negritot
New Member

3 Posts

Posted - Sep 29 2009 :  2:33:18 PM  Show Profile  Reply with Quote
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?

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 29 2009 :  3:40:22 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

fsgs
Junior Member

16 Posts

Posted - Jan 25 2011 :  03:25:44 AM  Show Profile  Reply with Quote
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?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19024 Posts

Posted - Jan 27 2011 :  2:05:08 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000