better test formatting

This commit is contained in:
Edward Shen 2021-03-02 11:28:16 -05:00
parent 60fe0deb91
commit 559afb01fa
Signed by: edward
GPG key ID: 19182661E818369F

View file

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