[Test] Boost.Test for Property Tree Issue
Boost version: 1.55.0 OS: Windows 8 IDE: Visual Studio 2010 I have a small class which just parses a std::string using boost::property_tree::read_json. I'm trying to test my method with invalid input to make sure my method handles the exception. However, when I execute GetPropertyTreeFromJsonInValidInput2 (source code in attachment), I get exception in the visual studio itself and I have to break the execution. (snapshot is included in attachment). I'm a new user of boost, so don't know where to look for the solution.
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
Boost version: 1.55.0 OS: Windows 8 IDE: Visual Studio 2010 I have a small class which just parses a std::string using boost::property_tree::read_json. I'm trying to test my method with invalid input to make sure my method handles the exception. However, when I execute GetPropertyTreeFromJsonInValidInput2 (source code in attachment), I get exception in the visual studio itself and I have to break the execution. (snapshot is included in attachment). I'm a new user of boost, so don't know where to look for the solution.
The test framework catches all thrown exceptions and turns them into a test failure. I see a couple issues with your tests. First, you're launching a thread in one of the tests. Why? The recommendation is to test threading functionality separately from application functionality. Second, you're using the heap for your JsonParser instances and this is totally unnecessary -- just create them on the stack. Are you running your test executable in the debugger? I don't have VS 2010 installed on my machine anymore, but under VS 2012, there is a menu item Debug / Exceptions... that brings up a dialog where you can configure how the debugger treats exceptions. In the list you should see C++ Exceptions / std::exception and checkboxes in the Thrown and User-unhandled columns. These settings control how the debugger deals with exceptions, so you may get this dialog and then when you dismiss it, the exception goes up to the testing framework which handles it. -- "The Direct3D Graphics Pipeline" free book http://tinyurl.com/d3d-pipeline The Computer Graphics Museum http://computergraphicsmuseum.org The Terminals Wiki http://terminals.classiccmp.org Legalize Adulthood! (my blog) http://legalizeadulthood.wordpress.com
participants (2)
-
legalize+jeeves@mail.xmission.com
-
Pritesh Acharya