cmoon::test::error


Defined in module <cmoon.test>


void error(std::string_view message = "", const std::source_location& location = std::source_location::current());


(1)

Throws a std::runtime_error immediately.

Can be used when there is current issues with compiling the test case with the original code, or where conditional compiling may make a test case unrunnable on a given platform.

Parameters

message - Extra information to be added to the error message
location - Information about where in the file this assertion was ran

Return value

(none)

Example



import cmoon.test;

class example_test : public cmoon::test::test_case
{
    public:
        example_test()
            : cmoon::test::test_case{"example test"} {}

        void operator()() override
        {
            #if defined _WIN32
            // Write test code for Windows
            #else
            cmoon::test::error("This test can only be ran on Windows");
            #endif
        }
};