-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for when all members in a workspace are
publish = false
(#859
) * Add snapshot testing with `insta` * temporary dead code allows * explicitly disable backtraces * use `insta_cmd` for command snapshots * move snapshot tests to lib tests * add snapshot bin test harness * Revert "move snapshot tests to lib tests" This reverts commit 72f99bc. * Add test for no lib targets in the workspace * move snapshot outputs to lib tests * move snapshots directory to lib tests * Revert "move snapshots directory to lib tests" This reverts commit b56a113. * Revert "move snapshot outputs to lib tests" This reverts commit 8b6494c. * add test files * Add test for all workspace members `publish = false` * Add snapshot testing with `insta` * temporary dead code allows * explicitly disable backtraces * use `insta_cmd` for command snapshots * move snapshot tests to lib tests * add snapshot bin test harness * fix docs * clippy fixes * fix merge ;( * ... * remove old test file * delete crates again
- Loading branch information
1 parent
0ed4827
commit c53ff88
Showing
13 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test_crates/manifest_tests/workspace_all_publish_false/new/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = ["a", "b"] |
7 changes: 7 additions & 0 deletions
7
test_crates/manifest_tests/workspace_all_publish_false/new/a/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "a" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] |
4 changes: 4 additions & 0 deletions
4
test_crates/manifest_tests/workspace_all_publish_false/new/a/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Removed in new version, so would trigger `function_missing` lint, | ||
// but this crate is set to `publish = false`, so `cargo-semver-checks` | ||
// should not check it. | ||
// pub fn should_not_run() {} |
7 changes: 7 additions & 0 deletions
7
test_crates/manifest_tests/workspace_all_publish_false/new/b/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "b" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] |
2 changes: 2 additions & 0 deletions
2
test_crates/manifest_tests/workspace_all_publish_false/new/b/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// An empty library target with `publish = false`, that should | ||
// not be semver-checked. |
3 changes: 3 additions & 0 deletions
3
test_crates/manifest_tests/workspace_all_publish_false/old/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = ["a", "b"] |
7 changes: 7 additions & 0 deletions
7
test_crates/manifest_tests/workspace_all_publish_false/old/a/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "a" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] |
4 changes: 4 additions & 0 deletions
4
test_crates/manifest_tests/workspace_all_publish_false/old/a/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Removed in new version, so would trigger `function_missing` lint, | ||
// but this crate is set to `publish = false`, so `cargo-semver-checks` | ||
// should not check it. | ||
pub fn should_not_run() {} |
7 changes: 7 additions & 0 deletions
7
test_crates/manifest_tests/workspace_all_publish_false/old/b/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "b" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] |
2 changes: 2 additions & 0 deletions
2
test_crates/manifest_tests/workspace_all_publish_false/old/b/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// An empty library target with `publish = false`, that should | ||
// not be semver-checked. |
30 changes: 30 additions & 0 deletions
30
...napshot_tests/cargo_semver_checks__snapshot_tests__workspace_all_publish_false-input.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
source: src/snapshot_tests.rs | ||
expression: check | ||
--- | ||
Check( | ||
scope: Scope( | ||
mode: DenyList(PackageSelection( | ||
selection: Workspace, | ||
excluded_packages: [], | ||
)), | ||
), | ||
current: Rustdoc( | ||
source: Root("test_crates/manifest_tests/workspace_all_publish_false/new"), | ||
), | ||
baseline: Rustdoc( | ||
source: Root("test_crates/manifest_tests/workspace_all_publish_false/old"), | ||
), | ||
release_type: None, | ||
current_feature_config: FeatureConfig( | ||
features_group: Heuristic, | ||
extra_features: [], | ||
is_baseline: false, | ||
), | ||
baseline_feature_config: FeatureConfig( | ||
features_group: Heuristic, | ||
extra_features: [], | ||
is_baseline: true, | ||
), | ||
build_target: None, | ||
) |
8 changes: 8 additions & 0 deletions
8
...apshot_tests/cargo_semver_checks__snapshot_tests__workspace_all_publish_false-output.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
source: src/snapshot_tests.rs | ||
expression: result | ||
--- | ||
success: true | ||
--- stdout --- | ||
|
||
--- stderr --- |