Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate tests of cargo-init to snapbox #10620

Merged
merged 6 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/snapshots/init/auto_git.in
2 changes: 2 additions & 0 deletions tests/snapshots/init/auto_git.out/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
/Cargo.lock
8 changes: 8 additions & 0 deletions tests/snapshots/init/auto_git.out/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
8 changes: 8 additions & 0 deletions tests/snapshots/init/auto_git.out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}
1 change: 1 addition & 0 deletions tests/snapshots/init/auto_git.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created library package
epage marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

1 change: 1 addition & 0 deletions tests/snapshots/init/bin_already_exists_explicit.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created binary (application) package
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
name = "case"
path = "main.rs"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created binary (application) package
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

1 change: 1 addition & 0 deletions tests/snapshots/init/bin_already_exists_implicit.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created binary (application) package
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
name = "case"
path = "case.rs"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created binary (application) package
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
name = "case"
path = "src/case.rs"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created binary (application) package
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
name = "case"
path = "main.rs"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("Check that our file is not overwritten")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created binary (application) package
Empty file.
1 change: 1 addition & 0 deletions tests/snapshots/init/both_lib_and_bin.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error: can't specify both lib and binary outputs
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn f() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error: cannot have a package with multiple libraries, found both `case.rs` and `lib.rs`
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn f() { println!("lib.rs"); }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn f() { println!("src/lib.rs"); }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn f() { println!("lib.rs"); }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn f() { println!("src/lib.rs"); }
1 change: 1 addition & 0 deletions tests/snapshots/init/confused_by_multiple_lib_files.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error: cannot have a package with multiple libraries, found both `src/lib.rs` and `lib.rs`
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn f() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
name = "case"
path = "case.rs"

[lib]
name = "case"
path = "lib.rs"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn f() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created binary (application) package
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn f() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
name = "case"
path = "case.rs"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn f() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
warning: file `case.rs` seems to be a library file
Created binary (application) package
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[lib]
name = "case"
path = "case.rs"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
warning: file `case.rs` seems to be a binary (application) file
Created library package
Empty file.
1 change: 1 addition & 0 deletions tests/snapshots/init/explicit_bin_with_git.in
1 change: 1 addition & 0 deletions tests/snapshots/init/explicit_bin_with_git.out/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
8 changes: 8 additions & 0 deletions tests/snapshots/init/explicit_bin_with_git.out/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
3 changes: 3 additions & 0 deletions tests/snapshots/init/explicit_bin_with_git.out/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
1 change: 1 addition & 0 deletions tests/snapshots/init/explicit_bin_with_git.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created binary (application) package
Empty file.
1 change: 1 addition & 0 deletions tests/snapshots/init/formats_source.in/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tab_spaces = 2
8 changes: 8 additions & 0 deletions tests/snapshots/init/formats_source.out/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/snapshots/init/formats_source.out/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tab_spaces = 2
8 changes: 8 additions & 0 deletions tests/snapshots/init/formats_source.out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}
1 change: 1 addition & 0 deletions tests/snapshots/init/formats_source.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created library package
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
Cargo.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
Cargo.lock
8 changes: 8 additions & 0 deletions tests/snapshots/init/fossil_autodetect.out/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
8 changes: 8 additions & 0 deletions tests/snapshots/init/fossil_autodetect.out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}
1 change: 1 addition & 0 deletions tests/snapshots/init/fossil_autodetect.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created library package
Empty file.
2 changes: 2 additions & 0 deletions tests/snapshots/init/git_autodetect.out/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
/Cargo.lock
8 changes: 8 additions & 0 deletions tests/snapshots/init/git_autodetect.out/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "foo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
8 changes: 8 additions & 0 deletions tests/snapshots/init/git_autodetect.out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}
1 change: 1 addition & 0 deletions tests/snapshots/init/git_autodetect.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created library package
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/some.file
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/some.file

# Added by cargo

/target
/Cargo.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "case"
version = "0.1.0"
edition = "2015"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created library package
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tab_spaces = 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tab_spaces = 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Created library package
Empty file.
Loading