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#"
email = code@eddie.sh [user]
[core] email = code@eddie.sh
autocrlf = input [core]
[push] autocrlf = input
default = simple [push]
[commit] default = simple
gpgsign = true [commit]
[gpg] gpgsign = true
program = gpg [gpg]
[url "ssh://git@github.com/"] program = gpg
insteadOf = "github://" [url "ssh://git@github.com/"]
[url "ssh://git@git.eddie.sh/edward/"] insteadOf = "github://"
insteadOf = "gitea://" [url "ssh://git@git.eddie.sh/edward/"]
[pull] insteadOf = "gitea://"
ff = only [pull]
[init] ff = only
defaultBranch = master"#; [init]
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#"
email [user]
name email
[core] name
autocrlf [core]
[push] autocrlf
default [push]
[commit] default
gpgsign"#; [commit]
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#"
autocrlf=input [core]
[push] autocrlf=input
default=simple [push]
[commit] default=simple
gpgsign=true [commit]
[pull] gpgsign=true
ff = only [pull]
[init] ff = only
defaultBranch = master"#; [init]
defaultBranch = master
"#;
assert_eq!(GitConfig::try_from(config).unwrap().to_string(), config); assert_eq!(GitConfig::try_from(config).unwrap().to_string(), config);
} }