Expand description
Test framework for Windjammer
Provides test primitives similar to Rust’s test framework
Functions§
- assert
- Assert that a condition is true
- assert_
approx - Assert that two floating point values are approximately equal
- assert_
approx_ f32 - Assert that two f32 values are approximately equal
- assert_
contains - Assert that a collection contains an item
- assert_
deep_ eq - Assert that two values are deeply equal (same as assert_eq, but explicit name)
- assert_
empty - Assert that a collection is empty
- assert_
ends_ with - Assert that a string ends with a suffix
- assert_
eq - Assert that two values are equal
- assert_
gt - Assert that a value is greater than another
- assert_
gte - Assert that a value is greater than or equal to another
- assert_
in_ range - Assert that a value is in a range
- assert_
is_ err - Assert that a Result is Err
- assert_
is_ none - Assert that an Option is None
- assert_
is_ ok - Assert that a Result is Ok
- assert_
is_ some - Assert that an Option is Some
- assert_
length - Assert that a collection has a specific length
- assert_
lt - Assert that a value is less than another
- assert_
lte - Assert that a value is less than or equal to another
- assert_
ne - Assert that two values are not equal
- assert_
not_ empty - Assert that a collection is not empty
- assert_
panics - Assert that a closure panics
- assert_
panics_ with - Assert that a closure panics with a specific message
- assert_
result_ err - Assert that a Result matches Err pattern
- assert_
result_ ok - Assert that a Result matches a pattern (Ok or Err) This is a simplified version - full pattern matching requires compiler support
- assert_
starts_ with - Assert that a string starts with a prefix
- assert_
str_ contains - Assert that a string contains a substring
- current_
test - Get the current test name
- ensures
- Check a postcondition (used by @ensures decorator) Asserts that a condition is true after a function executes
- fail
- Mark a test as failed
- failed_
count - Get the number of tests failed
- invariant
- Check an invariant (used by @invariant decorator) Asserts that a condition remains true throughout execution
- pass
- Mark a test as passed
- passed_
count - Get the number of tests passed
- requires
- Check a precondition (used by @requires decorator) Asserts that a condition is true before a function executes
- reset
- Reset test counters (for test isolation)
- set_
current_ test - Set the current test name