diff --git a/src/config.rs b/src/config.rs index 04291682..fcd8e634 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1892,4 +1892,24 @@ mod test { config.opt = CommandLineArgs::parse_from(["topgrade", "--remote-host-limit", "other_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::(toml_str) + .expect("toml parse error") + .commands + .expect("commands field missing") + .keys() + .cloned() + .collect(); + + assert_eq!(order, vec!["z", "y", "x"]); + } }