better test formatting

master
Edward Shen 2021-03-02 11:28:16 -05:00
parent 60fe0deb91
commit 559afb01fa
Signed by: edward
GPG Key ID: 19182661E818369F
1 changed files with 43 additions and 37 deletions

View File

@ -1325,55 +1325,61 @@ mod display {
#[test]
fn can_reconstruct_non_empty_config() {
let config = r#"[user]
email = code@eddie.sh
[core]
autocrlf = input
[push]
default = simple
[commit]
gpgsign = true
[gpg]
program = gpg
[url "ssh://git@github.com/"]
insteadOf = "github://"
[url "ssh://git@git.eddie.sh/edward/"]
insteadOf = "gitea://"
[pull]
ff = only
[init]
defaultBranch = master"#;
let config = r#"
[user]
email = code@eddie.sh
[core]
autocrlf = input
[push]
default = simple
[commit]
gpgsign = true
[gpg]
program = gpg
[url "ssh://git@github.com/"]
insteadOf = "github://"
[url "ssh://git@git.eddie.sh/edward/"]
insteadOf = "gitea://"
[pull]
ff = only
[init]
defaultBranch = master
"#;
assert_eq!(GitConfig::try_from(config).unwrap().to_string(), config);
}
#[test]
fn can_reconstruct_configs_with_implicits() {
let config = r#"[user]
email
name
[core]
autocrlf
[push]
default
[commit]
gpgsign"#;
let config = r#"
[user]
email
name
[core]
autocrlf
[push]
default
[commit]
gpgsign
"#;
assert_eq!(GitConfig::try_from(config).unwrap().to_string(), config);
}
#[test]
fn can_reconstruct_configs_without_whitespace_in_middle() {
let config = r#"[core]
autocrlf=input
[push]
default=simple
[commit]
gpgsign=true
[pull]
ff = only
[init]
defaultBranch = master"#;
let config = r#"
[core]
autocrlf=input
[push]
default=simple
[commit]
gpgsign=true
[pull]
ff = only
[init]
defaultBranch = master
"#;
assert_eq!(GitConfig::try_from(config).unwrap().to_string(), config);
}