2 unstable releases

0.23.0 Jan 27, 2023
0.22.0 Dec 16, 2022

#106 in Testing

Download history 9603/week @ 2023-02-12 9827/week @ 2023-02-19 8645/week @ 2023-02-26 9869/week @ 2023-03-05 9616/week @ 2023-03-12 9990/week @ 2023-03-19 10630/week @ 2023-03-26 8877/week @ 2023-04-02 8501/week @ 2023-04-09 8063/week @ 2023-04-16 7678/week @ 2023-04-23 8348/week @ 2023-04-30 9408/week @ 2023-05-07 6554/week @ 2023-05-14 8254/week @ 2023-05-21 8248/week @ 2023-05-28

33,008 downloads per month
Used in 11 crates (via uniffi_bindgen)

MPL-2.0 license

12KB
210 lines

This crate contains helper code for testing bindings. Our general system is to generate bindings for the libraries from the examples and fixtures directories, then execute a script that tests the bindings.

Each bindings crate can do this in a different way, but the typical system is:

  • Construct a UniFFITestHelper struct to assist the process
  • Call UniFFITestHelper.create_out_dir() to create a temp directory to store testing files
  • Call UniFFITestHelper.copy_cdylibs_to_out_dir() to copy the dylib artifacts for the example/fixture library to the out_dir. This is needed because the bindings code dynamically links to or loads from this library.
  • Call UniFFITestHelper.get_compile_sources() to iterate over (udl_path, uniffi_config_path) pairs and generate the bindings from them. This step is specific to the bindings language, it may mean creating a .jar file, compiling a binary, or just copying script files over.
  • Execute the test script and check if it succeeds. This step is also specific to the bindings language.

Dependencies

~1.3–2MB
~44K SLoC