Skip to content

Commit a42b096

Browse files
committed
Add some sanity asserts
1 parent c119c35 commit a42b096

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/types/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,10 @@ macro_rules! from_range_impl(
326326
};
327327
let len = or_fail!(rdr.read_be_i32()) as uint;
328328
let mut limit = LimitReader::new(rdr.by_ref(), len);
329-
Some(RangeBound::new(
330-
RawFromSql::raw_from_sql(&mut limit), type_))
331-
// TODO assert limit is used up
329+
let lower = Some(RangeBound::new(
330+
RawFromSql::raw_from_sql(&mut limit), type_));
331+
assert!(limit.limit() == 0);
332+
lower
332333
}
333334
_ => None
334335
};
@@ -340,9 +341,10 @@ macro_rules! from_range_impl(
340341
};
341342
let len = or_fail!(rdr.read_be_i32()) as uint;
342343
let mut limit = LimitReader::new(rdr.by_ref(), len);
343-
Some(RangeBound::new(
344-
RawFromSql::raw_from_sql(&mut limit), type_))
345-
// TODO assert limit is used up
344+
let upper = Some(RangeBound::new(
345+
RawFromSql::raw_from_sql(&mut limit), type_));
346+
assert!(limit.limit() == 0);
347+
upper
346348
}
347349
_ => None
348350
};
@@ -435,7 +437,7 @@ macro_rules! from_array_impl(
435437
} else {
436438
let mut limit = LimitReader::new(rdr.by_ref(), len as uint);
437439
elements.push(Some(RawFromSql::raw_from_sql(&mut limit)));
438-
// TODO assert the reader's at the end
440+
assert!(limit.limit() == 0);
439441
}
440442
}
441443

0 commit comments

Comments
 (0)