Debian Codegraph @

third_party/rust/uniffi_testing/README.md

raw
1 This crate contains helper code for testing bindings. Our general system is to
2 generate bindings for the libraries from the examples and fixtures
3 directories, then execute a script that tests the bindings.
4
5 Each bindings crate can do this in a different way, but the typical system is:
6
7 - Construct a `UniFFITestHelper` struct to assist the process
8 - Call `UniFFITestHelper.create_out_dir()` to create a temp directory to
9 store testing files
10 - Call `UniFFITestHelper.copy_cdylibs_to_out_dir()` to copy the dylib
11 artifacts for the example/fixture library to the `out_dir`. This is needed
12 because the bindings code dynamically links to or loads from this library.
13 - Call `UniFFITestHelper.get_compile_sources()` to iterate over (`udl_path`,
14 `uniffi_config_path`) pairs and generate the bindings from them. This step
15 is specific to the bindings language, it may mean creating a .jar file,
16 compiling a binary, or just copying script files over.
17 - Execute the test script and check if it succeeds. This step is also
18 specific to the bindings language.