-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for
inherit_workspace_package_table
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
- Loading branch information
1 parent
6c6bc32
commit c19e6dd
Showing
39 changed files
with
400 additions
and
1 deletion.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
tests/testsuite/cargo_new/inherit_workspace_package_table.in/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,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" |
Empty file.
14 changes: 14 additions & 0 deletions
14
tests/testsuite/cargo_new/inherit_workspace_package_table.in/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,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); | ||
} | ||
} |
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 @@ | ||
../inherit_workspace_package_table.in |
22 changes: 22 additions & 0 deletions
22
tests/testsuite/cargo_new/inherit_workspace_package_table/mod.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,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("new") | ||
.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); | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/testsuite/cargo_new/inherit_workspace_package_table/out/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,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" |
20 changes: 20 additions & 0 deletions
20
tests/testsuite/cargo_new/inherit_workspace_package_table/out/crates/foo/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,20 @@ | ||
[package] | ||
name = "foo" | ||
version.workspace = true | ||
edition.workspace = true | ||
publish.workspace = true | ||
authors.workspace = true | ||
categories.workspace = true | ||
description.workspace = true | ||
documentation.workspace = true | ||
exclude.workspace = true | ||
homepage.workspace = true | ||
include.workspace = true | ||
keywords.workspace = true | ||
license.workspace = true | ||
readme.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true | ||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
3 changes: 3 additions & 0 deletions
3
tests/testsuite/cargo_new/inherit_workspace_package_table/out/crates/foo/src/main.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,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/testsuite/cargo_new/inherit_workspace_package_table/out/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,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); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_new/inherit_workspace_package_table/stderr.log
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 @@ | ||
Created binary (application) `crates/foo` package |
Empty file.
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/in
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 @@ | ||
../inherit_workspace_package_table.in |
22 changes: 22 additions & 0 deletions
22
tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/mod.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,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("new") | ||
.args(["crates/foo", "--edition", "2021"]) | ||
.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); | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/out/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,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" |
20 changes: 20 additions & 0 deletions
20
...estsuite/cargo_new/inherit_workspace_package_table_with_edition/out/crates/foo/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,20 @@ | ||
[package] | ||
name = "foo" | ||
version.workspace = true | ||
edition = "2021" | ||
publish.workspace = true | ||
authors.workspace = true | ||
categories.workspace = true | ||
description.workspace = true | ||
documentation.workspace = true | ||
exclude.workspace = true | ||
homepage.workspace = true | ||
include.workspace = true | ||
keywords.workspace = true | ||
license.workspace = true | ||
readme.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true | ||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
3 changes: 3 additions & 0 deletions
3
...stsuite/cargo_new/inherit_workspace_package_table_with_edition/out/crates/foo/src/main.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,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/out/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,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); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/stderr.log
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 @@ | ||
Created binary (application) `crates/foo` package |
Empty file.
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/in
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 @@ | ||
../inherit_workspace_package_table.in |
22 changes: 22 additions & 0 deletions
22
tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/mod.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,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("new") | ||
.args(["crates/foo", "--registry", "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); | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/out/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,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" |
20 changes: 20 additions & 0 deletions
20
...stsuite/cargo_new/inherit_workspace_package_table_with_registry/out/crates/foo/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,20 @@ | ||
[package] | ||
name = "foo" | ||
version.workspace = true | ||
edition.workspace = true | ||
publish = ["foo"] | ||
authors.workspace = true | ||
categories.workspace = true | ||
description.workspace = true | ||
documentation.workspace = true | ||
exclude.workspace = true | ||
homepage.workspace = true | ||
include.workspace = true | ||
keywords.workspace = true | ||
license.workspace = true | ||
readme.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true | ||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
3 changes: 3 additions & 0 deletions
3
...tsuite/cargo_new/inherit_workspace_package_table_with_registry/out/crates/foo/src/main.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,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/out/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,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); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/stderr.log
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 @@ | ||
Created binary (application) `crates/foo` package |
Empty file.
20 changes: 20 additions & 0 deletions
20
tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/in/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,20 @@ | ||
[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" |
Empty file.
14 changes: 14 additions & 0 deletions
14
tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/in/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,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); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/mod.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,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("new") | ||
.args(["crates/foo", "--edition", "2021"]) | ||
.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); | ||
} |
20 changes: 20 additions & 0 deletions
20
tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/out/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,20 @@ | ||
[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" |
Oops, something went wrong.