diff options
Diffstat (limited to 'kernel/kapi/system.tests.cpp')
| -rw-r--r-- | kernel/kapi/system.tests.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/kapi/system.tests.cpp b/kernel/kapi/system.tests.cpp new file mode 100644 index 0000000..ee31c51 --- /dev/null +++ b/kernel/kapi/system.tests.cpp @@ -0,0 +1,30 @@ +#include "kapi/system.hpp" + +#include "kernel/test_support/cpu.hpp" +#include "kernel/test_support/log_buffer.hpp" + +#include <kstd/print> + +#include <catch2/catch_test_macros.hpp> + +SCENARIO("Kernel testing kapi::system shims", "[support]") +{ + GIVEN("the test support infrastructure is initialized") + { + WHEN("a the system panics") + { + kernel::tests::log_buffer::clear(); + + THEN("the correct exception is thrown") + { + REQUIRE_THROWS_AS(kapi::system::panic("[kernel:tests] Test Panic"), kernel::tests::cpu::halt); + } + + THEN("the message is appended to the log buffer") + { + CHECK_THROWS(kapi::system::panic("[kernel:tests] Test Panic")); + REQUIRE(kernel::tests::log_buffer::flat_messages().contains("[kernel:tests] Test Panic")); + } + } + } +}
\ No newline at end of file |
