Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Nov 26, 2024

This PR contains the following updates:

Package Type Update Change
googletest dev-dependencies minor =0.12.0 -> =0.13.0

Release Notes

google/googletest-rust (googletest)

v0.13.0

Compare Source

API Changes

  • Note that the minimum supported Rust version has increased from 1.66 to 1.70.

  • Rename #[googletest::test] to #[googletest::gtest] and add it to the prelude.

    Note that #[googletest::test] will not be deprecated because this spelling is useful for compatibility with the rstest crate.

  • Add assert_pred! to prelude.

New Features

  • Add test fixture support for synchronous tests.

    Various traits to represent different types of test fixtures have been added. The core Fixture trait may be used like this:

    struct MyFixture {...}
    
    impl Fixture for MyFixture {
        fn set_up() -> Result<MyFixture> {
            Ok(MyFixture {...})
        }
    
        fn tear_down(self) -> Result<()> {
            Ok(())
        }
    }
    
    #[googletest::test]
    fn test_with_fixture(my_fixture: &MyFixture) {...}
    

    ConsumableFixture has only a set_up method and no tear_down method.

    FixtureOf<T> adapts a T: Default into a ConsumableFixture.

    StaticFixture has a set_up_once method which is called only once before any tests are run.

  • Add impl Matcher<&()> for ().

  • Handle the printing of arguments passed to gtest macros that do not implement Debug using inherent method specialization.

  • Generalize verify_pred! such that it can take any expression and provide meaningful output of intermediate values on failure.

  • Add support for printing the two sides of a binary operator and traversing inside a unary operator in verify_pred!.

    For example, an assertion of the form verify_pred!(a == b) will print both the left and right-hand sides when it fails.

  • Add support for sequences (ordered and unordered) to expect_that! and assert_that!.

  • Add result_of! and result_of_ref! matchers for matching with a function applied to the value first.

    Example: verify_that!(100, result_of!(|value| value + 1, eq(101)))?; will pass.

  • Add special cases to verify_eq! so that, when doing eq matching on sequences of tuple elements, the matcher applies tuple matching, distributing eq pointwise.

    This improves the ergonomics of tests that check for tuple contents, such as:

    let hash_map: std::collections::HashMap<String, String> =
        std::collections::HashMap::from([
            ("a".into(), "A".into()),
            ("b".into(), "B".into())]);
    verify_eq!(hash_map, {("a", "A"), ("b", "B")})

    because the matcher for &str is compatible with &String.

    The specialization applies on the inner structure; without it, the general matcher on tuples doesn't apply in the above case due to the definition of PartialEq on whole tuples, which is currently limited by rust-lang/rust#105092.

  • Add is_true! and is_false! Boolean matchers.

Bug Fixes

  • Fix #[gtest] failing to compile when a user-declared std or core module is in scope.

  • Fix stack overflow that occurs when verify_pred! is used with nested function calls.

  • Fix bug in summarize_diff where actual and expected strings were considered equal despite only one of the two ending in a newline character.

Full Changelog: google/googletest-rust@v0.12.0...v0.13.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@Turbo87 Turbo87 merged commit 564ad52 into main Nov 26, 2024
8 checks passed
@Turbo87 Turbo87 deleted the renovate/googletest-0.x branch November 26, 2024 19:56
@codecov
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@06fcc09). Learn more about missing BASE report.
Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10081   +/-   ##
=======================================
  Coverage        ?   89.48%           
=======================================
  Files           ?      295           
  Lines           ?    31265           
  Branches        ?        0           
=======================================
  Hits            ?    27978           
  Misses          ?     3287           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants