nx_test_harness.nx
buildroot/runtime/nx_test_harness.nx
about
nx_test_harness.nx -- assertion DSL for the bits-up test driver.
Replaces the JS `expect()` / `fail++` / `pass++` accounting in the
.mjs Playwright harnesses with NishiLang.
Test files call:
nx_test_init() // once at start
nx_test_expect_eq(label, got, want)
nx_test_expect_contains(label, html, n, needle)
nx_test_expect_class_count(label, html, n, class_name, want_count)
nx_test_expect_click(label, intent, want_action, want_arg0)
return nx_test_summary() // returns 0 if all pass, 1 if any fail
Output is human-readable: one [PASS]/[FAIL] line per assertion + a
summary at the end matching the .mjs format ("X pass, Y fail").
dependencies 2 imports · 4 importers
imports: nx_dom_query.nxnx_dom_click.nx
imported by: nx_chk_bits_up_e2e.nxnx_test_driver_e2e.nxnx_test_harness_test.nxnx_ttt_bits_up_e2e.nx
structs
| none |
consts
| 19 | const _TH_STDOUT: i64 = 1 |
| 20 | const _TH_SYS_WRITE: i64 = 1 // syscall number for x86_64 write |
functions
| 25 | func nx_test_init() -> i64 |
| 31 | func _th_strlen(s: *u8) -> i64 |
| 37 | func _th_w(s: *u8) -> i64 |
| 41 | func _th_wn(s: *u8, n: i64) -> i64 |
| 45 | func _th_wln(s: *u8) -> i64 |
| 53 | func _th_wi(n: i64) -> i64 |
| 82 | func nx_test_expect_eq(label: *u8, got: i64, want: i64) -> i64 called by 6: mainmainnx_test_expect_class_countnx_test_expect_tag_countmainmain calls 3: _th_w_th_wln_th_wi |
| 101 | func _th_contains(hay: *u8, hay_len: i64, ndl: *u8, ndl_len: i64) -> i64 |
| 119 | func nx_test_expect_contains(label: *u8, html: *u8, n: i64, needle: *u8) -> i64 |
| 136 | func nx_test_expect_not_contains(label: *u8, html: *u8, n: i64, |
| 154 | func nx_test_expect_class_count(label: *u8, html: *u8, n: i64, |
| 160 | func nx_test_expect_tag_count(label: *u8, html: *u8, n: i64, |
| 166 | func nx_test_expect_click(label: *u8, intent: *NxClickIntent, |
| 205 | func nx_test_summary() -> i64 |