Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
tonowak committed Feb 20, 2023
1 parent 3f88860 commit 2c2e7c9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test_crates/target-specific-dependencies/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
publish = false
name = "target-specific-dependencies"
version = "0.1.0"
edition = "2021"

[target.none.dependencies]
async-std = { version = "1.6.2", optional = true }
7 changes: 7 additions & 0 deletions test_crates/target-specific-dependencies/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() {
// This crate checks whether the tool correctly detects
// implicit features defined by target-specific dependencies.
// /~https://github.com/obi1kenobi/cargo-semver-checks/issues/369
#[cfg(not(feature = "async-std"))]
panic!("the tool should have built the project with this flag");
}
17 changes: 17 additions & 0 deletions tests/detects_target_dependencies.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use assert_cmd::Command;

#[test]
fn detects_target_dependencies() {
// This test checks whether the tool correctly detects
// implicit features defined by target-specific dependencies.
// /~https://github.com/obi1kenobi/cargo-semver-checks/issues/369
let mut cmd = Command::cargo_bin("cargo-semver-checks").unwrap();
cmd.current_dir(format!("test_crates/target-specific-dependencies"))
.args([
"semver-checks",
"check-release",
"--baseline-root=.",
])
.assert()
.success();
}

0 comments on commit 2c2e7c9

Please sign in to comment.