mirror of
https://github.com/nushell/nushell.git
synced 2025-08-17 03:31:52 +02:00
Refactor config updates (#13802)
# Description This PR standardizes updates to the config through a new `UpdateFromValue` trait. For now, this trait is private in case we need to make changes to it. Note that this PR adds some additional `ShellError` cases to create standard error messages for config errors. A follow-up PR will move usages of the old error cases to these new ones. This PR also uses `Type::custom` in lots of places (e.g., for string enums). Not sure if this is something we want to encourage. # User-Facing Changes Should be none.
This commit is contained in:
@ -441,7 +441,7 @@ fn err_hook_wrong_env_type_1() {
|
||||
let actual_repl = nu!(nu_repl_code(inp));
|
||||
dbg!(&actual_repl.err);
|
||||
|
||||
assert!(actual_repl.err.contains("unsupported_config_value"));
|
||||
assert!(actual_repl.err.contains("Type mismatch"));
|
||||
assert_eq!(actual_repl.out, "");
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ fn err_hook_wrong_env_type_2() {
|
||||
|
||||
let actual_repl = nu!(nu_repl_code(inp));
|
||||
|
||||
assert!(actual_repl.err.contains("type_mismatch"));
|
||||
assert!(actual_repl.err.contains("Type mismatch"));
|
||||
assert_eq!(actual_repl.out, "");
|
||||
}
|
||||
|
||||
@ -480,7 +480,7 @@ fn err_hook_wrong_env_type_3() {
|
||||
|
||||
let actual_repl = nu!(nu_repl_code(inp));
|
||||
|
||||
assert!(actual_repl.err.contains("unsupported_config_value"));
|
||||
assert!(actual_repl.err.contains("Type mismatch"));
|
||||
assert_eq!(actual_repl.out, "");
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ fn err_hook_non_boolean_condition_output() {
|
||||
|
||||
let actual_repl = nu!(nu_repl_code(inp));
|
||||
|
||||
assert!(actual_repl.err.contains("unsupported_config_value"));
|
||||
assert!(actual_repl.err.contains("Type mismatch"));
|
||||
assert_eq!(actual_repl.out, "");
|
||||
}
|
||||
|
||||
@ -526,7 +526,7 @@ fn err_hook_non_condition_not_a_block() {
|
||||
|
||||
let actual_repl = nu!(nu_repl_code(inp));
|
||||
|
||||
assert!(actual_repl.err.contains("unsupported_config_value"));
|
||||
assert!(actual_repl.err.contains("Type mismatch"));
|
||||
assert_eq!(actual_repl.out, "");
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ fn err_hook_parse_error() {
|
||||
|
||||
let actual_repl = nu!(nu_repl_code(inp));
|
||||
|
||||
assert!(actual_repl.err.contains("unsupported_config_value"));
|
||||
assert!(actual_repl.err.contains("source code has errors"));
|
||||
assert_eq!(actual_repl.out, "");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user