alef 0.80.0

Opinionated polyglot binding generator for Rust libraries
Documentation
{#- The `else` arm of Zig's `if (call) |_| {..} else |..| {..}` shape, for a fixture that
    declared an `error` assertion.

    Context variables:
    - kind:               "assert" | "unsubstantiable" | "bare"
    - module_name:        generated Zig module identifier that exposes `_last_error()`
    - expected:           Zig-escaped declared value (kind == "assert" only)
    - skip_line:          fully indented `// skipped: ..` line (kind == "unsubstantiable" only)
    - unknown_error_name: error-set member every uncoded variant collapses to
#}
{% if kind == "assert" %}
    } else |_err| {
        const _err_name = @errorName(_err);
        const _err_message: []const u8 = {{ module_name }}._last_error() orelse "";
        try testing.expect(std.mem.indexOf(u8, _err_message, "{{ expected }}") != null or std.mem.indexOf(u8, _err_name, "{{ expected }}") != null);
    }
{% elif kind == "unsubstantiable" %}
    } else |_err| {
{{ skip_line }}
{# The declared VARIANT is unsubstantiable, but "the failure arrived with a diagnosable identity" #}
{# is not: the C ABI sets both halves on every failure path (`set_last_error(code, &e.to_string())`), #}
{# so a binding that loses the message AND collapses the code to the catch-all member fails here. #}
{# Capturing `_err` and discarding it made this arm pass for any failure whatsoever. ~keep #}
        const _err_name = @errorName(_err);
        const _err_message: []const u8 = {{ module_name }}._last_error() orelse "";
        try testing.expect(_err_message.len > 0 or !std.mem.eql(u8, _err_name, "{{ unknown_error_name }}"));
    }
{% else %}
    } else |_| {}
{% endif %}