Skip to content

Commit 69ce895

Browse files
ChrisDentontgross35
authored andcommitted
Move testing of primitive types from std
(backport <#3616>) (cherry picked from commit d4da6c8)
1 parent 1c913e7 commit 69ce895

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

libc-test/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,8 @@ harness = true
8787
name = "semver"
8888
path = "test/semver.rs"
8989
harness = false
90+
91+
[[test]]
92+
name = "primitive_types"
93+
path = "test/primitive_types.rs"
94+
harness = true

libc-test/test/primitive_types.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use std::any::TypeId;
2+
3+
macro_rules! ok {
4+
($($t:ident)*) => {$(
5+
assert!(TypeId::of::<libc::$t>() == TypeId::of::<ffi::$t>(),
6+
"{} is wrong", stringify!($t));
7+
)*}
8+
}
9+
10+
#[test]
11+
fn same() {
12+
use std::ffi;
13+
ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong
14+
c_longlong c_ulonglong c_float c_double);
15+
}

0 commit comments

Comments
 (0)