Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Библиотека 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);
}