summaryrefslogtreecommitdiffstats
path: root/src/tools/cargo/tests/testsuite/init
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/cargo/tests/testsuite/init')
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/Cargo.toml21
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/README.md0
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/crates/foo/src/main.rs3
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/src/lib.rs14
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/mod.rs22
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/Cargo.toml21
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/Cargo.toml21
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/src/main.rs3
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/src/lib.rs14
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stderr.log1
-rw-r--r--src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stdout.log0
-rw-r--r--src/tools/cargo/tests/testsuite/init/mod.rs1
12 files changed, 121 insertions, 0 deletions
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/Cargo.toml b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/Cargo.toml
new file mode 100644
index 000000000..b7a2e9036
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/Cargo.toml
@@ -0,0 +1,21 @@
+[workspace]
+members = [
+ "crates/*",
+]
+
+[workspace.package]
+authors = ["Rustaceans"]
+description = "foo"
+edition = "2018"
+homepage = "foo"
+keywords = ["foo", "bar"]
+readme = "README.md"
+rust-version = "1.67.0"
+categories = ["algorithms"]
+documentation = "foo"
+exclude = ["foo"]
+include = ["foo"]
+license = "MIT OR Apache-2.0"
+publish = false
+repository = "foo"
+version = "1.2.3"
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/README.md b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/README.md
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/README.md
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/crates/foo/src/main.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/crates/foo/src/main.rs
new file mode 100644
index 000000000..43f0dac5e
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/crates/foo/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("Check that our file is not overwritten")
+}
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/src/lib.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/src/lib.rs
new file mode 100644
index 000000000..7d12d9af8
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/src/lib.rs
@@ -0,0 +1,14 @@
+pub fn add(left: usize, right: usize) -> usize {
+ left + right
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn it_works() {
+ let result = add(2, 2);
+ assert_eq!(result, 4);
+ }
+}
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/mod.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/mod.rs
new file mode 100644
index 000000000..4e1dda845
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/mod.rs
@@ -0,0 +1,22 @@
+use cargo_test_support::compare::assert_ui;
+use cargo_test_support::curr_dir;
+use cargo_test_support::CargoCommand;
+use cargo_test_support::Project;
+
+#[cargo_test]
+fn case() {
+ let project = Project::from_template(curr_dir!().join("in"));
+ let project_root = project.root();
+ let cwd = &project_root;
+
+ snapbox::cmd::Command::cargo_ui()
+ .arg("init")
+ .args(["crates/foo"])
+ .current_dir(cwd)
+ .assert()
+ .success()
+ .stdout_matches_path(curr_dir!().join("stdout.log"))
+ .stderr_matches_path(curr_dir!().join("stderr.log"));
+
+ assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
+}
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/Cargo.toml
new file mode 100644
index 000000000..b7a2e9036
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/Cargo.toml
@@ -0,0 +1,21 @@
+[workspace]
+members = [
+ "crates/*",
+]
+
+[workspace.package]
+authors = ["Rustaceans"]
+description = "foo"
+edition = "2018"
+homepage = "foo"
+keywords = ["foo", "bar"]
+readme = "README.md"
+rust-version = "1.67.0"
+categories = ["algorithms"]
+documentation = "foo"
+exclude = ["foo"]
+include = ["foo"]
+license = "MIT OR Apache-2.0"
+publish = false
+repository = "foo"
+version = "1.2.3"
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/Cargo.toml b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/Cargo.toml
new file mode 100644
index 000000000..137ed1c87
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/Cargo.toml
@@ -0,0 +1,21 @@
+[package]
+name = "foo"
+authors.workspace = true
+description.workspace = true
+edition.workspace = true
+homepage.workspace = true
+keywords.workspace = true
+readme.workspace = true
+rust-version.workspace = true
+categories.workspace = true
+documentation.workspace = true
+exclude.workspace = true
+include.workspace = true
+license.workspace = true
+publish.workspace = true
+repository.workspace = true
+version.workspace = true
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/src/main.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/src/main.rs
new file mode 100644
index 000000000..43f0dac5e
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("Check that our file is not overwritten")
+}
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/src/lib.rs
new file mode 100644
index 000000000..7d12d9af8
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/src/lib.rs
@@ -0,0 +1,14 @@
+pub fn add(left: usize, right: usize) -> usize {
+ left + right
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn it_works() {
+ let result = add(2, 2);
+ assert_eq!(result, 4);
+ }
+}
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stderr.log b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stderr.log
new file mode 100644
index 000000000..3847e4e4a
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stderr.log
@@ -0,0 +1 @@
+ Created binary (application) package
diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stdout.log b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stdout.log
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stdout.log
diff --git a/src/tools/cargo/tests/testsuite/init/mod.rs b/src/tools/cargo/tests/testsuite/init/mod.rs
index 99df9d39d..7853a1a0b 100644
--- a/src/tools/cargo/tests/testsuite/init/mod.rs
+++ b/src/tools/cargo/tests/testsuite/init/mod.rs
@@ -21,6 +21,7 @@ mod git_ignore_exists_no_conflicting_entries;
mod ignores_failure_to_format_source;
mod inferred_bin_with_git;
mod inferred_lib_with_git;
+mod inherit_workspace_package_table;
mod invalid_dir_name;
mod lib_already_exists_nosrc;
mod lib_already_exists_src;