Skip to content

Commit c7492df

Browse files
test for the Repository::config() function (#651)
* test for verifying that the Repository::config() function returns a config object that have the local repo as highest prio * used the test::repo_init() helper method instead
1 parent b5d3b5c commit c7492df

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/repo.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3621,4 +3621,22 @@ mod tests {
36213621
// reverting twice restores `foo` file
36223622
assert!(foo_file.exists());
36233623
}
3624+
3625+
#[test]
3626+
fn smoke_config_write_and_read() {
3627+
let (td, repo) = crate::test::repo_init();
3628+
3629+
let mut config = repo.config().unwrap();
3630+
3631+
config.set_bool("commit.gpgsign", false).unwrap();
3632+
3633+
let c = fs::read_to_string(td.path().join(".git").join("config")).unwrap();
3634+
3635+
assert!(c.contains("[commit]"));
3636+
assert!(c.contains("gpgsign = false"));
3637+
3638+
let config = repo.config().unwrap();
3639+
3640+
assert!(!config.get_bool("commit.gpgsign").unwrap());
3641+
}
36243642
}

0 commit comments

Comments
 (0)