Skip to content

Commit 70c7492

Browse files
committed
add smoketest for std::net::hostname
1 parent 1676160 commit 70c7492

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

library/std/src/net/test.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,13 @@ pub fn compare_ignore_zoneid(a: &SocketAddr, b: &SocketAddr) -> bool {
3636
_ => a == b,
3737
}
3838
}
39+
40+
#[test]
41+
fn hostname_smoketest() {
42+
// Just a smoke test to ensure it can be called.
43+
let name = crate::net::hostname();
44+
if cfg!(windows) || cfg!(unix) {
45+
// At least on Windows and Unix, this should succeed.
46+
name.unwrap();
47+
}
48+
}

src/tools/tidy/src/pal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn check(library_path: &Path, tidy_ctx: TidyCtx) {
8989
}
9090

9191
// exclude tests and benchmarks as some platforms do not support all tests
92-
if filestr.contains("tests") || filestr.contains("benches") {
92+
if filestr.contains("tests") || filestr.contains("test.rs") || filestr.contains("benches") {
9393
return;
9494
}
9595

0 commit comments

Comments
 (0)