本文整理汇总了C++中std::unique_ptr::BeginFinally方法的典型用法代码示例。如果您正苦于以下问题:C++ unique_ptr::BeginFinally方法的具体用法?C++ unique_ptr::BeginFinally怎么用?C++ unique_ptr::BeginFinally使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::unique_ptr
的用法示例。
在下文中一共展示了unique_ptr::BeginFinally方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
//.........这里部分代码省略.........
m_output->BeginFixture("fixture");
m_output->BeginTest();
m_output->BeginGiven("given");
m_output->EndGiven("given");
m_output->BeginWhen("when");
m_output->EndWhen("then");
m_output->BeginThen("then");
m_output->EndThen("then");
m_output->EndTest();
m_output->EndFixture("fixture");
m_output->Finish(1, 1);
});
Then("the output is as expected", [&]()
{
auto stringVal = m_actualOutput.str();
auto startOfTime = stringVal.find('[');
auto endOfTime = stringVal.find(']');
stringVal = stringVal.erase(startOfTime, endOfTime - startOfTime + 1);
AssertThat(stringVal, ut11::Is::EqualTo("Fixture: fixture\n\tGiven: given\n\t\tWhen: when\n\t\t\tThen: then \n\nFinished!\nRan: 1\nSucceeded: 1\n"));
});
When("running a test fixture with a Given When Then Finally", [&]()
{
m_output->Begin();
m_output->BeginFixture("fixture");
m_output->BeginTest();
m_output->BeginGiven("given");
m_output->EndGiven("given");
m_output->BeginWhen("when");
m_output->EndWhen("then");
m_output->BeginThen("then");
m_output->EndThen("then");
m_output->BeginFinally("finally");
m_output->EndFinally("finally");
m_output->EndTest();
m_output->EndFixture("fixture");
m_output->Finish(1, 1);
});
Then("the output is as expected", [&]()
{
auto stringVal = m_actualOutput.str();
auto startOfTime = stringVal.find('[');
auto endOfTime = stringVal.find(']');
stringVal = stringVal.erase(startOfTime, endOfTime - startOfTime + 1);
AssertThat(stringVal, ut11::Is::EqualTo("Fixture: fixture\n\tGiven: given\n\t\tWhen: when\n\t\t\tThen: then \n\tFinally: finally\n\nFinished!\nRan: 1\nSucceeded: 1\n"));
});
When("running a test fixture with multiple tests with a Given When Then Finally where the Given and Whens repeat", [&]()
{
m_output->Begin();
m_output->BeginFixture("fixture");
m_output->BeginTest();
m_output->BeginGiven("given");
m_output->EndGiven("given");
m_output->BeginWhen("when");
m_output->EndWhen("then");
m_output->BeginThen("then");
m_output->EndThen("then");
m_output->BeginFinally("finally");
m_output->EndFinally("finally");
m_output->EndTest();
m_output->BeginTest();
m_output->BeginGiven("given");
m_output->EndGiven("given");