hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

util.ha (715B)


      1 // SPDX-License-Identifier: MPL-2.0
      2 // (c) Hare authors <https://harelang.org>
      3 
      4 // Expect the currently running test to abort. The test will fail if it doesn't
      5 // abort.
      6 export fn expectabort() void = {
      7 	abort("Attempted to call test::expectabort outside of @test function");
      8 };
      9 
     10 // Skip the currently running test.
     11 export fn skip(reason: str) never = {
     12 	abort("Attempted to call test::skip outside of @test function");
     13 };
     14 
     15 // Check the $HARETEST_INCLUDE space-delimited environment variable for
     16 // keywords. If all the keywords are present, return void. Otherwise, skip the
     17 // currently running test.
     18 export fn require(keyword: str) void = {
     19 	abort("Attempted to call test::require outside of @test function");
     20 };