Skip to main content

generate_test_code

Function generate_test_code 

Source
pub fn generate_test_code(
    test_cases: &[TestCase],
    closure_fns: &HashSet<&str>,
    fn_return_types: &HashMap<String, String>,
) -> String
Expand description

Generate Zig test code from test cases. If a test case has an expected value (from // => value comment), generates an assertion; otherwise generates a smoke test (call + discard).

closure_fns: names of functions that return closure structs (needs .call() syntax) fn_return_types: map from function name to its Zig return type string (e.g. “i64”, “JsValue”)