diff options
Diffstat (limited to 'src/libcore/cast.rs')
| -rw-r--r-- | src/libcore/cast.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/cast.rs b/src/libcore/cast.rs index 9cd673e59a7..f17b04da503 100644 --- a/src/libcore/cast.rs +++ b/src/libcore/cast.rs @@ -48,7 +48,7 @@ pub unsafe fn bump_box_refcount<T>(t: @T) { forget(t); } * * # Example * - * assert transmute("L") == ~[76u8, 0u8]; + * fail_unless!(transmute("L") == ~[76u8, 0u8]); */ #[inline(always)] pub unsafe fn transmute<L, G>(thing: L) -> G { @@ -112,7 +112,7 @@ pub mod tests { #[test] pub fn test_reinterpret_cast() { - assert 1u == unsafe { reinterpret_cast(&1) }; + fail_unless!(1u == unsafe { reinterpret_cast(&1) }); } #[test] @@ -123,8 +123,8 @@ pub mod tests { let ptr: *int = transmute(box); // refcount 2 let _box1: @~str = reinterpret_cast(&ptr); let _box2: @~str = reinterpret_cast(&ptr); - assert *_box1 == ~"box box box"; - assert *_box2 == ~"box box box"; + fail_unless!(*_box1 == ~"box box box"); + fail_unless!(*_box2 == ~"box box box"); // Will destroy _box1 and _box2. Without the bump, this would // use-after-free. With too many bumps, it would leak. } @@ -136,7 +136,7 @@ pub mod tests { unsafe { let x = @100u8; let x: *BoxRepr = transmute(x); - assert (*x).data == 100; + fail_unless!((*x).data == 100); let _x: @int = transmute(x); } } @@ -144,7 +144,7 @@ pub mod tests { #[test] pub fn test_transmute2() { unsafe { - assert ~[76u8, 0u8] == transmute(~"L"); + fail_unless!(~[76u8, 0u8] == transmute(~"L")); } } } |
