Skip to content

Commit dd28c1e

Browse files
committed
std: expand dlsym! tests
1 parent 0804417 commit dd28c1e

File tree

1 file changed

+12
-1
lines changed
  • library/std/src/sys/pal/unix/weak

1 file changed

+12
-1
lines changed

library/std/src/sys/pal/unix/weak/tests.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,26 @@ use super::*;
22
use crate::ffi::c_int;
33

44
#[test]
5-
fn dlsym() {
5+
fn dlsym_existing() {
66
// Try to find a symbol that definitely exists.
77
dlsym! {
88
fn abs(i: c_int) -> c_int;
99
}
1010

11+
dlsym! {
12+
#[link_name = "abs"]
13+
fn custom_name(i: c_int) -> c_int;
14+
}
15+
1116
let abs = abs.get().unwrap();
1217
assert_eq!(unsafe { abs(-1) }, 1);
1318

19+
let custom_name = custom_name.get().unwrap();
20+
assert_eq!(unsafe { custom_name(-1) }, 1);
21+
}
22+
23+
#[test]
24+
fn dlsym_missing() {
1425
// Try to find a symbol that definitely does not exist.
1526
dlsym! {
1627
fn test_symbol_that_does_not_exist() -> c_int;

0 commit comments

Comments
 (0)