chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes

class Address {

string GetCountry() {throw;}

}

class Person {

public:

std::string GetAddressCountry (Address* pAddress)

{

try

{

auto test = pAddress->GetCountry();

return "Exception Not Caught";

}

catch(exception*)

{

return "Error";

}

}

private:

bool PrivateGetAddressCountry

(Address* pAddress)

{

try

{

auto test = pAddress->GetCountry();

return true;

}

catch (exception*)

{

return false;

}

}

}

TEST_METHOD(FakeStdException) 

{

Person person;

Address* fakeAddress = FAKE<Address>();

exception problem("Something has definitely gone wrong!");

WHEN_CALLED(fakeAddress->GetCountry()).Throw(&problem);

string error("Error");

//string result = person.GetAddressCountry(fakeAddress);

bool result1;

ISOLATOR_INVOKE_FUNCTION(result1, &person, PrivateGetAddressCountry, fakeAddress); // This line crashes, if you put the debugger you will see the execution of PrivateGetAddressCountry continues as its.

}

asked by selvendran.ayyaswamy (1.6k points)
reshown ago by Alon_TypeMock

1 Answer

0 votes
HI,
What version of Isolator++ are you using? Linux or windows?
answered ago by Alon_TypeMock (11.6k points)
...