Skip to content

Commit 3661c87

Browse files
committed
feat: Add ZRTL test framework macros
Add test framework macros to help with ZRTL plugin development: - #[zrtl_test] attribute macro for test functions (in zrtl_macros) - zrtl_assert! macro with enhanced error messages - zrtl_assert_eq! and zrtl_assert_ne! for equality checks - zrtl_assert_some! and zrtl_assert_none! for Option types - zrtl_assert_ok! and zrtl_assert_err! for Result types All macros are exported from the zrtl prelude for easy access. Test framework macros provide ZRTL-prefixed output with file:line info. Completes the final task in INTEGRATION_PLAN.md - all integration gaps are now addressed.
1 parent 8918b9d commit 3661c87

6 files changed

Lines changed: 558 additions & 2 deletions

File tree

docs/INTEGRATION_PLAN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ fn test_array_push() {
274274
| Async state machine | Medium | High | P2 | ✅ Done |
275275
| Cancellation | Low | Medium | P3 | ✅ Done |
276276
| Promise combinators | Low | Low | P3 | ✅ Done |
277-
| Test framework | Low | Medium | P3 | 🔲 Pending |
277+
| Test framework | Low | Medium | P3 | ✅ Done |
278278
| Native async functions (ZRTL) | High | Medium | P1 | ✅ Done |
279279

280280
---
@@ -306,7 +306,7 @@ fn test_array_push() {
306306
2. ✅ Add cancellation support (`cancel()`, `is_cancelled()`, `PromiseState::Cancelled`)
307307
3. ✅ Add promise combinators (`PromiseAll`, `PromiseRace`, `PromiseAllSettled`)
308308
4. ✅ Add native async functions to ZRTL SDK (`#[zrtl_async]` macro)
309-
5. 🔲 Add test framework macros
309+
5. Add test framework macros (`#[zrtl_test]`, `zrtl_assert_eq!`, etc.)
310310

311311
---
312312

sdk/zrtl/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ categories = ["development-tools::ffi", "compilers"]
1111
[dependencies]
1212
inventory = "0.3"
1313

14+
[dev-dependencies]
15+
zrtl_macros = { path = "../zrtl_macros" }
16+
1417
[features]
1518
default = []
1619
# Enable test harness macros

sdk/zrtl/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ pub mod prelude {
150150
pub use crate::zrtl_tag;
151151
pub use crate::zrtl_plugin;
152152
pub use crate::zrtl_symbol;
153+
// Test framework macros
154+
pub use crate::zrtl_assert;
155+
pub use crate::zrtl_assert_eq;
156+
pub use crate::zrtl_assert_ne;
157+
pub use crate::zrtl_assert_some;
158+
pub use crate::zrtl_assert_none;
159+
pub use crate::zrtl_assert_ok;
160+
pub use crate::zrtl_assert_err;
153161
}
154162

155163
#[cfg(test)]

0 commit comments

Comments
 (0)