Skip to content

Commit dbf898a

Browse files
committed
Add a test for authority conversion
1 parent e0c2aba commit dbf898a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

linkerd/addr/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,22 @@ mod tests {
257257
assert_eq!(a.is_loopback(), *expected_result, "{:?}", host)
258258
}
259259
}
260+
261+
#[test]
262+
fn test_to_http_authority() {
263+
let cases = &[
264+
"localhost:80",
265+
"localhost.:80",
266+
"LocalhOsT.:80",
267+
"mlocalhost.:80",
268+
"localhost1.:80",
269+
"127.0.0.1:80",
270+
"[::1]:80",
271+
];
272+
for host in cases {
273+
Addr::from_str(host).unwrap().to_http_authority();
274+
}
275+
}
260276
}
261277

262278
#[cfg(fuzzing)]

0 commit comments

Comments
 (0)