From 34179f7549f4a6550acda643caa2b009c109ac1b Mon Sep 17 00:00:00 2001 From: Audun Halland Date: Mon, 25 Mar 2024 01:10:15 +0100 Subject: [PATCH] chore: Bump unimock to development version --- Cargo.toml | 2 +- examples/async-graphql/Cargo.toml | 2 +- examples/axum/Cargo.toml | 2 +- tests/it/unimock.rs | 30 ++++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cef3330..d704b47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ nightly-tests = [] entrait_macros = { path = "entrait_macros", version = "0.6.0" } implementation = "0.1" async-trait = { version = "0.1", optional = true } -unimock = { version = "0.5", optional = true } +unimock = { git = "https://github.com/audunhalland/unimock", optional = true } [dev-dependencies] tokio = { version = "1", features = ["macros", "rt"] } diff --git a/examples/async-graphql/Cargo.toml b/examples/async-graphql/Cargo.toml index 9f227a2..af8928f 100644 --- a/examples/async-graphql/Cargo.toml +++ b/examples/async-graphql/Cargo.toml @@ -16,4 +16,4 @@ tower = "0.4" tower-http = { version = "0.3", features = ["trace"] } hyper = { version = "0.14", features = ["full"] } serde_json = "1" -unimock = "0.5" +unimock = { git = "https://github.com/audunhalland/unimock" } diff --git a/examples/axum/Cargo.toml b/examples/axum/Cargo.toml index f2e12f3..370012c 100644 --- a/examples/axum/Cargo.toml +++ b/examples/axum/Cargo.toml @@ -17,4 +17,4 @@ tower = "0.4" tower-http = { version = "0.3", features = ["trace"] } hyper = { version = "0.14", features = ["full"] } serde_json = "1" -unimock = "0.5" +unimock = { git = "https://github.com/audunhalland/unimock" } diff --git a/tests/it/unimock.rs b/tests/it/unimock.rs index 9d6a18d..450dbf3 100644 --- a/tests/it/unimock.rs +++ b/tests/it/unimock.rs @@ -617,3 +617,33 @@ fn level_without_mock_support() { takes_b(&Unimock::new(())); takes_c(&Unimock::new(())); } + +// unimock issue https://github.com/audunhalland/unimock/issues/40 +mod arg_mutation_and_result_alias { + use std::process::ExitStatus; + + use entrait::*; + use unimock::*; + + type MyResult = Result; + + #[entrait(pub Exec, mock_api=ExecMock)] + fn exec( + _deps: &impl std::any::Any, + command: &mut std::process::Command, + ) -> MyResult<(ExitStatus, String)> { + Err(()) + } + + #[test] + #[should_panic(expected = "Dead mocks should be removed")] + fn test() { + use std::os::unix::process::ExitStatusExt; + + Unimock::new( + ExecMock + .each_call(matching!((command) if command.get_program() == "editor")) + .answers(&|_, _| Ok((ExitStatusExt::from_raw(1), String::new()))), + ); + } +}