This document provides an outline of different kinds of tests used by the cxx project.
We want to verify that the #[cxx::bridge] macro reports expected error messages when invoked by rustc on certain inputs.
Such verification is handled by test cases underneath tests/ui directory and driven by tests/compiletest.rs. The test cases consist of a pair of files:
We want to verify that cxx's generated C++ code triggers expected C++ compiler diagnostics on certain inputs.
Such verification is covered by tests/cpp_ui_tests.rs.
End-to-end functional tests are structured as follows:
cxx-test-suite crate (lib.rs and module.rs) with:#[cxx::bridge] invocationsstruct R)fn r_return_primitive)class C)c_return_primitive)cxx_run_test function in tests/ffi/test.cc.