Skip to content

Commit fe842e0

Browse files
author
Will Chandler
committed
cargo: Bump config to 0.14.0
Update `config` to the latest minor version. The latest version of `config` adds more detailed error information that require updates to snapshot tests. More significantly, environment config variables are no longer case-sensitive[1]. Internally they are down-cased, so we must adjust `test_command_args` to set lowercase environment variables. In addition, the newly added `config::Value::origin()` method exposes the path of config files. [1] rust-cli/config-rs#354
1 parent dce99cf commit fe842e0

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

Cargo.lock

Lines changed: 21 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ chrono = { version = "0.4.33", default-features = false, features = [
3838
"std",
3939
"clock",
4040
] }
41-
config = { version = "0.13.4", default-features = false, features = ["toml"] }
41+
config = { version = "0.14.0", default-features = false, features = ["toml"] }
4242
criterion = "0.5.1"
4343
crossterm = { version = "0.27", default-features = false }
4444
digest = "0.10.7"

cli/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ mod tests {
584584
command_args,
585585
CommandNameAndArgs::Structured {
586586
env: hashmap! {
587-
"KEY1".to_string() => "value1".to_string(),
588-
"KEY2".to_string() => "value2".to_string(),
587+
"key1".to_string() => "value1".to_string(),
588+
"key2".to_string() => "value2".to_string(),
589589
},
590590
command: NonEmptyCommandArgsVec(["emacs", "-nw",].map(|s| s.to_owned()).to_vec())
591591
}

cli/tests/test_config_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,13 +629,13 @@ fn test_config_get() {
629629

630630
let stdout = test_env.jj_cmd_failure(test_env.env_root(), &["config", "get", "table.list"]);
631631
insta::assert_snapshot!(stdout, @r###"
632-
Config error: invalid type: sequence, expected a value convertible to a string
632+
Config error: invalid type: sequence, expected a value convertible to a string for key `table.list` in config/config0002.toml
633633
For help, see https://github.com/martinvonz/jj/blob/main/docs/config.md.
634634
"###);
635635

636636
let stdout = test_env.jj_cmd_failure(test_env.env_root(), &["config", "get", "table"]);
637637
insta::assert_snapshot!(stdout, @r###"
638-
Config error: invalid type: map, expected a value convertible to a string
638+
Config error: invalid type: map, expected a value convertible to a string for key `table`
639639
For help, see https://github.com/martinvonz/jj/blob/main/docs/config.md.
640640
"###);
641641

cli/tests/test_global_opts.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,13 @@ fn test_invalid_config() {
386386
test_env.add_config("[section]key = value-missing-quotes");
387387
let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["init", "repo"]);
388388
insta::assert_snapshot!(stderr.replace('\\', "/"), @r###"
389-
Config error: expected newline, found an identifier at line 1 column 10 in config/config0002.toml
389+
Config error: TOML parse error at line 1, column 10
390+
|
391+
1 | [section]key = value-missing-quotes
392+
| ^
393+
invalid table header
394+
expected newline, `#`
395+
in config/config0002.toml
390396
For help, see https://github.com/martinvonz/jj/blob/main/docs/config.md.
391397
"###);
392398
}

0 commit comments

Comments
 (0)