Skip to content

Commit

Permalink
chore: Bump unimock to development version
Browse files Browse the repository at this point in the history
  • Loading branch information
audunhalland committed Mar 25, 2024
1 parent 7633542 commit 34179f7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/async-graphql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion examples/axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
30 changes: 30 additions & 0 deletions tests/it/unimock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> = Result<T, ()>;

#[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()))),
);
}
}

0 comments on commit 34179f7

Please sign in to comment.