Remove personal host aliases from defaults
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled

This commit is contained in:
DuProcess
2026-06-20 17:49:48 -04:00
parent d51cc248e7
commit ec2422bc3e
8 changed files with 51 additions and 46 deletions
+13 -13
View File
@@ -4363,10 +4363,10 @@ mod tests {
#[test]
fn parses_ssh_config_hostname() {
let raw = "user palav\nhostname palav.dev\nport 22\n";
let raw = "user alice\nhostname server.example.com\nport 22\n";
assert_eq!(
parse_ssh_config(raw).hostname,
Some("palav.dev".to_string())
Some("server.example.com".to_string())
);
}
@@ -4389,9 +4389,9 @@ mod tests {
#[test]
fn parses_ssh_config_user_and_identity_files() {
let parsed = parse_ssh_config(
"user palav\nidentityfile ~/.ssh/id_ed25519\nidentityfile ~/.ssh/work\n",
"user alice\nidentityfile ~/.ssh/id_ed25519\nidentityfile ~/.ssh/work\n",
);
assert_eq!(parsed.user, Some("palav".to_string()));
assert_eq!(parsed.user, Some("alice".to_string()));
assert_eq!(
parsed.identity_files,
vec!["~/.ssh/id_ed25519".to_string(), "~/.ssh/work".to_string()]
@@ -4478,37 +4478,37 @@ mod tests {
#[test]
fn detects_existing_imported_host_tables() {
assert!(raw_contains_host_table(
"[palav]\nssh = \"palav\"\n",
"palav"
"[homelab]\nssh = \"homelab\"\n",
"homelab"
));
assert!(raw_contains_host_table("[\"home box\"]\n", "home box"));
assert_eq!(toml_bare_key_or_quoted("palav"), "palav");
assert_eq!(toml_bare_key_or_quoted("homelab"), "homelab");
assert_eq!(toml_bare_key_or_quoted("home box"), "\"home box\"");
}
#[test]
fn strips_user_from_fallback_udp_host() {
assert_eq!(ssh_destination_host("palav@example.com"), "example.com");
assert_eq!(ssh_destination_host("alice@example.com"), "example.com");
}
#[test]
fn parses_user_from_ssh_destination() {
assert_eq!(ssh_username("palav@example.com"), Some("palav".to_string()));
assert_eq!(ssh_username("alice@example.com"), Some("alice".to_string()));
assert_eq!(ssh_username("example.com"), None);
}
#[test]
fn applies_host_config_user_to_plain_ssh_destination() {
assert_eq!(
ssh_with_user("example.com", Some("palav")),
"palav@example.com"
ssh_with_user("example.com", Some("alice")),
"alice@example.com"
);
assert_eq!(
ssh_with_user("root@example.com", Some("palav")),
ssh_with_user("root@example.com", Some("alice")),
"root@example.com"
);
assert_eq!(
ssh_with_user("ssh://example.com", Some("palav")),
ssh_with_user("ssh://example.com", Some("alice")),
"ssh://example.com"
);
}