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