Improvements for markdown parsing.
This commit is contained in:
parent
fc44290e3f
commit
8705859115
40 changed files with 957 additions and 537 deletions
|
@ -36,17 +36,30 @@ void TestCaseRunner::markTestFailure(const std::string& line)
|
|||
sFailureLine = line;
|
||||
}
|
||||
|
||||
bool TestCaseRunner::run()
|
||||
bool TestCaseRunner::run(const std::vector<std::string>& args)
|
||||
{
|
||||
std::string test_to_run;
|
||||
if (args.size() > 0 )
|
||||
{
|
||||
test_to_run = args[0];
|
||||
}
|
||||
FileLogger::GetInstance().disable();
|
||||
for (auto test_case : mCases)
|
||||
{
|
||||
if (!test_to_run.empty())
|
||||
{
|
||||
if (test_case->getName() != test_to_run)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
sLastTestFailed = false;
|
||||
std::cout << "TestFramework: Running Test - " << test_case->getName() << std::endl;
|
||||
test_case->run();
|
||||
if (sLastTestFailed)
|
||||
{
|
||||
std::cout << "Failed at line: " << sLastTestFailed << std::endl;
|
||||
std::cout << "Failed at line: " << sFailureLine << std::endl;
|
||||
mFailingTests.push_back(test_case->getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
|
||||
void markTestFailure(const std::string& line);
|
||||
|
||||
bool run();
|
||||
bool run(const std::vector<std::string>& args);
|
||||
|
||||
private:
|
||||
std::vector<std::string> mFailingTests;
|
||||
|
|
|
@ -16,12 +16,12 @@ struct Holder
|
|||
static void Test##NAME() \
|
||||
|
||||
|
||||
#define REQUIRE(predicate) \
|
||||
if(!predicate) \
|
||||
{ \
|
||||
TestCaseRunner::getInstance().markTestFailure(std::to_string(__LINE__)); \
|
||||
return; \
|
||||
} \
|
||||
#define REQUIRE(predicate) \
|
||||
if(!bool(predicate)) \
|
||||
{ \
|
||||
TestCaseRunner::getInstance().markTestFailure(std::to_string(__LINE__) + " with check: '" + std::string(#predicate) + "'"); \
|
||||
return; \
|
||||
} \
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,9 +7,17 @@ using Path = std::filesystem::path;
|
|||
class TestUtils
|
||||
{
|
||||
public:
|
||||
static Path getTestOutputDir()
|
||||
static Path getTestOutputDir(const std::string& testFileName = {})
|
||||
{
|
||||
return std::filesystem::current_path() / "test_output";
|
||||
if (!testFileName.empty())
|
||||
{
|
||||
const auto name = Path(testFileName).filename().stem();
|
||||
return std::filesystem::current_path() / "test_output" / name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::filesystem::current_path() / "test_output";
|
||||
}
|
||||
}
|
||||
|
||||
static Path getTestDataDir()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue