Add tests for unsafe::reinterpret_cast
This commit is contained in:
parent
9ca2005959
commit
44aebb978c
2 changed files with 14 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ mod task;
|
|||
mod test;
|
||||
mod treemap;
|
||||
mod uint;
|
||||
mod unsafe;
|
||||
mod vec;
|
||||
|
||||
// Local Variables:
|
||||
|
|
|
|||
13
src/test/stdtest/unsafe.rs
Normal file
13
src/test/stdtest/unsafe.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import std::unsafe;
|
||||
|
||||
#[test]
|
||||
fn reinterpret_cast() unsafe {
|
||||
assert unsafe::reinterpret_cast(1) == 1u;
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_fail]
|
||||
#[ignore(cfg(target_os = "win32"))]
|
||||
fn reinterpret_cast_wrong_size() unsafe {
|
||||
let _i: uint = unsafe::reinterpret_cast(0u8);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue