test(config): add custom commands order test (#1536)
This commit is contained in:
@@ -1892,4 +1892,24 @@ mod test {
|
|||||||
config.opt = CommandLineArgs::parse_from(["topgrade", "--remote-host-limit", "other_hostname"]);
|
config.opt = CommandLineArgs::parse_from(["topgrade", "--remote-host-limit", "other_hostname"]);
|
||||||
assert!(!config.should_execute_remote(Ok("hostname".to_string()), "user@remote_hostname"));
|
assert!(!config.should_execute_remote(Ok("hostname".to_string()), "user@remote_hostname"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Ensure that custom commands are stored in insertion order.
|
||||||
|
#[test]
|
||||||
|
fn test_custom_commands_order() {
|
||||||
|
let toml_str = r#"
|
||||||
|
[commands]
|
||||||
|
z = "cmd_z"
|
||||||
|
y = "cmd_y"
|
||||||
|
x = "cmd_x"
|
||||||
|
"#;
|
||||||
|
let order: Vec<_> = toml::from_str::<ConfigFile>(toml_str)
|
||||||
|
.expect("toml parse error")
|
||||||
|
.commands
|
||||||
|
.expect("commands field missing")
|
||||||
|
.keys()
|
||||||
|
.cloned()
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
assert_eq!(order, vec!["z", "y", "x"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user