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:
commit
ec8345b18a
18 changed files with 279 additions and 296 deletions
|
@ -2254,7 +2254,6 @@ pub mod test {
|
|||
use core::cmp::Eq;
|
||||
use core::option::None;
|
||||
use parse;
|
||||
use util::testing::check_equal;
|
||||
|
||||
fn string_check<T:Eq> (given : &T, expected: &T) {
|
||||
if !(given == expected) {
|
||||
|
@ -2275,7 +2274,7 @@ pub mod test {
|
|||
cf: ast::return_val
|
||||
};
|
||||
let generics = ast_util::empty_generics();
|
||||
check_equal (&fun_to_str(&decl, abba_ident, None, &generics, mock_interner),
|
||||
assert_eq!(&fun_to_str(&decl, abba_ident, None, &generics, mock_interner),
|
||||
&~"fn abba()");
|
||||
}
|
||||
|
||||
|
@ -2295,7 +2294,7 @@ pub mod test {
|
|||
});
|
||||
|
||||
let varstr = variant_to_str(var,mock_interner);
|
||||
check_equal(&varstr,&~"pub principal_skinner");
|
||||
assert_eq!(&varstr,&~"pub principal_skinner");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue