Skip to content

Commit

Permalink
Add test case for fuzzy package adding issue rust-lang#13702
Browse files Browse the repository at this point in the history
  • Loading branch information
dohse committed Apr 17, 2024
1 parent 6f06fe9 commit 9b201d7
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[workspace]
members = ["primary"]

[workspace.dependencies]
fuzzy_dependency = "1.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "bar"
version = "0.0.0"
edition = "2015"
Empty file.
30 changes: 30 additions & 0 deletions tests/testsuite/cargo_add/detect_workspace_inherit_fuzzy/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::registry::Package;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
#[ignore]
fn case() {
cargo_test_support::registry::init();

Package::new("fuzzy_dependency", "1.0.0").publish();

let project = Project::from_template(current_dir!().join("in"));
let project_root = project.root();
let cwd = &project_root;

snapbox::cmd::Command::cargo_ui()
.arg("add")
.args(["fuzzy-dependency", "-p", "bar"])
.current_dir(cwd)
.assert()
.success()
.stdout_matches(str![""])
.stderr_matches(file!["stderr.term.svg"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[workspace]
members = ["primary"]

[workspace.dependencies]
fuzzy_dependency = "1.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "bar"
version = "0.0.0"
edition = "2015"

[dependencies]
fuzzy_dependency.workspace = true
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/testsuite/cargo_add/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod deprecated_default_features;
mod deprecated_section;
mod detect_workspace_inherit;
mod detect_workspace_inherit_features;
mod detect_workspace_inherit_fuzzy;
mod detect_workspace_inherit_optional;
mod detect_workspace_inherit_public;
mod dev;
Expand Down

0 comments on commit 9b201d7

Please sign in to comment.