Re-xfail two tests that I tried to resurrect (no time right now)

This commit is contained in:
Tim Chevalier 2012-10-11 17:59:33 -07:00
parent 2d116db578
commit 55b528484d
2 changed files with 78 additions and 37 deletions

View File

@ -1,34 +1,35 @@
use intrinsic::{tydesc, get_tydesc, visit_tydesc, ty_visitor};
// xfail-test
use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor};
enum my_visitor = @{ mut types: ~[str] };
impl of ty_visitor for my_visitor {
impl my_visitor: TyVisitor {
fn visit_bot() -> bool {
self.types += ["bot"];
self.types += ~["bot"];
error!("visited bot type");
true
}
fn visit_nil() -> bool {
self.types += ["nil"];
self.types += ~["nil"];
error!("visited nil type");
true
}
fn visit_bool() -> bool {
self.types += ["bool"];
self.types += ~["bool"];
error!("visited bool type");
true
}
fn visit_int() -> bool {
self.types += ["int"];
self.types += ~["int"];
error!("visited int type");
true
}
fn visit_i8() -> bool {
self.types += ["i8"];
self.types += ~["i8"];
error!("visited i8 type");
true
}
fn visit_i16() -> bool {
self.types += ["i16"];
self.types += ~["i16"];
error!("visited i16 type");
true
}
@ -54,41 +55,41 @@ fn visit_estr_slice() -> bool { true }
fn visit_estr_fixed(_sz: uint, _sz: uint,
_align: uint) -> bool { true }
fn visit_box(_mtbl: uint, _inner: *tydesc) -> bool { true }
fn visit_uniq(_mtbl: uint, _inner: *tydesc) -> bool { true }
fn visit_ptr(_mtbl: uint, _inner: *tydesc) -> bool { true }
fn visit_rptr(_mtbl: uint, _inner: *tydesc) -> bool { true }
fn visit_box(_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_uniq(_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_ptr(_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_rptr(_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_vec(_mtbl: uint, inner: *tydesc) -> bool {
self.types += ["["];
visit_tydesc(inner, my_visitor(*self) as ty_visitor);
self.types += ["]"];
fn visit_vec(_mtbl: uint, inner: *TyDesc) -> bool {
self.types += ~["["];
visit_tydesc(inner, my_visitor(*self) as TyVisitor);
self.types += ~["]"];
true
}
fn visit_unboxed_vec(_mtbl: uint, _inner: *tydesc) -> bool { true }
fn visit_evec_box(_mtbl: uint, _inner: *tydesc) -> bool { true }
fn visit_evec_uniq(_mtbl: uint, _inner: *tydesc) -> bool { true }
fn visit_evec_slice(_mtbl: uint, _inner: *tydesc) -> bool { true }
fn visit_unboxed_vec(_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_evec_box(_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_evec_uniq(_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_evec_slice(_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_evec_fixed(_n: uint, _sz: uint, _align: uint,
_mtbl: uint, _inner: *tydesc) -> bool { true }
_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_enter_rec(_n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_rec_field(_i: uint, _name: &str,
_mtbl: uint, _inner: *tydesc) -> bool { true }
_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_leave_rec(_n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_enter_class(_n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_class_field(_i: uint, _name: &str,
_mtbl: uint, _inner: *tydesc) -> bool { true }
_mtbl: uint, _inner: *TyDesc) -> bool { true }
fn visit_leave_class(_n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_enter_tup(_n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_tup_field(_i: uint, _inner: *tydesc) -> bool { true }
fn visit_tup_field(_i: uint, _inner: *TyDesc) -> bool { true }
fn visit_leave_tup(_n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
@ -98,7 +99,7 @@ fn visit_enter_enum_variant(_variant: uint,
_disr_val: int,
_n_fields: uint,
_name: &str) -> bool { true }
fn visit_enum_variant_field(_i: uint, _inner: *tydesc) -> bool { true }
fn visit_enum_variant_field(_i: uint, _inner: *TyDesc) -> bool { true }
fn visit_leave_enum_variant(_variant: uint,
_disr_val: int,
_n_fields: uint,
@ -108,8 +109,8 @@ fn visit_leave_enum(_n_variants: uint,
fn visit_enter_fn(_purity: uint, _proto: uint,
_n_inputs: uint, _retstyle: uint) -> bool { true }
fn visit_fn_input(_i: uint, _mode: uint, _inner: *tydesc) -> bool { true }
fn visit_fn_output(_retstyle: uint, _inner: *tydesc) -> bool { true }
fn visit_fn_input(_i: uint, _mode: uint, _inner: *TyDesc) -> bool { true }
fn visit_fn_output(_retstyle: uint, _inner: *TyDesc) -> bool { true }
fn visit_leave_fn(_purity: uint, _proto: uint,
_n_inputs: uint, _retstyle: uint) -> bool { true }
@ -121,17 +122,17 @@ fn visit_param(_i: uint) -> bool { true }
fn visit_self() -> bool { true }
fn visit_type() -> bool { true }
fn visit_opaque_box() -> bool { true }
fn visit_constr(_inner: *tydesc) -> bool { true }
fn visit_constr(_inner: *TyDesc) -> bool { true }
fn visit_closure_ptr(_ck: uint) -> bool { true }
}
fn visit_ty<T>(v: ty_visitor) {
fn visit_ty<T>(v: TyVisitor) {
visit_tydesc(get_tydesc::<T>(), v);
}
fn main() {
let v = my_visitor(@{mut types: ~[]});
let vv = v as ty_visitor;
let vv = v as TyVisitor;
visit_ty::<bool>(vv);
visit_ty::<int>(vv);

View File

@ -1,20 +1,60 @@
// xfail-test
/**
A test case for issue #577, which also exposes #588
*/
extern mod std;
use task::join;
fn child() { }
struct notify {
ch: comm::Chan<bool>, v: @mut bool,
drop {
error!("notify: task=%? v=%x unwinding=%b b=%b",
task::get_task(),
ptr::addr_of(&(*(self.v))) as uint,
task::failing(),
*(self.v));
let b = *(self.v);
comm::send(self.ch, b);
}
}
fn notify(ch: comm::Chan<bool>, v: @mut bool) -> notify {
notify {
ch: ch,
v: v
}
}
fn joinable(+f: fn~()) -> comm::Port<bool> {
fn wrapper(+c: comm::Chan<bool>, +f: fn()) {
let b = @mut false;
error!("wrapper: task=%? allocated v=%x",
task::get_task(),
ptr::addr_of(&(*b)) as uint);
let _r = notify(c, b);
f();
*b = true;
}
let p = comm::Port();
let c = comm::Chan(&p);
do task::spawn_unlinked { wrapper(c, copy f) };
p
}
fn join(port: comm::Port<bool>) -> bool {
comm::recv(port)
}
fn main() {
// tasks
let t1;
let t2;
let c1 = child, c2 = child;
t1 = task::spawn_joinable(c1);
t2 = task::spawn_joinable(c2);
t1 = joinable(c1);
t2 = joinable(c2);
assert (t1 == t1);
assert (t1 != t2);
@ -23,15 +63,15 @@ fn main() {
let p1;
let p2;
p1 = comm::port::<int>();
p2 = comm::port::<int>();
p1 = comm::Port::<int>();
p2 = comm::Port::<int>();
assert (p1 == p1);
assert (p1 != p2);
// channels
let c1 = comm::chan(p1);
let c2 = comm::chan(p2);
let c1 = comm::Chan(p1);
let c2 = comm::Chan(p2);
assert (c1 == c1);
assert (c1 != c2);