rust_gtest_interop ライブラリ

rust_gtest_interop ライブラリは、次のことを行う方法を提供します。

  • Rust 関数を gtest のテストケースとして使用する(#[gtest(...)] 属性を使用)
  • expect_eq! および同様のマクロを使用する(assert_eq! に似ていますが、パニックせず、 アサーションが失敗してもテストを終了しません)。

例:

// Copyright 2023 Google LLC
// SPDX-License-Identifier: Apache-2.0

use rust_gtest_interop::prelude::*;

#[gtest(MyRustTestSuite, MyAdditionTest)]
fn test_addition() {
    expect_eq!(2 + 2, 4);
}