Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 mock virtual methods

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
ffa-grahamdawes Posted - Jun 22 2015 : 03:55:01 AM
The implement virtual methods feature of Visual Assist is great time saver. I wonder if it would be possible to also have a "Mock Virtual Methods" feature.

We use Google Test/ Google Mocks as our unit testing framework. Unfortunately it can be somewhat tedious to hand write MOCK_METHODxxx for all members of the class.

There are a few other C++ mocking frameworks so perhaps the user could choose which mocking framework they are using either in the options or when they generate the methods.

1   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Jun 23 2015 : 6:21:27 PM
Hmmm. Interesting idea. I haven't used this framework myself, but luckily there is a page called Google C++ Mocking Framework for Dummies so I was able to get up to speed easily.

I think something like a snippet for each line of the generated methods could be used here.

For example you could use something like the below snippet to generate MOCK_METHOD2(GoTo, void(int x, int y));

MOCK_METHOD$ArgCount$($SymbolName$, $SymbolType$($MethodArgs$));

The sample line is came from here:
https://code.google.com/p/googlemock/wiki/ForDummies#Writing_the_Mock_Class

And the snippet variable names based on this document:
http://docs.wholetomato.com/default.asp?W262

As you said you would want to select which snippets to use, and we could provide googlemock as a sample.

I have opened a feature request for this idea:

case=90460

Later, we could even create more snippets for other frameworks to have a better out-of-box experience, if we see demand for it.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000