From 3745212abf0353f15fec41556c55ee1d30d69f0a Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 8 Oct 2024 22:20:28 +0200 Subject: [PATCH] refactor integration tests for a more modern look --- gix/tests/gix-init.rs | 13 ++++++++++--- gix/tests/{ => gix}/clone/mod.rs | 0 gix/tests/{ => gix}/commit/mod.rs | 0 gix/tests/{ => gix}/config/mod.rs | 0 gix/tests/{ => gix}/config/tree.rs | 0 gix/tests/{ => gix}/diff/mod.rs | 0 gix/tests/{ => gix}/head/mod.rs | 0 gix/tests/{ => gix}/id/mod.rs | 0 gix/tests/{ => gix}/init/mod.rs | 0 gix/tests/{gix.rs => gix/main.rs} | 0 gix/tests/{ => gix}/object/blob.rs | 0 gix/tests/{ => gix}/object/commit.rs | 0 gix/tests/{ => gix}/object/mod.rs | 0 gix/tests/{ => gix}/object/tree/diff.rs | 0 gix/tests/{ => gix}/object/tree/mod.rs | 0 gix/tests/{ => gix}/reference/mod.rs | 0 gix/tests/{ => gix}/reference/remote.rs | 0 gix/tests/{ => gix}/remote/connect.rs | 0 gix/tests/{ => gix}/remote/fetch.rs | 0 gix/tests/{ => gix}/remote/mod.rs | 0 gix/tests/{ => gix}/remote/ref_map.rs | 0 gix/tests/{ => gix}/remote/save.rs | 0 .../config/config_snapshot/credential_helpers.rs | 0 .../repository/config/config_snapshot/mod.rs | 0 gix/tests/{ => gix}/repository/config/identity.rs | 0 gix/tests/{ => gix}/repository/config/mod.rs | 0 gix/tests/{ => gix}/repository/config/remote.rs | 0 .../repository/config/transport_options.rs | 0 gix/tests/{ => gix}/repository/excludes.rs | 0 gix/tests/{ => gix}/repository/filter.rs | 0 gix/tests/{ => gix}/repository/mod.rs | 0 gix/tests/{ => gix}/repository/object.rs | 0 gix/tests/{ => gix}/repository/open.rs | 0 gix/tests/{ => gix}/repository/pathspec.rs | 0 gix/tests/{ => gix}/repository/reference.rs | 0 gix/tests/{ => gix}/repository/remote.rs | 0 gix/tests/{ => gix}/repository/shallow.rs | 0 gix/tests/{ => gix}/repository/state.rs | 0 gix/tests/{ => gix}/repository/submodule.rs | 0 gix/tests/{ => gix}/repository/worktree.rs | 0 gix/tests/{ => gix}/revision/mod.rs | 0 .../{ => gix}/revision/spec/from_bytes/ambiguous.rs | 0 gix/tests/{ => gix}/revision/spec/from_bytes/mod.rs | 0 .../{ => gix}/revision/spec/from_bytes/peel.rs | 0 .../{ => gix}/revision/spec/from_bytes/reflog.rs | 0 .../{ => gix}/revision/spec/from_bytes/regex.rs | 0 .../{ => gix}/revision/spec/from_bytes/traverse.rs | 0 .../{ => gix}/revision/spec/from_bytes/util.rs | 0 gix/tests/{ => gix}/revision/spec/mod.rs | 0 gix/tests/{ => gix}/status/mod.rs | 0 gix/tests/{ => gix}/submodule/mod.rs | 0 gix/tests/{ => gix}/util/mod.rs | 0 52 files changed, 10 insertions(+), 3 deletions(-) rename gix/tests/{ => gix}/clone/mod.rs (100%) rename gix/tests/{ => gix}/commit/mod.rs (100%) rename gix/tests/{ => gix}/config/mod.rs (100%) rename gix/tests/{ => gix}/config/tree.rs (100%) rename gix/tests/{ => gix}/diff/mod.rs (100%) rename gix/tests/{ => gix}/head/mod.rs (100%) rename gix/tests/{ => gix}/id/mod.rs (100%) rename gix/tests/{ => gix}/init/mod.rs (100%) rename gix/tests/{gix.rs => gix/main.rs} (100%) rename gix/tests/{ => gix}/object/blob.rs (100%) rename gix/tests/{ => gix}/object/commit.rs (100%) rename gix/tests/{ => gix}/object/mod.rs (100%) rename gix/tests/{ => gix}/object/tree/diff.rs (100%) rename gix/tests/{ => gix}/object/tree/mod.rs (100%) rename gix/tests/{ => gix}/reference/mod.rs (100%) rename gix/tests/{ => gix}/reference/remote.rs (100%) rename gix/tests/{ => gix}/remote/connect.rs (100%) rename gix/tests/{ => gix}/remote/fetch.rs (100%) rename gix/tests/{ => gix}/remote/mod.rs (100%) rename gix/tests/{ => gix}/remote/ref_map.rs (100%) rename gix/tests/{ => gix}/remote/save.rs (100%) rename gix/tests/{ => gix}/repository/config/config_snapshot/credential_helpers.rs (100%) rename gix/tests/{ => gix}/repository/config/config_snapshot/mod.rs (100%) rename gix/tests/{ => gix}/repository/config/identity.rs (100%) rename gix/tests/{ => gix}/repository/config/mod.rs (100%) rename gix/tests/{ => gix}/repository/config/remote.rs (100%) rename gix/tests/{ => gix}/repository/config/transport_options.rs (100%) rename gix/tests/{ => gix}/repository/excludes.rs (100%) rename gix/tests/{ => gix}/repository/filter.rs (100%) rename gix/tests/{ => gix}/repository/mod.rs (100%) rename gix/tests/{ => gix}/repository/object.rs (100%) rename gix/tests/{ => gix}/repository/open.rs (100%) rename gix/tests/{ => gix}/repository/pathspec.rs (100%) rename gix/tests/{ => gix}/repository/reference.rs (100%) rename gix/tests/{ => gix}/repository/remote.rs (100%) rename gix/tests/{ => gix}/repository/shallow.rs (100%) rename gix/tests/{ => gix}/repository/state.rs (100%) rename gix/tests/{ => gix}/repository/submodule.rs (100%) rename gix/tests/{ => gix}/repository/worktree.rs (100%) rename gix/tests/{ => gix}/revision/mod.rs (100%) rename gix/tests/{ => gix}/revision/spec/from_bytes/ambiguous.rs (100%) rename gix/tests/{ => gix}/revision/spec/from_bytes/mod.rs (100%) rename gix/tests/{ => gix}/revision/spec/from_bytes/peel.rs (100%) rename gix/tests/{ => gix}/revision/spec/from_bytes/reflog.rs (100%) rename gix/tests/{ => gix}/revision/spec/from_bytes/regex.rs (100%) rename gix/tests/{ => gix}/revision/spec/from_bytes/traverse.rs (100%) rename gix/tests/{ => gix}/revision/spec/from_bytes/util.rs (100%) rename gix/tests/{ => gix}/revision/spec/mod.rs (100%) rename gix/tests/{ => gix}/status/mod.rs (100%) rename gix/tests/{ => gix}/submodule/mod.rs (100%) rename gix/tests/{ => gix}/util/mod.rs (100%) diff --git a/gix/tests/gix-init.rs b/gix/tests/gix-init.rs index 350fe2a276f..bfe92e7f3ce 100644 --- a/gix/tests/gix-init.rs +++ b/gix/tests/gix-init.rs @@ -1,14 +1,21 @@ -pub mod util; - +#![allow(clippy::result_large_err)] mod with_overrides { use std::borrow::Cow; + use gix::{Repository, ThreadSafeRepository}; use gix_object::bstr::BStr; use gix_sec::Permission; use gix_testtools::Env; use serial_test::serial; - use crate::util::named_subrepo_opts; + pub fn named_subrepo_opts( + fixture: &str, + name: &str, + opts: gix::open::Options, + ) -> std::result::Result { + let repo_path = gix_testtools::scripted_fixture_read_only(fixture).unwrap().join(name); + Ok(ThreadSafeRepository::open_opts(repo_path, opts)?.to_thread_local()) + } #[test] #[serial] diff --git a/gix/tests/clone/mod.rs b/gix/tests/gix/clone/mod.rs similarity index 100% rename from gix/tests/clone/mod.rs rename to gix/tests/gix/clone/mod.rs diff --git a/gix/tests/commit/mod.rs b/gix/tests/gix/commit/mod.rs similarity index 100% rename from gix/tests/commit/mod.rs rename to gix/tests/gix/commit/mod.rs diff --git a/gix/tests/config/mod.rs b/gix/tests/gix/config/mod.rs similarity index 100% rename from gix/tests/config/mod.rs rename to gix/tests/gix/config/mod.rs diff --git a/gix/tests/config/tree.rs b/gix/tests/gix/config/tree.rs similarity index 100% rename from gix/tests/config/tree.rs rename to gix/tests/gix/config/tree.rs diff --git a/gix/tests/diff/mod.rs b/gix/tests/gix/diff/mod.rs similarity index 100% rename from gix/tests/diff/mod.rs rename to gix/tests/gix/diff/mod.rs diff --git a/gix/tests/head/mod.rs b/gix/tests/gix/head/mod.rs similarity index 100% rename from gix/tests/head/mod.rs rename to gix/tests/gix/head/mod.rs diff --git a/gix/tests/id/mod.rs b/gix/tests/gix/id/mod.rs similarity index 100% rename from gix/tests/id/mod.rs rename to gix/tests/gix/id/mod.rs diff --git a/gix/tests/init/mod.rs b/gix/tests/gix/init/mod.rs similarity index 100% rename from gix/tests/init/mod.rs rename to gix/tests/gix/init/mod.rs diff --git a/gix/tests/gix.rs b/gix/tests/gix/main.rs similarity index 100% rename from gix/tests/gix.rs rename to gix/tests/gix/main.rs diff --git a/gix/tests/object/blob.rs b/gix/tests/gix/object/blob.rs similarity index 100% rename from gix/tests/object/blob.rs rename to gix/tests/gix/object/blob.rs diff --git a/gix/tests/object/commit.rs b/gix/tests/gix/object/commit.rs similarity index 100% rename from gix/tests/object/commit.rs rename to gix/tests/gix/object/commit.rs diff --git a/gix/tests/object/mod.rs b/gix/tests/gix/object/mod.rs similarity index 100% rename from gix/tests/object/mod.rs rename to gix/tests/gix/object/mod.rs diff --git a/gix/tests/object/tree/diff.rs b/gix/tests/gix/object/tree/diff.rs similarity index 100% rename from gix/tests/object/tree/diff.rs rename to gix/tests/gix/object/tree/diff.rs diff --git a/gix/tests/object/tree/mod.rs b/gix/tests/gix/object/tree/mod.rs similarity index 100% rename from gix/tests/object/tree/mod.rs rename to gix/tests/gix/object/tree/mod.rs diff --git a/gix/tests/reference/mod.rs b/gix/tests/gix/reference/mod.rs similarity index 100% rename from gix/tests/reference/mod.rs rename to gix/tests/gix/reference/mod.rs diff --git a/gix/tests/reference/remote.rs b/gix/tests/gix/reference/remote.rs similarity index 100% rename from gix/tests/reference/remote.rs rename to gix/tests/gix/reference/remote.rs diff --git a/gix/tests/remote/connect.rs b/gix/tests/gix/remote/connect.rs similarity index 100% rename from gix/tests/remote/connect.rs rename to gix/tests/gix/remote/connect.rs diff --git a/gix/tests/remote/fetch.rs b/gix/tests/gix/remote/fetch.rs similarity index 100% rename from gix/tests/remote/fetch.rs rename to gix/tests/gix/remote/fetch.rs diff --git a/gix/tests/remote/mod.rs b/gix/tests/gix/remote/mod.rs similarity index 100% rename from gix/tests/remote/mod.rs rename to gix/tests/gix/remote/mod.rs diff --git a/gix/tests/remote/ref_map.rs b/gix/tests/gix/remote/ref_map.rs similarity index 100% rename from gix/tests/remote/ref_map.rs rename to gix/tests/gix/remote/ref_map.rs diff --git a/gix/tests/remote/save.rs b/gix/tests/gix/remote/save.rs similarity index 100% rename from gix/tests/remote/save.rs rename to gix/tests/gix/remote/save.rs diff --git a/gix/tests/repository/config/config_snapshot/credential_helpers.rs b/gix/tests/gix/repository/config/config_snapshot/credential_helpers.rs similarity index 100% rename from gix/tests/repository/config/config_snapshot/credential_helpers.rs rename to gix/tests/gix/repository/config/config_snapshot/credential_helpers.rs diff --git a/gix/tests/repository/config/config_snapshot/mod.rs b/gix/tests/gix/repository/config/config_snapshot/mod.rs similarity index 100% rename from gix/tests/repository/config/config_snapshot/mod.rs rename to gix/tests/gix/repository/config/config_snapshot/mod.rs diff --git a/gix/tests/repository/config/identity.rs b/gix/tests/gix/repository/config/identity.rs similarity index 100% rename from gix/tests/repository/config/identity.rs rename to gix/tests/gix/repository/config/identity.rs diff --git a/gix/tests/repository/config/mod.rs b/gix/tests/gix/repository/config/mod.rs similarity index 100% rename from gix/tests/repository/config/mod.rs rename to gix/tests/gix/repository/config/mod.rs diff --git a/gix/tests/repository/config/remote.rs b/gix/tests/gix/repository/config/remote.rs similarity index 100% rename from gix/tests/repository/config/remote.rs rename to gix/tests/gix/repository/config/remote.rs diff --git a/gix/tests/repository/config/transport_options.rs b/gix/tests/gix/repository/config/transport_options.rs similarity index 100% rename from gix/tests/repository/config/transport_options.rs rename to gix/tests/gix/repository/config/transport_options.rs diff --git a/gix/tests/repository/excludes.rs b/gix/tests/gix/repository/excludes.rs similarity index 100% rename from gix/tests/repository/excludes.rs rename to gix/tests/gix/repository/excludes.rs diff --git a/gix/tests/repository/filter.rs b/gix/tests/gix/repository/filter.rs similarity index 100% rename from gix/tests/repository/filter.rs rename to gix/tests/gix/repository/filter.rs diff --git a/gix/tests/repository/mod.rs b/gix/tests/gix/repository/mod.rs similarity index 100% rename from gix/tests/repository/mod.rs rename to gix/tests/gix/repository/mod.rs diff --git a/gix/tests/repository/object.rs b/gix/tests/gix/repository/object.rs similarity index 100% rename from gix/tests/repository/object.rs rename to gix/tests/gix/repository/object.rs diff --git a/gix/tests/repository/open.rs b/gix/tests/gix/repository/open.rs similarity index 100% rename from gix/tests/repository/open.rs rename to gix/tests/gix/repository/open.rs diff --git a/gix/tests/repository/pathspec.rs b/gix/tests/gix/repository/pathspec.rs similarity index 100% rename from gix/tests/repository/pathspec.rs rename to gix/tests/gix/repository/pathspec.rs diff --git a/gix/tests/repository/reference.rs b/gix/tests/gix/repository/reference.rs similarity index 100% rename from gix/tests/repository/reference.rs rename to gix/tests/gix/repository/reference.rs diff --git a/gix/tests/repository/remote.rs b/gix/tests/gix/repository/remote.rs similarity index 100% rename from gix/tests/repository/remote.rs rename to gix/tests/gix/repository/remote.rs diff --git a/gix/tests/repository/shallow.rs b/gix/tests/gix/repository/shallow.rs similarity index 100% rename from gix/tests/repository/shallow.rs rename to gix/tests/gix/repository/shallow.rs diff --git a/gix/tests/repository/state.rs b/gix/tests/gix/repository/state.rs similarity index 100% rename from gix/tests/repository/state.rs rename to gix/tests/gix/repository/state.rs diff --git a/gix/tests/repository/submodule.rs b/gix/tests/gix/repository/submodule.rs similarity index 100% rename from gix/tests/repository/submodule.rs rename to gix/tests/gix/repository/submodule.rs diff --git a/gix/tests/repository/worktree.rs b/gix/tests/gix/repository/worktree.rs similarity index 100% rename from gix/tests/repository/worktree.rs rename to gix/tests/gix/repository/worktree.rs diff --git a/gix/tests/revision/mod.rs b/gix/tests/gix/revision/mod.rs similarity index 100% rename from gix/tests/revision/mod.rs rename to gix/tests/gix/revision/mod.rs diff --git a/gix/tests/revision/spec/from_bytes/ambiguous.rs b/gix/tests/gix/revision/spec/from_bytes/ambiguous.rs similarity index 100% rename from gix/tests/revision/spec/from_bytes/ambiguous.rs rename to gix/tests/gix/revision/spec/from_bytes/ambiguous.rs diff --git a/gix/tests/revision/spec/from_bytes/mod.rs b/gix/tests/gix/revision/spec/from_bytes/mod.rs similarity index 100% rename from gix/tests/revision/spec/from_bytes/mod.rs rename to gix/tests/gix/revision/spec/from_bytes/mod.rs diff --git a/gix/tests/revision/spec/from_bytes/peel.rs b/gix/tests/gix/revision/spec/from_bytes/peel.rs similarity index 100% rename from gix/tests/revision/spec/from_bytes/peel.rs rename to gix/tests/gix/revision/spec/from_bytes/peel.rs diff --git a/gix/tests/revision/spec/from_bytes/reflog.rs b/gix/tests/gix/revision/spec/from_bytes/reflog.rs similarity index 100% rename from gix/tests/revision/spec/from_bytes/reflog.rs rename to gix/tests/gix/revision/spec/from_bytes/reflog.rs diff --git a/gix/tests/revision/spec/from_bytes/regex.rs b/gix/tests/gix/revision/spec/from_bytes/regex.rs similarity index 100% rename from gix/tests/revision/spec/from_bytes/regex.rs rename to gix/tests/gix/revision/spec/from_bytes/regex.rs diff --git a/gix/tests/revision/spec/from_bytes/traverse.rs b/gix/tests/gix/revision/spec/from_bytes/traverse.rs similarity index 100% rename from gix/tests/revision/spec/from_bytes/traverse.rs rename to gix/tests/gix/revision/spec/from_bytes/traverse.rs diff --git a/gix/tests/revision/spec/from_bytes/util.rs b/gix/tests/gix/revision/spec/from_bytes/util.rs similarity index 100% rename from gix/tests/revision/spec/from_bytes/util.rs rename to gix/tests/gix/revision/spec/from_bytes/util.rs diff --git a/gix/tests/revision/spec/mod.rs b/gix/tests/gix/revision/spec/mod.rs similarity index 100% rename from gix/tests/revision/spec/mod.rs rename to gix/tests/gix/revision/spec/mod.rs diff --git a/gix/tests/status/mod.rs b/gix/tests/gix/status/mod.rs similarity index 100% rename from gix/tests/status/mod.rs rename to gix/tests/gix/status/mod.rs diff --git a/gix/tests/submodule/mod.rs b/gix/tests/gix/submodule/mod.rs similarity index 100% rename from gix/tests/submodule/mod.rs rename to gix/tests/gix/submodule/mod.rs diff --git a/gix/tests/util/mod.rs b/gix/tests/gix/util/mod.rs similarity index 100% rename from gix/tests/util/mod.rs rename to gix/tests/gix/util/mod.rs