rust_gtest_interop 库

The rust_gtest_interop library provides a way to:

  • Use a Rust function as a gtest testcase (using the #[gtest(...)] attribute)
  • Use expect_eq! and similar macros (similar to assert_eq! but not panicking and not terminating the test when the assertion fails).

Example:

  1. use rust_gtest_interop::prelude::*;
  2. #[gtest(MyRustTestSuite, MyAdditionTest)]
  3. fn test_addition() {
  4. expect_eq!(2 + 2, 4);
  5. }