ExUnit helpers for RustQ-generated defrust and defnif modules.
Use this module from consumer tests:
defmodule MyApp.NativeTest do
use RustQ.Test, async: true
test "generates and exports the native boundary" do
assert_defrust MyApp.Native, :sum_impl, "fn sum_impl"
assert_defnif MyApp.Native, :sum, 1, ~r/fn sum.*Vec<f64>/
assert_rust_valid MyApp.Native
end
endString expectations perform substring matches; regex expectations use
Regex.match?/2. Assertions render one generated function at a time so
failures remain focused.
Summary
Functions
Asserts that a defnif is exported, marked as a Rustler NIF, and matches generated Rust.
Asserts that a named defrust/defrustp function matches a string or regex.
Asserts that a generated module's complete Rust source matches a string or regex.
Asserts that all generated Rust items for a module parse as valid Rust.
Renders one generated Rust function by name or raises.
Returns whether a generated function carries the Rustler NIF attribute.
Returns a generated module's complete Rust source or raises.
Functions
Asserts that a defnif is exported, marked as a Rustler NIF, and matches generated Rust.
Asserts that a named defrust/defrustp function matches a string or regex.
Asserts that a generated module's complete Rust source matches a string or regex.
Asserts that all generated Rust items for a module parse as valid Rust.
Renders one generated Rust function by name or raises.
Returns whether a generated function carries the Rustler NIF attribute.
Returns a generated module's complete Rust source or raises.