Add some sanity asserts

This commit is contained in:
Steven Fackler 2014-02-16 20:35:40 -08:00
parent c119c357fc
commit a42b096902

View File

@ -326,9 +326,10 @@ macro_rules! from_range_impl(
}; };
let len = or_fail!(rdr.read_be_i32()) as uint; let len = or_fail!(rdr.read_be_i32()) as uint;
let mut limit = LimitReader::new(rdr.by_ref(), len); let mut limit = LimitReader::new(rdr.by_ref(), len);
Some(RangeBound::new( let lower = Some(RangeBound::new(
RawFromSql::raw_from_sql(&mut limit), type_)) RawFromSql::raw_from_sql(&mut limit), type_));
// TODO assert limit is used up assert!(limit.limit() == 0);
lower
} }
_ => None _ => None
}; };
@ -340,9 +341,10 @@ macro_rules! from_range_impl(
}; };
let len = or_fail!(rdr.read_be_i32()) as uint; let len = or_fail!(rdr.read_be_i32()) as uint;
let mut limit = LimitReader::new(rdr.by_ref(), len); let mut limit = LimitReader::new(rdr.by_ref(), len);
Some(RangeBound::new( let upper = Some(RangeBound::new(
RawFromSql::raw_from_sql(&mut limit), type_)) RawFromSql::raw_from_sql(&mut limit), type_));
// TODO assert limit is used up assert!(limit.limit() == 0);
upper
} }
_ => None _ => None
}; };
@ -435,7 +437,7 @@ macro_rules! from_array_impl(
} else { } else {
let mut limit = LimitReader::new(rdr.by_ref(), len as uint); let mut limit = LimitReader::new(rdr.by_ref(), len as uint);
elements.push(Some(RawFromSql::raw_from_sql(&mut limit))); elements.push(Some(RawFromSql::raw_from_sql(&mut limit)));
// TODO assert the reader's at the end assert!(limit.limit() == 0);
} }
} }