From f34aae5ab7e567def5186574cfa06a9735cc26d1 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Tue, 19 Sep 2023 05:49:42 -0700 Subject: [PATCH] test: use test backend in most remaining tests too I don't think the backend should matter for any of these tests, so let's test with only one, and let's make that the strictest one - the new test backend. This reduces the number of tests by 74 (from 974 to 900), but saves no measurable run time. --- .../test_default_revset_graph_iterator.rs | 14 +- lib/tests/test_diff_summary.rs | 38 ++- lib/tests/test_index.rs | 77 +++--- lib/tests/test_load_repo.rs | 26 +- lib/tests/test_merge_trees.rs | 59 ++--- lib/tests/test_revset.rs | 226 ++++++++---------- lib/tests/test_rewrite.rs | 150 +++++------- lib/tests/test_workspace.rs | 21 +- lib/testutils/src/lib.rs | 2 +- 9 files changed, 273 insertions(+), 340 deletions(-) diff --git a/lib/tests/test_default_revset_graph_iterator.rs b/lib/tests/test_default_revset_graph_iterator.rs index bc8d346b0e..1b4422474a 100644 --- a/lib/tests/test_default_revset_graph_iterator.rs +++ b/lib/tests/test_default_revset_graph_iterator.rs @@ -20,7 +20,7 @@ use jj_lib::repo::{ReadonlyRepo, Repo as _}; use jj_lib::revset::ResolvedExpression; use jj_lib::revset_graph::RevsetGraphEdge; use test_case::test_case; -use testutils::{CommitGraphBuilder, TestRepo, TestRepoBackend}; +use testutils::{CommitGraphBuilder, TestRepo}; fn revset_for_commits<'index>( repo: &'index ReadonlyRepo, @@ -53,7 +53,7 @@ fn missing(commit: &Commit) -> RevsetGraphEdge { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_linearized(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Tests that a fork and a merge becomes a single edge: @@ -89,7 +89,7 @@ fn test_graph_iterator_linearized(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_virtual_octopus(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Tests that merges outside the set can result in more parent edges than there @@ -140,7 +140,7 @@ fn test_graph_iterator_virtual_octopus(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_simple_fork(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Tests that the branch with "C" gets emitted correctly: @@ -182,7 +182,7 @@ fn test_graph_iterator_simple_fork(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_multiple_missing(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Tests that we get missing edges to "a" and "c" and not just one missing edge @@ -224,7 +224,7 @@ fn test_graph_iterator_multiple_missing(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_edge_to_ancestor(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Tests that we get both an edge from F to D and to D's ancestor C if we keep @@ -271,7 +271,7 @@ fn test_graph_iterator_edge_to_ancestor(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_edge_escapes_from_(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Tests a more complex case for skipping transitive edges. diff --git a/lib/tests/test_diff_summary.rs b/lib/tests/test_diff_summary.rs index 42fb24a70a..1fe2636000 100644 --- a/lib/tests/test_diff_summary.rs +++ b/lib/tests/test_diff_summary.rs @@ -15,13 +15,11 @@ use jj_lib::matchers::{EverythingMatcher, FilesMatcher}; use jj_lib::merged_tree::DiffSummary; use jj_lib::repo_path::RepoPath; -use test_case::test_case; -use testutils::{create_tree, TestRepo, TestRepoBackend}; +use testutils::{create_tree, TestRepo}; -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_types(backend: TestRepoBackend) { - let test_repo = TestRepo::init_with_backend(backend); +#[test] +fn test_types() { + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let clean_path = RepoPath::from_internal_string("clean"); @@ -57,10 +55,9 @@ fn test_types(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_tree_file_transition(backend: TestRepoBackend) { - let test_repo = TestRepo::init_with_backend(backend); +#[test] +fn test_tree_file_transition() { + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let dir_file_path = RepoPath::from_internal_string("dir/file"); @@ -87,10 +84,9 @@ fn test_tree_file_transition(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_sorting(backend: TestRepoBackend) { - let test_repo = TestRepo::init_with_backend(backend); +#[test] +fn test_sorting() { + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let a_path = RepoPath::from_internal_string("a"); @@ -152,10 +148,9 @@ fn test_sorting(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_matcher_dir_file_transition(backend: TestRepoBackend) { - let test_repo = TestRepo::init_with_backend(backend); +#[test] +fn test_matcher_dir_file_transition() { + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let a_path = RepoPath::from_internal_string("a"); @@ -219,10 +214,9 @@ fn test_matcher_dir_file_transition(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_matcher_normal_cases(backend: TestRepoBackend) { - let test_repo = TestRepo::init_with_backend(backend); +#[test] +fn test_matcher_normal_cases() { + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let a_path = RepoPath::from_internal_string("a"); diff --git a/lib/tests/test_index.rs b/lib/tests/test_index.rs index 435fccab85..c23ef8e8a3 100644 --- a/lib/tests/test_index.rs +++ b/lib/tests/test_index.rs @@ -23,10 +23,8 @@ use jj_lib::default_index_store::{ use jj_lib::index::Index as _; use jj_lib::repo::{MutableRepo, ReadonlyRepo, Repo}; use jj_lib::settings::UserSettings; -use test_case::test_case; use testutils::{ create_random_commit, load_repo_at_head, write_random_commit, CommitGraphBuilder, TestRepo, - TestRepoBackend, }; fn child_commit<'repo>( @@ -49,10 +47,9 @@ fn to_positions_vec(index: CompositeIndex<'_>, commit_ids: &[CommitId]) -> Vec) -> Vec { .collect() } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_index_commits_incremental_squashed(backend: TestRepoBackend) { +#[test] +fn test_index_commits_incremental_squashed() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 1); assert_eq!(commits_by_level(&repo), vec![2]); let repo = create_n_commits(&settings, &repo, 1); assert_eq!(commits_by_level(&repo), vec![3]); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 2); assert_eq!(commits_by_level(&repo), vec![3]); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 100); assert_eq!(commits_by_level(&repo), vec![101]); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 1); let repo = create_n_commits(&settings, &repo, 2); @@ -515,7 +505,7 @@ fn test_index_commits_incremental_squashed(backend: TestRepoBackend) { let repo = create_n_commits(&settings, &repo, 32); assert_eq!(commits_by_level(&repo), vec![64]); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 32); let repo = create_n_commits(&settings, &repo, 16); @@ -524,7 +514,7 @@ fn test_index_commits_incremental_squashed(backend: TestRepoBackend) { let repo = create_n_commits(&settings, &repo, 2); assert_eq!(commits_by_level(&repo), vec![57, 6]); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 30); let repo = create_n_commits(&settings, &repo, 15); @@ -533,7 +523,7 @@ fn test_index_commits_incremental_squashed(backend: TestRepoBackend) { let repo = create_n_commits(&settings, &repo, 1); assert_eq!(commits_by_level(&repo), vec![31, 15, 7, 3, 1]); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 10); let repo = create_n_commits(&settings, &repo, 10); @@ -549,11 +539,10 @@ fn test_index_commits_incremental_squashed(backend: TestRepoBackend) { /// Test that .jj/repo/index/type is created when the repo is created, and that /// it is created when an old repo is loaded. -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_index_store_type(backend: TestRepoBackend) { +#[test] +fn test_index_store_type() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; assert_eq!(as_readonly_composite(repo).num_commits(), 1); diff --git a/lib/tests/test_load_repo.rs b/lib/tests/test_load_repo.rs index 65e77a5f57..241145dde1 100644 --- a/lib/tests/test_load_repo.rs +++ b/lib/tests/test_load_repo.rs @@ -12,15 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use jj_lib::repo::{RepoLoader, StoreFactories}; -use test_case::test_case; -use testutils::{write_random_commit, TestRepo, TestRepoBackend}; +use jj_lib::repo::RepoLoader; +use testutils::{write_random_commit, TestRepo}; -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_load_at_operation(backend: TestRepoBackend) { +#[test] +fn test_load_at_operation() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "add commit"); @@ -33,13 +31,23 @@ fn test_load_at_operation(backend: TestRepoBackend) { // If we load the repo at head, we should not see the commit since it was // removed - let loader = RepoLoader::init(&settings, repo.repo_path(), &StoreFactories::default()).unwrap(); + let loader = RepoLoader::init( + &settings, + repo.repo_path(), + &TestRepo::default_store_factories(), + ) + .unwrap(); let head_repo = loader.load_at_head(&settings).unwrap(); assert!(!head_repo.view().heads().contains(commit.id())); // If we load the repo at the previous operation, we should see the commit since // it has not been removed yet - let loader = RepoLoader::init(&settings, repo.repo_path(), &StoreFactories::default()).unwrap(); + let loader = RepoLoader::init( + &settings, + repo.repo_path(), + &TestRepo::default_store_factories(), + ) + .unwrap(); let old_repo = loader.load_at(repo.operation()).unwrap(); assert!(old_repo.view().heads().contains(commit.id())); } diff --git a/lib/tests/test_merge_trees.rs b/lib/tests/test_merge_trees.rs index 0f1f63894f..69e707d9a7 100644 --- a/lib/tests/test_merge_trees.rs +++ b/lib/tests/test_merge_trees.rs @@ -18,16 +18,14 @@ use jj_lib::repo::Repo; use jj_lib::repo_path::{RepoPath, RepoPathComponent}; use jj_lib::rewrite::rebase_commit; use jj_lib::tree::{merge_trees, Tree}; -use test_case::test_case; -use testutils::{create_single_tree, create_tree, TestRepo, TestRepoBackend}; +use testutils::{create_single_tree, create_tree, TestRepo}; -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_same_type(backend: TestRepoBackend) { +#[test] +fn test_same_type() { // Tests all possible cases where the entry type is unchanged, specifically // using only normal files in all trees (no symlinks, no trees, etc.). - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let store = repo.store(); @@ -187,10 +185,9 @@ fn test_same_type(backend: TestRepoBackend) { }; } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_executable(backend: TestRepoBackend) { - let test_repo = TestRepo::init_with_backend(backend); +#[test] +fn test_executable() { + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let store = repo.store(); @@ -239,12 +236,11 @@ fn test_executable(backend: TestRepoBackend) { assert_eq!(merged_tree.value(&RepoPathComponent::from("xxx")), exec); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_subtrees(backend: TestRepoBackend) { +#[test] +fn test_subtrees() { // Tests that subtrees are merged. - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let store = repo.store(); @@ -294,12 +290,11 @@ fn test_subtrees(backend: TestRepoBackend) { assert_eq!(entries, expected_entries); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_subtree_becomes_empty(backend: TestRepoBackend) { +#[test] +fn test_subtree_becomes_empty() { // Tests that subtrees that become empty are removed from the parent tree. - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let store = repo.store(); @@ -324,12 +319,11 @@ fn test_subtree_becomes_empty(backend: TestRepoBackend) { assert_eq!(merged_tree.id(), store.empty_tree_id()); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_subtree_one_missing(backend: TestRepoBackend) { +#[test] +fn test_subtree_one_missing() { // Tests that merging trees where one side is missing is resolved as if the // missing side was empty. - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let store = repo.store(); @@ -367,13 +361,12 @@ fn test_subtree_one_missing(backend: TestRepoBackend) { assert_eq!(reverse_merged_tree.id(), merged_tree.id()); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_types(backend: TestRepoBackend) { +#[test] +fn test_types() { // Tests conflicts between different types. This is mostly to test that the // conflicts survive the roundtrip to the store. - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let store = repo.store(); @@ -466,10 +459,9 @@ fn test_types(backend: TestRepoBackend) { }; } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_simplify_conflict(backend: TestRepoBackend) { - let test_repo = TestRepo::init_with_backend(backend); +#[test] +fn test_simplify_conflict() { + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let store = repo.store(); @@ -549,11 +541,10 @@ fn test_simplify_conflict(backend: TestRepoBackend) { }; } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_simplify_conflict_after_resolving_parent(backend: TestRepoBackend) { +#[test] +fn test_simplify_conflict_after_resolving_parent() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Set up a repo like this: diff --git a/lib/tests/test_revset.rs b/lib/tests/test_revset.rs index b6434e486b..8e5bcf64b3 100644 --- a/lib/tests/test_revset.rs +++ b/lib/tests/test_revset.rs @@ -72,7 +72,7 @@ fn revset_for_commits<'index>( #[test] fn test_resolve_symbol_empty_string() { - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; assert_matches!( @@ -332,11 +332,10 @@ fn test_resolve_symbol_change_id(readonly: bool) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_resolve_working_copy(backend: TestRepoBackend) { +#[test] +fn test_resolve_working_copy() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -380,7 +379,7 @@ fn test_resolve_working_copy(backend: TestRepoBackend) { #[test] fn test_resolve_symbol_branches() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -592,7 +591,7 @@ fn test_resolve_symbol_branches() { #[test] fn test_resolve_symbol_tags() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -640,7 +639,7 @@ fn test_resolve_symbol_tags() { #[test] fn test_resolve_symbol_git_head() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -684,7 +683,7 @@ fn test_resolve_symbol_git_head() { #[test] fn test_resolve_symbol_git_refs() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -816,11 +815,10 @@ fn resolve_commit_ids_in_workspace( expression.evaluate(repo).unwrap().iter().collect() } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_root_and_checkout(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_root_and_checkout() { let settings = testutils::user_settings(); - let test_workspace = TestWorkspace::init_with_backend(&settings, backend); + let test_workspace = TestWorkspace::init(&settings); let repo = &test_workspace.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -845,11 +843,10 @@ fn test_evaluate_expression_root_and_checkout(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_heads(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_heads() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -911,11 +908,10 @@ fn test_evaluate_expression_heads(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_roots(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_roots() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -967,11 +963,10 @@ fn test_evaluate_expression_roots(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_parents(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_parents() { let settings = testutils::user_settings(); - let test_workspace = TestWorkspace::init_with_backend(&settings, backend); + let test_workspace = TestWorkspace::init(&settings); let repo = &test_workspace.repo; let root_commit = repo.store().root_commit(); @@ -1050,11 +1045,10 @@ fn test_evaluate_expression_parents(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_children(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_children() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -1137,11 +1131,10 @@ fn test_evaluate_expression_children(backend: TestRepoBackend) { assert_eq!(resolve_commit_ids(mut_repo, "none()+"), vec![]); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_ancestors(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_ancestors() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -1225,11 +1218,10 @@ fn test_evaluate_expression_ancestors(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_range(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_range() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -1307,11 +1299,10 @@ fn test_evaluate_expression_range(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_dag_range(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_dag_range() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let root_commit_id = repo.store().root_commit_id().clone(); @@ -1418,11 +1409,10 @@ fn test_evaluate_expression_dag_range(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_connected(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_connected() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let root_commit_id = repo.store().root_commit_id().clone(); @@ -1495,11 +1485,10 @@ fn test_evaluate_expression_connected(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_descendants(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_descendants() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -1597,21 +1586,19 @@ fn test_evaluate_expression_descendants(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_none(backend: TestRepoBackend) { - let test_repo = TestRepo::init_with_backend(backend); +#[test] +fn test_evaluate_expression_none() { + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // none() is empty (doesn't include the checkout, for example) assert_eq!(resolve_commit_ids(repo.as_ref(), "none()"), vec![]); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_all(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_all() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -1635,11 +1622,10 @@ fn test_evaluate_expression_all(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_visible_heads(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_visible_heads() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -1655,11 +1641,10 @@ fn test_evaluate_expression_visible_heads(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_git_refs(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_git_refs() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -1715,11 +1700,10 @@ fn test_evaluate_expression_git_refs(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_git_head(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_git_head() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -1736,11 +1720,10 @@ fn test_evaluate_expression_git_head(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_branches(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_branches() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -1812,11 +1795,10 @@ fn test_evaluate_expression_branches(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_remote_branches(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_remote_branches() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -1941,11 +1923,10 @@ fn test_evaluate_expression_remote_branches(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_latest(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_latest() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2025,11 +2006,10 @@ fn test_evaluate_expression_latest(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_merges(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_merges() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2053,11 +2033,10 @@ fn test_evaluate_expression_merges(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_description(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_description() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2099,11 +2078,10 @@ fn test_evaluate_expression_description(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_author(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_author() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2173,11 +2151,10 @@ fn test_evaluate_expression_author(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_mine(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_mine() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2242,11 +2219,10 @@ fn test_evaluate_expression_mine(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_committer(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_committer() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2308,11 +2284,10 @@ fn test_evaluate_expression_committer(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_union(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_union() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -2381,11 +2356,10 @@ fn test_evaluate_expression_union(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_intersection(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_intersection() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -2421,11 +2395,10 @@ fn test_evaluate_expression_intersection(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_difference(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_difference() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -2508,11 +2481,10 @@ fn test_evaluate_expression_difference(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_filter_combinator(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_filter_combinator() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2572,11 +2544,10 @@ fn test_evaluate_expression_filter_combinator(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_file(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_file() { let settings = testutils::user_settings(); - let test_workspace = TestWorkspace::init_with_backend(&settings, backend); + let test_workspace = TestWorkspace::init(&settings); let repo = &test_workspace.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2683,11 +2654,10 @@ fn test_evaluate_expression_file(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_evaluate_expression_conflict(backend: TestRepoBackend) { +#[test] +fn test_evaluate_expression_conflict() { let settings = testutils::user_settings(); - let test_workspace = TestWorkspace::init_with_backend(&settings, backend); + let test_workspace = TestWorkspace::init(&settings); let repo = &test_workspace.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2722,7 +2692,7 @@ fn test_evaluate_expression_conflict(backend: TestRepoBackend) { #[test] fn test_reverse_graph_iterator() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Tests that merges, forks, direct edges, indirect edges, and "missing" edges @@ -2787,7 +2757,7 @@ fn test_reverse_graph_iterator() { #[test] fn test_change_id_index() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); @@ -2893,7 +2863,7 @@ fn test_change_id_index() { #[test] fn test_no_such_revision_suggestion() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; let mut tx = repo.start_transaction(&settings, "test"); diff --git a/lib/tests/test_rewrite.rs b/lib/tests/test_rewrite.rs index 8cc612cd76..50147094a1 100644 --- a/lib/tests/test_rewrite.rs +++ b/lib/tests/test_rewrite.rs @@ -18,17 +18,15 @@ use jj_lib::repo::Repo; use jj_lib::repo_path::RepoPath; use jj_lib::rewrite::DescendantRebaser; use maplit::{hashmap, hashset}; -use test_case::test_case; use testutils::{ assert_rebased, create_random_commit, create_tree, write_random_commit, CommitGraphBuilder, - TestRepo, TestRepoBackend, + TestRepo, }; -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_sideways(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_sideways() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit F. Commits C-E should be rebased. @@ -72,11 +70,10 @@ fn test_rebase_descendants_sideways(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_forward(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_forward() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit F. Commits C and E should be rebased onto F. @@ -132,11 +129,10 @@ fn test_rebase_descendants_forward(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_reorder(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_reorder() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit E was replaced by commit D, and commit C was replaced by commit F @@ -184,11 +180,10 @@ fn test_rebase_descendants_reorder(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_backward(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_backward() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit C was replaced by commit B. Commit D should be rebased. @@ -222,11 +217,10 @@ fn test_rebase_descendants_backward(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_chain_becomes_branchy(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_chain_becomes_branchy() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit E and commit C was replaced by commit F. @@ -270,11 +264,10 @@ fn test_rebase_descendants_chain_becomes_branchy(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_internal_merge(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_internal_merge() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit F. Commits C-E should be rebased. @@ -320,11 +313,10 @@ fn test_rebase_descendants_internal_merge(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_external_merge(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_external_merge() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit C was replaced by commit F. Commits E should be rebased. The rebased @@ -369,11 +361,10 @@ fn test_rebase_descendants_external_merge(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_abandon(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_abandon() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B and commit E were abandoned. Commit C and commit D should get @@ -415,11 +406,10 @@ fn test_rebase_descendants_abandon(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_abandon_no_descendants(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_abandon_no_descendants() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B and C were abandoned. Commit A should become a head. @@ -450,11 +440,10 @@ fn test_rebase_descendants_abandon_no_descendants(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_abandon_and_replace(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_abandon_and_replace() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit E. Commit C was abandoned. Commit D should @@ -489,11 +478,10 @@ fn test_rebase_descendants_abandon_and_replace(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_abandon_degenerate_merge(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_abandon_degenerate_merge() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was abandoned. Commit D should get rebased to have only C as parent @@ -527,11 +515,10 @@ fn test_rebase_descendants_abandon_degenerate_merge(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_abandon_widen_merge(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_abandon_widen_merge() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit E was abandoned. Commit F should get rebased to have B, C, and D as @@ -573,11 +560,10 @@ fn test_rebase_descendants_abandon_widen_merge(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_multiple_sideways(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_multiple_sideways() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B and commit D were both replaced by commit F. Commit C and commit E @@ -620,11 +606,10 @@ fn test_rebase_descendants_multiple_sideways(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_multiple_swap(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_multiple_swap() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit D. Commit D was replaced by commit B. @@ -665,11 +650,10 @@ fn test_rebase_descendants_multiple_swap(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_multiple_no_descendants(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_multiple_no_descendants() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit C. Commit C was replaced by commit B. @@ -704,11 +688,10 @@ fn test_rebase_descendants_multiple_no_descendants(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_divergent_rewrite(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_divergent_rewrite() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit B2. Commit D was replaced by commits D2 and @@ -772,11 +755,10 @@ fn test_rebase_descendants_divergent_rewrite(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_repeated(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_repeated() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit B2. Commit C should get rebased. Rebasing @@ -840,11 +822,10 @@ fn test_rebase_descendants_repeated(backend: TestRepoBackend) { ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_contents(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_contents() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Commit B was replaced by commit D. Commit C should have the changes from @@ -1312,11 +1293,10 @@ fn test_rebase_descendants_branch_delete_modify_abandon() { assert_eq!(tx.mut_repo().get_local_branch("main"), RefTarget::absent()); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_update_checkout(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_update_checkout() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Checked-out commit B was replaced by commit C. C should become @@ -1362,11 +1342,10 @@ fn test_rebase_descendants_update_checkout(backend: TestRepoBackend) { assert_eq!(repo.view().get_wc_commit_id(&ws3_id), Some(commit_a.id())); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_update_checkout_abandoned(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_update_checkout_abandoned() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Checked-out commit B was abandoned. A child of A @@ -1414,11 +1393,10 @@ fn test_rebase_descendants_update_checkout_abandoned(backend: TestRepoBackend) { assert_eq!(repo.view().get_wc_commit_id(&ws3_id), Some(commit_a.id())); } -#[test_case(TestRepoBackend::Local ; "local backend")] -#[test_case(TestRepoBackend::Git ; "git backend")] -fn test_rebase_descendants_update_checkout_abandoned_merge(backend: TestRepoBackend) { +#[test] +fn test_rebase_descendants_update_checkout_abandoned_merge() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init_with_backend(backend); + let test_repo = TestRepo::init(); let repo = &test_repo.repo; // Checked-out merge commit D was abandoned. A parent commit should become diff --git a/lib/tests/test_workspace.rs b/lib/tests/test_workspace.rs index 5296b621df..a3fd002a4f 100644 --- a/lib/tests/test_workspace.rs +++ b/lib/tests/test_workspace.rs @@ -14,10 +14,9 @@ use assert_matches::assert_matches; use jj_lib::op_store::WorkspaceId; -use jj_lib::repo::{Repo, StoreFactories}; +use jj_lib::repo::Repo; use jj_lib::workspace::{Workspace, WorkspaceLoadError}; -use test_case::test_case; -use testutils::{TestRepoBackend, TestWorkspace}; +use testutils::{TestRepo, TestWorkspace}; #[test] fn test_load_bad_path() { @@ -25,18 +24,21 @@ fn test_load_bad_path() { let temp_dir = testutils::new_temp_dir(); let workspace_root = temp_dir.path().to_owned(); // We haven't created a repo in the workspace_root, so it should fail to load. - let result = Workspace::load(&settings, &workspace_root, &StoreFactories::default()); + let result = Workspace::load( + &settings, + &workspace_root, + &TestRepo::default_store_factories(), + ); assert_matches!( result.err(), Some(WorkspaceLoadError::NoWorkspaceHere(root)) if root == workspace_root ); } -#[test_case(TestRepoBackend::Local ; "local backend")] -// #[test_case(TestRepoBackend::Git ; "git backend")] -fn test_init_additional_workspace(backend: TestRepoBackend) { +#[test] +fn test_init_additional_workspace() { let settings = testutils::user_settings(); - let test_workspace = TestWorkspace::init_with_backend(&settings, backend); + let test_workspace = TestWorkspace::init(&settings); let workspace = &test_workspace.workspace; let ws2_id = WorkspaceId::new("ws2".to_string()); @@ -63,7 +65,8 @@ fn test_init_additional_workspace(backend: TestRepoBackend) { workspace.repo_path().canonicalize().unwrap() ); assert_eq!(*ws2.workspace_root(), ws2_root.canonicalize().unwrap()); - let same_workspace = Workspace::load(&settings, &ws2_root, &StoreFactories::default()); + let same_workspace = + Workspace::load(&settings, &ws2_root, &TestRepo::default_store_factories()); assert!(same_workspace.is_ok()); let same_workspace = same_workspace.unwrap(); assert_eq!(same_workspace.workspace_id(), &ws2_id); diff --git a/lib/testutils/src/lib.rs b/lib/testutils/src/lib.rs index c7b20a2942..ef8a4541a8 100644 --- a/lib/testutils/src/lib.rs +++ b/lib/testutils/src/lib.rs @@ -198,7 +198,7 @@ impl TestWorkspace { } pub fn load_repo_at_head(settings: &UserSettings, repo_path: &Path) -> Arc { - RepoLoader::init(settings, repo_path, &StoreFactories::default()) + RepoLoader::init(settings, repo_path, &TestRepo::default_store_factories()) .unwrap() .load_at_head(settings) .unwrap()