auto merge of #5407 : jbclements/rust/add-assert-eq-macro, r=jbclements

Adds an assert_eq! macro that asserts that its two arguments are equal. Error messages can therefore be somewhat more informative than a simple assert, because the error message includes "expected" and "given" values.
This commit is contained in:
bors
2013-03-21 15:24:54 -07:00
18 changed files with 279 additions and 296 deletions

View File

@@ -208,7 +208,8 @@ pub enum ExpnInfo {
pub type FileName = ~str;
pub struct FileLines {
pub struct FileLines
{
file: @FileMap,
lines: ~[uint]
}
@@ -509,17 +510,16 @@ priv impl CodeMap {
#[cfg(test)]
mod test {
use super::*;
use util::testing::check_equal;
#[test]
fn t1 () {
let cm = CodeMap::new();
let fm = cm.new_filemap(~"blork.rs",@~"first line.\nsecond line");
fm.next_line(BytePos(0));
check_equal(&fm.get_line(0),&~"first line.");
assert_eq!(&fm.get_line(0),&~"first line.");
// TESTING BROKEN BEHAVIOR:
fm.next_line(BytePos(10));
check_equal(&fm.get_line(1),&~".");
assert_eq!(&fm.get_line(1),&~".");
}
#[test]