From 2aadc03ef15cb5ca5cc2af8a7c08e070742f0ac4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:47:55 +0200 Subject: Adding upstream version 0.70.1+ds1. Signed-off-by: Daniel Baumann --- tests/testsuite/init/git_autodetect/mod.rs | 24 ++++++++++++++++++++++ tests/testsuite/init/git_autodetect/out/.gitignore | 2 ++ tests/testsuite/init/git_autodetect/out/Cargo.toml | 8 ++++++++ tests/testsuite/init/git_autodetect/out/src/lib.rs | 14 +++++++++++++ tests/testsuite/init/git_autodetect/stderr.log | 1 + tests/testsuite/init/git_autodetect/stdout.log | 0 6 files changed, 49 insertions(+) create mode 100644 tests/testsuite/init/git_autodetect/mod.rs create mode 100644 tests/testsuite/init/git_autodetect/out/.gitignore create mode 100644 tests/testsuite/init/git_autodetect/out/Cargo.toml create mode 100644 tests/testsuite/init/git_autodetect/out/src/lib.rs create mode 100644 tests/testsuite/init/git_autodetect/stderr.log create mode 100644 tests/testsuite/init/git_autodetect/stdout.log (limited to 'tests/testsuite/init/git_autodetect') diff --git a/tests/testsuite/init/git_autodetect/mod.rs b/tests/testsuite/init/git_autodetect/mod.rs new file mode 100644 index 0000000..aef47bc --- /dev/null +++ b/tests/testsuite/init/git_autodetect/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::paths; +use cargo_test_support::prelude::*; +use std::fs; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project_root = &paths::root().join("foo"); + // Need to create `.git` dir manually because it cannot be tracked under a git repo + fs::create_dir_all(project_root.join(".git")).unwrap(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib") + .current_dir(project_root) + .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); + assert!(project_root.join(".git").is_dir()); +} diff --git a/tests/testsuite/init/git_autodetect/out/.gitignore b/tests/testsuite/init/git_autodetect/out/.gitignore new file mode 100644 index 0000000..4fffb2f --- /dev/null +++ b/tests/testsuite/init/git_autodetect/out/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/tests/testsuite/init/git_autodetect/out/Cargo.toml b/tests/testsuite/init/git_autodetect/out/Cargo.toml new file mode 100644 index 0000000..1d9cfe3 --- /dev/null +++ b/tests/testsuite/init/git_autodetect/out/Cargo.toml @@ -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] diff --git a/tests/testsuite/init/git_autodetect/out/src/lib.rs b/tests/testsuite/init/git_autodetect/out/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/tests/testsuite/init/git_autodetect/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/tests/testsuite/init/git_autodetect/stderr.log b/tests/testsuite/init/git_autodetect/stderr.log new file mode 100644 index 0000000..f459bf2 --- /dev/null +++ b/tests/testsuite/init/git_autodetect/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/tests/testsuite/init/git_autodetect/stdout.log b/tests/testsuite/init/git_autodetect/stdout.log new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3