Skip to content

Commit ba20265

Browse files
committed
Add tests for inherit_workspace_package_table
Signed-off-by: hi-rustin <[email protected]>
1 parent 6c6bc32 commit ba20265

File tree

39 files changed

+400
-1
lines changed

39 files changed

+400
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[workspace]
2+
members = [
3+
"foo",
4+
]
5+
6+
[workspace.package]
7+
authors = ["Rustaceans"]
8+
description = "foo"
9+
edition = "2018"
10+
homepage = "foo"
11+
keywords = ["foo", "bar"]
12+
readme = "README.md"
13+
rust-version = "1.67.0"
14+
categories = ["algorithms"]
15+
documentation = "foo"
16+
exclude = ["foo"]
17+
include = ["foo"]
18+
license = "MIT OR Apache-2.0"
19+
publish = false
20+
repository = "foo"
21+
version = "1.2.3"

tests/testsuite/cargo_new/inherit_workspace_package_table.in/README.md

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pub fn add(left: usize, right: usize) -> usize {
2+
left + right
3+
}
4+
5+
#[cfg(test)]
6+
mod tests {
7+
use super::*;
8+
9+
#[test]
10+
fn it_works() {
11+
let result = add(2, 2);
12+
assert_eq!(result, 4);
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../inherit_workspace_package_table.in
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use cargo_test_support::compare::assert_ui;
2+
use cargo_test_support::curr_dir;
3+
use cargo_test_support::CargoCommand;
4+
use cargo_test_support::Project;
5+
6+
#[cargo_test]
7+
fn case() {
8+
let project = Project::from_template(curr_dir!().join("in"));
9+
let project_root = project.root();
10+
let cwd = &project_root;
11+
12+
snapbox::cmd::Command::cargo_ui()
13+
.arg("new")
14+
.args(["foo"])
15+
.current_dir(cwd)
16+
.assert()
17+
.success()
18+
.stdout_matches_path(curr_dir!().join("stdout.log"))
19+
.stderr_matches_path(curr_dir!().join("stderr.log"));
20+
21+
assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[workspace]
2+
members = [
3+
"foo",
4+
]
5+
6+
[workspace.package]
7+
authors = ["Rustaceans"]
8+
description = "foo"
9+
edition = "2018"
10+
homepage = "foo"
11+
keywords = ["foo", "bar"]
12+
readme = "README.md"
13+
rust-version = "1.67.0"
14+
categories = ["algorithms"]
15+
documentation = "foo"
16+
exclude = ["foo"]
17+
include = ["foo"]
18+
license = "MIT OR Apache-2.0"
19+
publish = false
20+
repository = "foo"
21+
version = "1.2.3"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "foo"
3+
version.workspace = true
4+
edition.workspace = true
5+
publish.workspace = true
6+
authors.workspace = true
7+
categories.workspace = true
8+
description.workspace = true
9+
documentation.workspace = true
10+
exclude.workspace = true
11+
homepage.workspace = true
12+
include.workspace = true
13+
keywords.workspace = true
14+
license.workspace = true
15+
readme.workspace = true
16+
repository.workspace = true
17+
rust-version.workspace = true
18+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
19+
20+
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pub fn add(left: usize, right: usize) -> usize {
2+
left + right
3+
}
4+
5+
#[cfg(test)]
6+
mod tests {
7+
use super::*;
8+
9+
#[test]
10+
fn it_works() {
11+
let result = add(2, 2);
12+
assert_eq!(result, 4);
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Created binary (application) `foo` package

tests/testsuite/cargo_new/inherit_workspace_package_table/stdout.log

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../inherit_workspace_package_table.in
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use cargo_test_support::compare::assert_ui;
2+
use cargo_test_support::curr_dir;
3+
use cargo_test_support::CargoCommand;
4+
use cargo_test_support::Project;
5+
6+
#[cargo_test]
7+
fn case() {
8+
let project = Project::from_template(curr_dir!().join("in"));
9+
let project_root = project.root();
10+
let cwd = &project_root;
11+
12+
snapbox::cmd::Command::cargo_ui()
13+
.arg("new")
14+
.args(["foo", "--edition", "2021"])
15+
.current_dir(cwd)
16+
.assert()
17+
.success()
18+
.stdout_matches_path(curr_dir!().join("stdout.log"))
19+
.stderr_matches_path(curr_dir!().join("stderr.log"));
20+
21+
assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[workspace]
2+
members = [
3+
"foo",
4+
]
5+
6+
[workspace.package]
7+
authors = ["Rustaceans"]
8+
description = "foo"
9+
edition = "2018"
10+
homepage = "foo"
11+
keywords = ["foo", "bar"]
12+
readme = "README.md"
13+
rust-version = "1.67.0"
14+
categories = ["algorithms"]
15+
documentation = "foo"
16+
exclude = ["foo"]
17+
include = ["foo"]
18+
license = "MIT OR Apache-2.0"
19+
publish = false
20+
repository = "foo"
21+
version = "1.2.3"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "foo"
3+
version.workspace = true
4+
edition = "2021"
5+
publish.workspace = true
6+
authors.workspace = true
7+
categories.workspace = true
8+
description.workspace = true
9+
documentation.workspace = true
10+
exclude.workspace = true
11+
homepage.workspace = true
12+
include.workspace = true
13+
keywords.workspace = true
14+
license.workspace = true
15+
readme.workspace = true
16+
repository.workspace = true
17+
rust-version.workspace = true
18+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
19+
20+
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pub fn add(left: usize, right: usize) -> usize {
2+
left + right
3+
}
4+
5+
#[cfg(test)]
6+
mod tests {
7+
use super::*;
8+
9+
#[test]
10+
fn it_works() {
11+
let result = add(2, 2);
12+
assert_eq!(result, 4);
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Created binary (application) `foo` package

tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/stdout.log

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../inherit_workspace_package_table.in
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use cargo_test_support::compare::assert_ui;
2+
use cargo_test_support::curr_dir;
3+
use cargo_test_support::CargoCommand;
4+
use cargo_test_support::Project;
5+
6+
#[cargo_test]
7+
fn case() {
8+
let project = Project::from_template(curr_dir!().join("in"));
9+
let project_root = project.root();
10+
let cwd = &project_root;
11+
12+
snapbox::cmd::Command::cargo_ui()
13+
.arg("new")
14+
.args(["foo", "--registry", "foo"])
15+
.current_dir(cwd)
16+
.assert()
17+
.success()
18+
.stdout_matches_path(curr_dir!().join("stdout.log"))
19+
.stderr_matches_path(curr_dir!().join("stderr.log"));
20+
21+
assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[workspace]
2+
members = [
3+
"foo",
4+
]
5+
6+
[workspace.package]
7+
authors = ["Rustaceans"]
8+
description = "foo"
9+
edition = "2018"
10+
homepage = "foo"
11+
keywords = ["foo", "bar"]
12+
readme = "README.md"
13+
rust-version = "1.67.0"
14+
categories = ["algorithms"]
15+
documentation = "foo"
16+
exclude = ["foo"]
17+
include = ["foo"]
18+
license = "MIT OR Apache-2.0"
19+
publish = false
20+
repository = "foo"
21+
version = "1.2.3"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "foo"
3+
version.workspace = true
4+
edition.workspace = true
5+
publish = ["foo"]
6+
authors.workspace = true
7+
categories.workspace = true
8+
description.workspace = true
9+
documentation.workspace = true
10+
exclude.workspace = true
11+
homepage.workspace = true
12+
include.workspace = true
13+
keywords.workspace = true
14+
license.workspace = true
15+
readme.workspace = true
16+
repository.workspace = true
17+
rust-version.workspace = true
18+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
19+
20+
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pub fn add(left: usize, right: usize) -> usize {
2+
left + right
3+
}
4+
5+
#[cfg(test)]
6+
mod tests {
7+
use super::*;
8+
9+
#[test]
10+
fn it_works() {
11+
let result = add(2, 2);
12+
assert_eq!(result, 4);
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Created binary (application) `foo` package

tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/stdout.log

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[workspace]
2+
members = [
3+
"foo",
4+
]
5+
6+
[workspace.package]
7+
authors = ["Rustaceans"]
8+
description = "foo"
9+
edition = "2018"
10+
homepage = "foo"
11+
keywords = ["foo", "bar"]
12+
readme = "README.md"
13+
rust-version = "1.67.0"
14+
categories = ["algorithms"]
15+
documentation = "foo"
16+
exclude = ["foo"]
17+
include = ["foo"]
18+
license = "MIT OR Apache-2.0"
19+
publish = false
20+
repository = "foo"

tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/in/README.md

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pub fn add(left: usize, right: usize) -> usize {
2+
left + right
3+
}
4+
5+
#[cfg(test)]
6+
mod tests {
7+
use super::*;
8+
9+
#[test]
10+
fn it_works() {
11+
let result = add(2, 2);
12+
assert_eq!(result, 4);
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use cargo_test_support::compare::assert_ui;
2+
use cargo_test_support::curr_dir;
3+
use cargo_test_support::CargoCommand;
4+
use cargo_test_support::Project;
5+
6+
#[cargo_test]
7+
fn case() {
8+
let project = Project::from_template(curr_dir!().join("in"));
9+
let project_root = project.root();
10+
let cwd = &project_root;
11+
12+
snapbox::cmd::Command::cargo_ui()
13+
.arg("new")
14+
.args(["foo", "--edition", "2021"])
15+
.current_dir(cwd)
16+
.assert()
17+
.success()
18+
.stdout_matches_path(curr_dir!().join("stdout.log"))
19+
.stderr_matches_path(curr_dir!().join("stderr.log"));
20+
21+
assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[workspace]
2+
members = [
3+
"foo",
4+
]
5+
6+
[workspace.package]
7+
authors = ["Rustaceans"]
8+
description = "foo"
9+
edition = "2018"
10+
homepage = "foo"
11+
keywords = ["foo", "bar"]
12+
readme = "README.md"
13+
rust-version = "1.67.0"
14+
categories = ["algorithms"]
15+
documentation = "foo"
16+
exclude = ["foo"]
17+
include = ["foo"]
18+
license = "MIT OR Apache-2.0"
19+
publish = false
20+
repository = "foo"

0 commit comments

Comments
 (0)