auto merge of #6111 : pnkfelix/rust/issue4391-rustc-should-not-silently-skip-erroneous-tests, r=pnkfelix

...e.

Fixes #4391.
This commit is contained in:
bors 2013-05-02 00:15:46 -07:00
commit d1f7220219
7 changed files with 16 additions and 9 deletions

View file

@ -833,7 +833,7 @@ pub impl <T:Hash + Eq> HashSet<T> {
}
}
#[test]
#[cfg(test)]
mod test_map {
use container::{Container, Map, Set};
use option::{None, Some};
@ -1009,7 +1009,7 @@ mod test_map {
}
}
#[test]
#[cfg(test)]
mod test_set {
use super::*;
use container::{Container, Map, Set};

View file

@ -673,7 +673,7 @@ pub fn write_repr<T>(writer: @Writer, object: &T) {
}
}
#[test]
#[cfg(test)]
struct P {a: int, b: float}
#[test]

View file

@ -797,7 +797,7 @@ fn test_run_basic() {
po.recv();
}
#[test]
#[cfg(test)]
struct Wrapper {
mut f: Option<Chan<()>>
}

View file

@ -141,7 +141,7 @@ fn fold_item(cx: @mut TestCtxt, i: @ast::item, fld: @fold::ast_fold)
debug!("current path: %s",
ast_util::path_name_i(copy cx.path, cx.sess.parse_sess.interner));
if is_test_fn(i) || is_bench_fn(i) {
if is_test_fn(cx, i) || is_bench_fn(i) {
match i.node {
ast::item_fn(_, purity, _, _, _) if purity == ast::unsafe_fn => {
let sess = cx.sess;
@ -169,7 +169,7 @@ fn fold_item(cx: @mut TestCtxt, i: @ast::item, fld: @fold::ast_fold)
return res;
}
fn is_test_fn(i: @ast::item) -> bool {
fn is_test_fn(cx: @mut TestCtxt, i: @ast::item) -> bool {
let has_test_attr = !attr::find_attrs_by_name(i.attrs,
~"test").is_empty();
@ -188,6 +188,13 @@ fn is_test_fn(i: @ast::item) -> bool {
}
}
if has_test_attr && !has_test_signature(i) {
let sess = cx.sess;
sess.span_err(
i.span,
~"functions used as tests must have signature fn() -> ()."
);
}
return has_test_attr && has_test_signature(i);
}

View file

@ -64,7 +64,7 @@ fn test_fuzzy_eq_eps() {
assert!(!(&1.5f).fuzzy_eq_eps(&0.9, &0.5));
}
#[test]
#[cfg(test)]
mod test_complex{
use cmp::*;

View file

@ -353,7 +353,7 @@ mod tests {
assert!(*deq.get(3) == d);
}
#[test]
#[cfg(test)]
fn test_parameterized<T:Copy + Eq + Durable>(a: T, b: T, c: T, d: T) {
let mut deq = Deque::new();
assert!(deq.len() == 0);

View file

@ -418,7 +418,7 @@ mod test {
new_parser_from_source_str(ps,~[],~"bogofile",source_str)
}
#[test] fn to_json_str<E : Encodable<std::json::Encoder>>(val: @E) -> ~str {
#[cfg(test)] fn to_json_str<E : Encodable<std::json::Encoder>>(val: @E) -> ~str {
do io::with_str_writer |writer| {
val.encode(~std::json::Encoder(writer));
}