diff --git a/array.rs b/array.rs index d8d431b..ac1f45a 100644 --- a/array.rs +++ b/array.rs @@ -80,7 +80,7 @@ impl Index for CFArray ElemRefType { - fail_unless!(idx < self.len()); + assert!(idx < self.len()); unsafe { let elem = CFArrayGetValueAtIndex(*self.borrow_ref(), idx as CFIndex); // Don't return a wrapped thing, since we don't know whether @@ -136,11 +136,11 @@ fn should_box_and_unbox() { sum += CFWrapper::wrap_shared(*elem).to_i32(); } - fail_unless!(sum == 15); + assert!(sum == 15); for arr.each |elem: &CFNumberRef| { sum += CFWrapper::wrap_shared(*elem).to_i32(); } - fail_unless!(sum == 30); + assert!(sum == 30); } diff --git a/base.rs b/base.rs index 7ea7fef..e832d1a 100644 --- a/base.rs +++ b/base.rs @@ -42,7 +42,7 @@ impl AbstractCFTypeRef for CFTypeRef { pub fn downcast(r: CFTypeRef) -> T { unsafe { - fail_unless!(CFGetTypeID(r) == AbstractCFTypeRef::type_id::()); + assert!(CFGetTypeID(r) == AbstractCFTypeRef::type_id::()); cast::transmute::(r) } } @@ -63,7 +63,7 @@ impl Drop for CFWrapper { // cannot make virtual method calls using trait // types. Instead, just transmute the bugger. let this: &RawCFWrapper = cast::transmute::<&CFWrapper, &RawCFWrapper>(self); - fail_unless!(CFGetRetainCount(this.obj) > 0 as CFIndex); + assert!(CFGetRetainCount(this.obj) > 0 as CFIndex); CFRelease(this.obj) } } @@ -111,7 +111,7 @@ pub impl CFWrapper { fn from_CFType(wrapper: CFType) -> CFWrapper { unsafe { - fail_unless!(wrapper.type_id() == AbstractCFTypeRef::type_id::()); + assert!(wrapper.type_id() == AbstractCFTypeRef::type_id::()); cast::transmute::>(wrapper) } } diff --git a/dictionary.rs b/dictionary.rs index c8bf996..9d11e53 100644 --- a/dictionary.rs +++ b/dictionary.rs @@ -69,7 +69,7 @@ pub impl i8 { let ty = kCFNumberSInt8Type; - fail_unless!(self.has_number_type(ty)); + assert!(self.has_number_type(ty)); unsafe { let val: i8 = 0i8; if !CFNumberGetValue(self.obj, ty, cast::transmute::<&i8, *c_void>(&val)) { @@ -71,7 +71,7 @@ pub impl CFNumber { fn to_i16(&self) -> i16 { let ty = kCFNumberSInt16Type; - fail_unless!(self.has_number_type(ty)); + assert!(self.has_number_type(ty)); unsafe { let val: i16 = 0i16; if !CFNumberGetValue(self.obj, ty, cast::transmute::<&i16, *c_void>(&val)) { @@ -83,7 +83,7 @@ pub impl CFNumber { fn to_i32(&self) -> i32 { let ty = kCFNumberSInt32Type; - fail_unless!(self.has_number_type(ty)); + assert!(self.has_number_type(ty)); unsafe { let val: i32 = 0i32; if !CFNumberGetValue(self.obj, ty, cast::transmute::<&i32, *c_void>(&val)) { @@ -95,7 +95,7 @@ pub impl CFNumber { fn to_float(&self) -> float { unsafe { - fail_unless!(self.has_float_type()); + assert!(self.has_float_type()); let ty = CFNumberGetType(self.obj); if ty == kCFNumberFloat32Type || ty == kCFNumberFloatType { let mut val: libc::c_float = 0.0f as libc::c_float; diff --git a/string.rs b/string.rs index 10f1ed3..3c59e22 100644 --- a/string.rs +++ b/string.rs @@ -283,10 +283,10 @@ impl ToStr for CFString { buffer.len() as CFIndex, ptr::to_unsafe_ptr(&bytes_used)) as uint; - fail_unless!(chars_written == char_len); + assert!(chars_written == char_len); // this is dangerous; we over-allocate and nul-terminate the string (during // initialization) - fail_unless!(bytes_used + 1 == buffer.len() as CFIndex); + assert!(bytes_used + 1 == buffer.len() as CFIndex); // then, reinterpret it as as string. you have been warned! let casted_str : ~str = cast::transmute::<~[u8], ~str>(buffer); // sanity check. @@ -414,5 +414,5 @@ fn string_and_back() { let original = "The quick brown fox jumped over the slow lazy dog."; let cfstr = CFString::new_static(original); let converted = cfstr.to_str(); - fail_unless!(original == converted); + assert!(original == converted); }