tests: add test for invalid config (#55)

This commit is contained in:
Martin von Zweigbergk 2022-03-27 12:49:04 -07:00 committed by Martin von Zweigbergk
parent d68eee296e
commit 2ac62203d5

View file

@ -105,3 +105,21 @@ color="always""#,
o 0000000000000000000000000000000000000000
"###);
}
#[test]
fn test_invalid_config() {
// Test that we get a reasonable error if the config is invalid (#55)
let test_env = TestEnvironment::default();
std::fs::write(
test_env.config_path(),
"[section]key = value-missing-quotes",
)
.unwrap();
let assert = test_env
.jj_cmd(test_env.env_root(), &["init", "repo"])
.assert()
.failure();
insta::assert_snapshot!(get_stdout_string(&assert), @"Invalid config: expected newline, found an identifier at line 1 column 10 in config.toml
");
}