-
-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'adjustments-for-cargo'
- Loading branch information
Showing
6 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ pub use gix_testtools::Result; | |
|
||
mod file; | ||
mod parse; | ||
mod source; | ||
mod value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use gix_config::Source; | ||
use std::path::Path; | ||
|
||
#[test] | ||
fn git_config_no_system() { | ||
assert_eq!( | ||
Source::GitInstallation.storage_location(&mut |name| { | ||
assert_eq!( | ||
name, "GIT_CONFIG_NOSYSTEM", | ||
"it only checks this var, and if set, nothing else" | ||
); | ||
Some("1".into()) | ||
}), | ||
None | ||
); | ||
assert_eq!( | ||
Source::System.storage_location(&mut |name| { | ||
assert_eq!( | ||
name, "GIT_CONFIG_NOSYSTEM", | ||
"it only checks this var, and if set, nothing else" | ||
); | ||
Some("1".into()) | ||
}), | ||
None | ||
); | ||
} | ||
|
||
#[test] | ||
fn git_config_system() { | ||
assert_eq!( | ||
Source::System | ||
.storage_location(&mut |name| { | ||
match name { | ||
"GIT_CONFIG_NOSYSTEM" => None, | ||
"GIT_CONFIG_SYSTEM" => Some("alternative".into()), | ||
unexpected => unreachable!("unexpected env var: {unexpected}"), | ||
} | ||
}) | ||
.expect("set") | ||
.as_ref(), | ||
Path::new("alternative"), | ||
"we respect the system config variable for overrides" | ||
); | ||
} | ||
|
||
#[test] | ||
fn git_config_global() { | ||
for source in [Source::Git, Source::User] { | ||
assert_eq!( | ||
source | ||
.storage_location(&mut |name| { | ||
assert_eq!( | ||
name, "GIT_CONFIG_GLOBAL", | ||
"it only checks this var, and if set, nothing else" | ||
); | ||
Some("alternative".into()) | ||
}) | ||
.expect("set") | ||
.as_ref(), | ||
Path::new("alternative"), | ||
"we respect the global config variable for 'git' overrides" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters