72 lines · 1.5 KB · Rust
RawDownload
use std::convert::TryFrom; use git_config::File; #[test]fn can_reconstruct_empty_config() {    let config = r#"     "#;    assert_eq!(File::try_from(config).unwrap().to_string(), config);} #[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    "#;     assert_eq!(File::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    "#;     assert_eq!(File::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    "#;     assert_eq!(File::try_from(config).unwrap().to_string(), config);}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t