History

more cleanup of test crates

Sebastian Thiel committed 3 years ago

Commit 73c685a1 parent e0c64fd18 files · +29 −55Browse files

Unified · Split

18 files
  1. Cargo.lock +4 −8
  2. gix-config/tests/Cargo.toml +1 −16
  3. gix-config/tests/file/init/from_env.rs +1 −1
  4. gix-config/tests/file/init/from_paths/includes/conditional/gitdir/util.rs +2 −2
  5. gix-config/tests/file/init/from_paths/includes/conditional/mod.rs +1 −1
  6. gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs +6 −3
  7. gix-config/tests/file/init/from_paths/includes/unconditional.rs +1 −1
  8. gix-config/tests/file/init/from_paths/mod.rs +3 −3
  9. gix-diff/tests/Cargo.toml +2 −6
  10. gix-index/tests/Cargo.toml +0 −3
  11. gix-pack/tests/Cargo.toml +1 −3
  12. gix-pack/tests/pack/bundle.rs +1 −1
  13. gix-pack/tests/pack/data/output/count_and_entries.rs +1 −1
  14. gix-pack/tests/pack/multi_index/write.rs +1 −1
  15. gix-status/tests/Cargo.toml +1 −1
  16. gix-traverse/tests/Cargo.toml +1 −2
  17. gix-worktree-state/tests/Cargo.toml +1 −1
  18. gix-worktree/tests/Cargo.toml +1 −1
Cargo.lock+4−8
@@ -1427,16 +1427,13 @@ name = "gix-config-tests" · 1426 unmodified lines
1427version = "0.0.0"1427version = "0.0.0"
1428dependencies = [1428dependencies = [
1429 "bstr",1429 "bstr",
1430 "criterion",
1431 "gix",1430 "gix",
1432 "gix-config",1431 "gix-config",
1433 "gix-path 0.8.4",1432 "gix-path 0.8.4",
1434 "gix-ref 0.34.0",1433 "gix-ref 0.34.0",
1435 "gix-sec 0.8.4",1434 "gix-sec 0.8.4",
1436 "gix-testtools",1435 "gix-testtools",
1437 "serde_derive",
1438 "serial_test",1436 "serial_test",
1439 "tempfile",
1440]1437]
1441 1438
1442[[package]]1439[[package]]
@@ -1946,7 +1943,7 @@ dependencies = [ · 503 unmodified lines
1946 1943
1947[[package]]1944[[package]]
1948name = "gix-pack-tests"1945name = "gix-pack-tests"
1949version = "0.30.1"1946version = "0.0.0"
1950dependencies = [1947dependencies = [
1951 "bstr",1948 "bstr",
1952 "gix-features 0.32.1",1949 "gix-features 0.32.1",
@@ -1958,7 +1955,6 @@ dependencies = [ · 5 unmodified lines
1958 "gix-traverse 0.31.0",1955 "gix-traverse 0.31.0",
1959 "maplit",1956 "maplit",
1960 "memmap2 0.7.1",1957 "memmap2 0.7.1",
1961 "tempfile",
1962]1958]
1963 1959
1964[[package]]1960[[package]]
@@ -2244,7 +2240,7 @@ dependencies = [ · 279 unmodified lines
2244 2240
2245[[package]]2241[[package]]
2246name = "gix-status-tests"2242name = "gix-status-tests"
2247version = "0.1.0"2243version = "0.0.0"
2248dependencies = [2244dependencies = [
2249 "bstr",2245 "bstr",
2250 "filetime",2246 "filetime",
@@ -2523,7 +2519,7 @@ dependencies = [ · 272 unmodified lines
2523 2519
2524[[package]]2520[[package]]
2525name = "gix-worktree-state-tests"2521name = "gix-worktree-state-tests"
2526version = "0.1.0"2522version = "0.0.0"
2527dependencies = [2523dependencies = [
2528 "gix-discover 0.23.0",2524 "gix-discover 0.23.0",
2529 "gix-features 0.32.1",2525 "gix-features 0.32.1",
@@ -2561,7 +2557,7 @@ dependencies = [ · 31 unmodified lines
2561 2557
2562[[package]]2558[[package]]
2563name = "gix-worktree-tests"2559name = "gix-worktree-tests"
2564version = "0.1.0"2560version = "0.0.0"
2565dependencies = [2561dependencies = [
2566 "bstr",2562 "bstr",
2567 "gix-attributes 0.16.0",2563 "gix-attributes 0.16.0",
gix-config/tests/Cargo.toml+1−16
@@ -2,13 +2,10 @@ · 1 unmodified line
2name = "gix-config-tests"2name = "gix-config-tests"
3version = "0.0.0"3version = "0.0.0"
4repository = "https://github.com/Byron/gitoxide"4repository = "https://github.com/Byron/gitoxide"
5description = "A git-config file parser and editor from the gitoxide project"5description = "Tests for the gix-config crate"
6license = "MIT OR Apache-2.0"6license = "MIT OR Apache-2.0"
7authors = ["Edward Shen <code@eddie.sh>"]7authors = ["Edward Shen <code@eddie.sh>"]
8edition = "2021"8edition = "2021"
9keywords = ["git-config", "git", "config", "gitoxide"]
10categories = ["config", "parser-implementations"]
11include = ["src/**/*", "LICENSE-*", "README.md", "CHANGELOG.md"]
12rust-version = "1.65"9rust-version = "1.65"
13publish = false10publish = false
14 11
@@ -17,10 +14,6 @@ publish = false · 2 unmodified lines
17name = "config"14name = "config"
18path = "config.rs"15path = "config.rs"
19 16
20[features]
21## Data structures implement `serde::Serialize` and `serde::Deserialize`.
22serde = ["gix-config/serde"]
23
24[dev-dependencies]17[dev-dependencies]
25gix-config = { path = ".."}18gix-config = { path = ".."}
26gix-testtools = { path = "../../tests/tools"}19gix-testtools = { path = "../../tests/tools"}
@@ -29,12 +22,4 @@ gix-ref = { path = "../../gix-ref" } · 2 unmodified lines
29gix-path = { path = "../../gix-path" }22gix-path = { path = "../../gix-path" }
30gix-sec = { path = "../../gix-sec" }23gix-sec = { path = "../../gix-sec" }
31serial_test = { version = "2.0.0", default-features = false }24serial_test = { version = "2.0.0", default-features = false }
32serde_derive = "1.0"
33criterion = "0.5.1"
34tempfile = "3.2.0"
35bstr = { version = "1.3.0", default-features = false, features = ["std"] }25bstr = { version = "1.3.0", default-features = false, features = ["std"] }
36
37[package.metadata.docs.rs]
38all-features = true
39features = ["document-features"]
40rustdoc-args = ["--cfg", "docsrs"]
gix-config/tests/file/init/from_env.rs+1−1
@@ -4,9 +4,9 @@ use gix_config::{ · 3 unmodified lines
4 file::{includes, init, init::from_env},4 file::{includes, init, init::from_env},
5 File,5 File,
6};6};
7use gix_testtools::tempfile::tempdir;
7use gix_testtools::Env;8use gix_testtools::Env;
8use serial_test::serial;9use serial_test::serial;
9use tempfile::tempdir;
10 10
11use crate::file::init::from_paths::escape_backslashes;11use crate::file::init::from_paths::escape_backslashes;
12 12
gix-config/tests/file/init/from_paths/includes/conditional/gitdir/util.rs+2−2
@@ -19,7 +19,7 @@ use crate::file::{ · 18 unmodified lines
19 19
20#[derive(Debug)]20#[derive(Debug)]
21pub struct GitEnv {21pub struct GitEnv {
22 tempdir: tempfile::TempDir,22 tempdir: gix_testtools::tempfile::TempDir,
23 root_dir: PathBuf,23 root_dir: PathBuf,
24 git_dir: PathBuf,24 git_dir: PathBuf,
25 home_dir: PathBuf,25 home_dir: PathBuf,
@@ -68,7 +68,7 @@ impl Condition { · 42 unmodified lines
68 68
69impl GitEnv {69impl GitEnv {
70 pub fn repo_name(repo_name: impl AsRef<Path>) -> crate::Result<Self> {70 pub fn repo_name(repo_name: impl AsRef<Path>) -> crate::Result<Self> {
71 let tempdir = tempfile::tempdir()?;71 let tempdir = gix_testtools::tempfile::tempdir()?;
72 let root_dir = gix_path::realpath(tempdir.path())?;72 let root_dir = gix_path::realpath(tempdir.path())?;
73 let worktree_dir = root_dir.join(repo_name);73 let worktree_dir = root_dir.join(repo_name);
74 std::fs::create_dir_all(&worktree_dir)?;74 std::fs::create_dir_all(&worktree_dir)?;
gix-config/tests/file/init/from_paths/includes/conditional/mod.rs+1−1
@@ -4,7 +4,7 @@ use gix_config::{ · 3 unmodified lines
4 file::{includes, init},4 file::{includes, init},
5 path, File,5 path, File,
6};6};
7use tempfile::tempdir;7use gix_testtools::tempfile::tempdir;
8 8
9use crate::file::{cow_str, init::from_paths::escape_backslashes};9use crate::file::{cow_str, init::from_paths::escape_backslashes};
10 10
gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs+6−3
@@ -13,7 +13,7 @@ use gix_ref::{ · 12 unmodified lines
13 transaction::{Change, PreviousValue, RefEdit},13 transaction::{Change, PreviousValue, RefEdit},
14 FullName, Target,14 FullName, Target,
15};15};
16use tempfile::tempdir;16use gix_testtools::tempfile::tempdir;
17 17
18use crate::file::{cow_str, init::from_paths::includes::conditional::git_init};18use crate::file::{cow_str, init::from_paths::includes::conditional::git_init};
19 19
@@ -181,7 +181,7 @@ enum Value { · 161 unmodified lines
181#[derive(Debug)]181#[derive(Debug)]
182struct GitEnv {182struct GitEnv {
183 repo: gix::Repository,183 repo: gix::Repository,
184 dir: tempfile::TempDir,184 dir: gix_testtools::tempfile::TempDir,
185}185}
186 186
187impl GitEnv {187impl GitEnv {
@@ -291,7 +291,10 @@ value = branch-override-by-include · 103 unmodified lines
291 Ok(GitEnv { repo, dir })291 Ok(GitEnv { repo, dir })
292}292}
293 293
294fn assure_git_agrees(expected: Value, dir: tempfile::TempDir) -> crate::Result<tempfile::TempDir> {294fn assure_git_agrees(
295 expected: Value,
296 dir: gix_testtools::tempfile::TempDir,
297) -> crate::Result<gix_testtools::tempfile::TempDir> {
295 let git_dir = dir.path();298 let git_dir = dir.path();
296 let output = std::process::Command::new("git")299 let output = std::process::Command::new("git")
297 .args(["config", "--get", "section.value"])300 .args(["config", "--get", "section.value"])
gix-config/tests/file/init/from_paths/includes/unconditional.rs+1−1
@@ -4,7 +4,7 @@ use gix_config::{ · 3 unmodified lines
4 file::{includes, init, init::from_paths},4 file::{includes, init, init::from_paths},
5 File,5 File,
6};6};
7use tempfile::tempdir;7use gix_testtools::tempfile::tempdir;
8 8
9use crate::file::{9use crate::file::{
10 cow_str,10 cow_str,
gix-config/tests/file/init/from_paths/mod.rs+3−3
@@ -1,7 +1,7 @@
1use std::{fs, path::PathBuf};1use std::{fs, path::PathBuf};
2 2
3use gix_config::{File, Source};3use gix_config::{File, Source};
4use tempfile::tempdir;4use gix_testtools::tempfile::tempdir;
5 5
6use crate::file::cow_str;6use crate::file::cow_str;
7 7
@@ -13,7 +13,7 @@ pub(crate) fn escape_backslashes(path: impl AsRef<std::path::Path>) -> String { · 5 unmodified lines
13mod from_path_no_includes {13mod from_path_no_includes {
14 #[test]14 #[test]
15 fn file_not_found() {15 fn file_not_found() {
16 let dir = tempfile::tempdir().unwrap();16 let dir = gix_testtools::tempfile::tempdir().unwrap();
17 let config_path = dir.path().join("config");17 let config_path = dir.path().join("config");
18 18
19 let err = gix_config::File::from_path_no_includes(config_path, gix_config::Source::Local).unwrap_err();19 let err = gix_config::File::from_path_no_includes(config_path, gix_config::Source::Local).unwrap_err();
@@ -24,7 +24,7 @@ mod from_path_no_includes { · 4 unmodified lines
24 24
25 #[test]25 #[test]
26 fn single_path() {26 fn single_path() {
27 let dir = tempfile::tempdir().unwrap();27 let dir = gix_testtools::tempfile::tempdir().unwrap();
28 let config_path = dir.path().join("config");28 let config_path = dir.path().join("config");
29 std::fs::write(config_path.as_path(), b"[core]\nboolean = true").unwrap();29 std::fs::write(config_path.as_path(), b"[core]\nboolean = true").unwrap();
30 30
gix-diff/tests/Cargo.toml+2−6
@@ -4,18 +4,14 @@ version = "0.0.0" · 3 unmodified lines
4publish = false4publish = false
5repository = "https://github.com/Byron/gitoxide"5repository = "https://github.com/Byron/gitoxide"
6license = "MIT OR Apache-2.0"6license = "MIT OR Apache-2.0"
7description = "Please use `gix-<thiscrate>` instead ('git' -> 'gix')"7description = "Tests for the gix-diff crate"
8authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]8authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
9edition = "2021"9edition = "2021"
10include = ["src/**/*"]
11rust-version = "1.65"10rust-version = "1.65"
12 11
13[features]
14serde = ["gix-diff/serde", "gix-hash/serde", "gix-object/serde"]
15
16[[test]]12[[test]]
17name = "diff"
18doctest = false13doctest = false
14name = "diff"
19path = "diff.rs"15path = "diff.rs"
20 16
21[dev-dependencies]17[dev-dependencies]
gix-index/tests/Cargo.toml+0−3
@@ -13,12 +13,9 @@ rust-version = "1.65" · 12 unmodified lines
13name = "integrate"13name = "integrate"
14path = "integrate.rs"14path = "integrate.rs"
15 15
16
17[features]16[features]
18gix-features-parallel = ["gix-features/parallel"]17gix-features-parallel = ["gix-features/parallel"]
19 18
20[dependencies]
21
22[dev-dependencies]19[dev-dependencies]
23gix-index = { path = ".." }20gix-index = { path = ".." }
24gix-features = { path = "../../gix-features", features = ["rustsha1", "progress"] }21gix-features = { path = "../../gix-features", features = ["rustsha1", "progress"] }
gix-pack/tests/Cargo.toml+1−3
@@ -1,12 +1,11 @@
1[package]1[package]
2name = "gix-pack-tests"2name = "gix-pack-tests"
3version = "0.30.1"3version = "0.0.0"
4repository = "https://github.com/Byron/gitoxide"4repository = "https://github.com/Byron/gitoxide"
5authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]5authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
6license = "MIT OR Apache-2.0"6license = "MIT OR Apache-2.0"
7description = "Please use `gix-<thiscrate>` instead ('git' -> 'gix')"7description = "Please use `gix-<thiscrate>` instead ('git' -> 'gix')"
8edition = "2018"8edition = "2018"
9include = ["src/**/*", "CHANGELOG.md"]
10rust-version = "1.65"9rust-version = "1.65"
11 10
12[features]11[features]
@@ -22,7 +21,6 @@ gix-pack = { path = ".." } · 9 unmodified lines
22gix-features = { path = "../../gix-features" }21gix-features = { path = "../../gix-features" }
23gix-testtools = { path = "../../tests/tools"}22gix-testtools = { path = "../../tests/tools"}
24gix-odb = { path = "../../gix-odb" }23gix-odb = { path = "../../gix-odb" }
25tempfile = "3.1.0"
26bstr = { version = "1.3.0", default-features = false, features = ["std"] }24bstr = { version = "1.3.0", default-features = false, features = ["std"] }
27maplit = "1.0.2"25maplit = "1.0.2"
28gix-object = { path = "../../gix-object" }26gix-object = { path = "../../gix-object" }
gix-pack/tests/pack/bundle.rs+1−1
@@ -80,7 +80,7 @@ mod write_to_directory { · 79 unmodified lines
80 80
81 use gix_features::progress;81 use gix_features::progress;
82 use gix_odb::pack;82 use gix_odb::pack;
83 use tempfile::TempDir;83 use gix_testtools::tempfile::TempDir;
84 84
85 use crate::{85 use crate::{
86 fixture_path,86 fixture_path,
gix-pack/tests/pack/data/output/count_and_entries.rs+1−1
@@ -339,7 +339,7 @@ fn write_and_verify( · 338 unmodified lines
339 _expected_pack_hash: gix_hash::ObjectId,339 _expected_pack_hash: gix_hash::ObjectId,
340 _expected_thin_pack_hash: Option<gix_hash::ObjectId>,340 _expected_thin_pack_hash: Option<gix_hash::ObjectId>,
341) -> crate::Result {341) -> crate::Result {
342 let tmp_dir = tempfile::TempDir::new()?;342 let tmp_dir = gix_testtools::tempfile::TempDir::new()?;
343 let pack_file_path = tmp_dir.path().join("new.pack");343 let pack_file_path = tmp_dir.path().join("new.pack");
344 let mut pack_file = std::fs::OpenOptions::new()344 let mut pack_file = std::fs::OpenOptions::new()
345 .write(true)345 .write(true)
gix-pack/tests/pack/multi_index/write.rs+1−1
@@ -7,7 +7,7 @@ use crate::hex_to_id; · 6 unmodified lines
7 7
8#[test]8#[test]
9fn from_paths() -> crate::Result {9fn from_paths() -> crate::Result {
10 let dir = tempfile::TempDir::new()?;10 let dir = gix_testtools::tempfile::TempDir::new()?;
11 let input_indices = std::fs::read_dir(fixture_path_standalone("objects/pack"))?11 let input_indices = std::fs::read_dir(fixture_path_standalone("objects/pack"))?
12 .filter_map(|r| {12 .filter_map(|r| {
13 r.ok()13 r.ok()
gix-status/tests/Cargo.toml+1−1
@@ -1,6 +1,6 @@
1[package]1[package]
2name = "gix-status-tests"2name = "gix-status-tests"
3version = "0.1.0"3version = "0.0.0"
4repository = "https://github.com/Byron/gitoxide"4repository = "https://github.com/Byron/gitoxide"
5license = "MIT OR Apache-2.0"5license = "MIT OR Apache-2.0"
6description = "A crate to drive gix-status tests with different features"6description = "A crate to drive gix-status tests with different features"
gix-traverse/tests/Cargo.toml+1−2
@@ -3,10 +3,9 @@ name = "gix-traverse-tests" · 2 unmodified lines
3version = "0.0.0"3version = "0.0.0"
4repository = "https://github.com/Byron/gitoxide"4repository = "https://github.com/Byron/gitoxide"
5license = "MIT OR Apache-2.0"5license = "MIT OR Apache-2.0"
6description = "Please use `gix-<thiscrate>` instead ('git' -> 'gix')"6description = "Integration tests for the gix-traverse crate"
7authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]7authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
8edition = "2021"8edition = "2021"
9include = ["src/**/*"]
10rust-version = "1.65"9rust-version = "1.65"
11 10
12[[test]]11[[test]]
gix-worktree-state/tests/Cargo.toml+1−1
@@ -1,6 +1,6 @@
1[package]1[package]
2name = "gix-worktree-state-tests"2name = "gix-worktree-state-tests"
3version = "0.1.0"3version = "0.0.0"
4repository = "https://github.com/Byron/gitoxide"4repository = "https://github.com/Byron/gitoxide"
5license = "MIT OR Apache-2.0"5license = "MIT OR Apache-2.0"
6description = "A crate for running tests with feature toggles on gix-worktree-state"6description = "A crate for running tests with feature toggles on gix-worktree-state"
gix-worktree/tests/Cargo.toml+1−1
@@ -1,6 +1,6 @@
1[package]1[package]
2name = "gix-worktree-tests"2name = "gix-worktree-tests"
3version = "0.1.0"3version = "0.0.0"
4repository = "https://github.com/Byron/gitoxide"4repository = "https://github.com/Byron/gitoxide"
5license = "MIT OR Apache-2.0"5license = "MIT OR Apache-2.0"
6description = "A crate for testing the gix-worktree crate with feature toggles"6description = "A crate for testing the gix-worktree crate with feature toggles"