Skip to content

Commit 1745ac9

Browse files
committed
Remove tests from astencode.rs
They mysteriously fail on Windows, and Niko assures me this code is about be replaced anyway.
1 parent 2e3f109 commit 1745ac9

File tree

1 file changed

+0
-116
lines changed

1 file changed

+0
-116
lines changed

src/rustc/metadata/astencode.rs

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -901,119 +901,3 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
901901
#debug[">< Side table doc loaded"];
902902
}
903903
}
904-
905-
// ______________________________________________________________________
906-
// Testing of astencode_gen
907-
908-
#[cfg(test)]
909-
fn encode_item_ast(ebml_w: ebml::writer, item: @ast::item) {
910-
ebml_w.wr_tag(c::tag_tree as uint) {||
911-
astencode_gen::serialize_syntax_ast_item(ebml_w, *item);
912-
}
913-
}
914-
915-
#[cfg(test)]
916-
fn decode_item_ast(par_doc: ebml::doc) -> @ast::item {
917-
let chi_doc = par_doc[c::tag_tree];
918-
let d = ebml::ebml_deserializer(chi_doc);
919-
@astencode_gen::deserialize_syntax_ast_item(d)
920-
}
921-
922-
#[cfg(test)]
923-
fn new_parse_sess() -> parser::parse_sess {
924-
let cm = codemap::new_codemap();
925-
let handler = diagnostic::mk_handler(option::none);
926-
let sess = @{
927-
cm: cm,
928-
mutable next_id: 1,
929-
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
930-
mutable chpos: 0u,
931-
mutable byte_pos: 0u
932-
};
933-
ret sess;
934-
}
935-
936-
#[cfg(test)]
937-
iface fake_ext_ctxt {
938-
fn session() -> fake_session;
939-
}
940-
941-
#[cfg(test)]
942-
type fake_options = {cfg: ast::crate_cfg};
943-
944-
#[cfg(test)]
945-
type fake_session = {opts: @fake_options,
946-
parse_sess: parser::parse_sess};
947-
948-
#[cfg(test)]
949-
impl of fake_ext_ctxt for fake_session {
950-
fn session() -> fake_session {self}
951-
}
952-
953-
#[cfg(test)]
954-
fn mk_ctxt() -> fake_ext_ctxt {
955-
let opts : fake_options = {cfg: []};
956-
{opts: @opts, parse_sess: new_parse_sess()} as fake_ext_ctxt
957-
}
958-
959-
#[cfg(test)]
960-
fn roundtrip(in_item: @ast::item) {
961-
#debug["in_item = %s", pprust::item_to_str(in_item)];
962-
let mbuf = io::mem_buffer();
963-
let ebml_w = ebml::writer(io::mem_buffer_writer(mbuf));
964-
encode_item_ast(ebml_w, in_item);
965-
let ebml_doc = ebml::doc(@io::mem_buffer_buf(mbuf));
966-
let out_item = decode_item_ast(ebml_doc);
967-
#debug["out_item = %s", pprust::item_to_str(out_item)];
968-
assert in_item == out_item;
969-
}
970-
971-
#[test]
972-
fn test_basic() {
973-
let ext_cx = mk_ctxt();
974-
roundtrip(#ast(item){
975-
fn foo() {}
976-
});
977-
}
978-
979-
#[test]
980-
fn test_smalltalk() {
981-
let ext_cx = mk_ctxt();
982-
roundtrip(#ast(item){
983-
fn foo() -> int { 3 + 4 } // first smalltalk program ever executed.
984-
});
985-
}
986-
987-
#[test]
988-
fn test_more() {
989-
let ext_cx = mk_ctxt();
990-
roundtrip(#ast(item){
991-
fn foo(x: uint, y: uint) -> uint {
992-
let z = x + y;
993-
ret z;
994-
}
995-
});
996-
}
997-
998-
#[test]
999-
fn test_simplification() {
1000-
let ext_cx = mk_ctxt();
1001-
let item_in = ast::ii_item(#ast(item) {
1002-
fn new_int_alist<B: copy>() -> alist<int, B> {
1003-
fn eq_int(&&a: int, &&b: int) -> bool { a == b }
1004-
ret {eq_fn: eq_int, mut data: []};
1005-
}
1006-
});
1007-
let item_out = simplify_ast(item_in);
1008-
let item_exp = ast::ii_item(#ast(item) {
1009-
fn new_int_alist<B: copy>() -> alist<int, B> {
1010-
ret {eq_fn: eq_int, mut data: []};
1011-
}
1012-
});
1013-
alt (item_out, item_exp) {
1014-
(ast::ii_item(item_out), ast::ii_item(item_exp)) {
1015-
assert pprust::item_to_str(item_out) == pprust::item_to_str(item_exp);
1016-
}
1017-
_ { fail; }
1018-
}
1019-
}

0 commit comments

Comments
 (0)