code wiki / (root) / nx_test_harness.nx

nx_test_harness.nx

buildroot/runtime/nx_test_harness.nx

5998 B214 linesdepth 4pulls 5 transitivereach 4 importersview sourcekind librarytopic test
docsdependenciesstructsconstsfunctions

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

nx_dom_query.nx nx_dom_click.nx nx_test_harness.nx nx_chk_bits_up_e2e.nx nx_test_driver_e2e.nx nx_test_harness_test.nx nx_ttt_bits_up_e2e.nx

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

19const _TH_STDOUT: i64 = 1
20const _TH_SYS_WRITE: i64 = 1 // syscall number for x86_64 write

functions

25func nx_test_init() -> i64
called by 4: mainmainmainmain
31func _th_strlen(s: *u8) -> i64
37func _th_w(s: *u8) -> i64
41func _th_wn(s: *u8, n: i64) -> i64
45func _th_wln(s: *u8) -> i64
53func _th_wi(n: i64) -> i64
82func nx_test_expect_eq(label: *u8, got: i64, want: i64) -> i64
101func _th_contains(hay: *u8, hay_len: i64, ndl: *u8, ndl_len: i64) -> i64
119func nx_test_expect_contains(label: *u8, html: *u8, n: i64, needle: *u8) -> i64
136func nx_test_expect_not_contains(label: *u8, html: *u8, n: i64,
154func nx_test_expect_class_count(label: *u8, html: *u8, n: i64,
160func nx_test_expect_tag_count(label: *u8, html: *u8, n: i64,
166func nx_test_expect_click(label: *u8, intent: *NxClickIntent,
called by 3: mainmainmain calls 3: _th_w_th_wln_th_wi
205func nx_test_summary() -> i64
called by 4: mainmainmainmain calls 3: _th_w_th_wln_th_wi