Fix test fallout from removing vecs_implicitly_copyable

This commit is contained in:
Alex Crichton 2013-05-12 16:50:57 -04:00
parent 5614e83e81
commit ffcc680f9c
14 changed files with 52 additions and 62 deletions

View File

@ -60,7 +60,6 @@ while cur < len(lines):
if not re.search(r"\bextern mod std\b", block):
block = "extern mod std;\n" + block
block = """#[ forbid(ctypes) ];
#[ forbid(deprecated_mode) ];
#[ forbid(deprecated_pattern) ];
#[ forbid(implicit_copies) ];
#[ forbid(non_implicitly_copyable_typarams) ];
@ -68,12 +67,9 @@ while cur < len(lines):
#[ forbid(type_limits) ];
#[ forbid(unrecognized_lint) ];
#[ forbid(unused_imports) ];
#[ forbid(vecs_implicitly_copyable) ];
#[ forbid(while_true) ];
#[ warn(deprecated_self) ];
#[ warn(non_camel_case_types) ];
#[ warn(structural_records) ];\n
#[ warn(non_camel_case_types) ];\n
""" + block
if xfail:
block = "// xfail-test\n" + block

View File

@ -134,7 +134,7 @@ pub fn stash_expr_if(c: @fn(@ast::expr, test_mode)->bool,
e: @ast::expr,
tm: test_mode) {
if c(e, tm) {
*es += ~[e];
*es = *es + ~[e];
} else {
/* now my indices are wrong :( */
}

View File

@ -102,7 +102,6 @@ impl<E:CLike> BitAnd<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
#[cfg(test)]
mod test {
use core;
use core::iter;
use util::enum_set::*;

View File

@ -103,7 +103,7 @@ fn parse_item_attrs<T:Owned>(
id: doc::AstId,
parse_attrs: ~fn(a: ~[ast::attribute]) -> T) -> T {
do astsrv::exec(srv) |ctxt| {
let attrs = match *ctxt.ast_map.get(&id) {
let attrs = match ctxt.ast_map.get_copy(&id) {
ast_map::node_item(item, _) => copy item.attrs,
ast_map::node_foreign_item(item, _, _, _) => copy item.attrs,
_ => fail!("parse_item_attrs: not an item")
@ -127,7 +127,7 @@ fn fold_enum(
let desc = {
let variant = copy variant;
do astsrv::exec(srv.clone()) |ctxt| {
match *ctxt.ast_map.get(&doc_id) {
match ctxt.ast_map.get_copy(&doc_id) {
ast_map::node_item(@ast::item {
node: ast::item_enum(ref enum_definition, _), _
}, _) => {
@ -177,7 +177,7 @@ fn merge_method_attrs(
// Create an assoc list from method name to attributes
let attrs: ~[(~str, Option<~str>)] = do astsrv::exec(srv) |ctxt| {
match *ctxt.ast_map.get(&item_id) {
match ctxt.ast_map.get_copy(&item_id) {
ast_map::node_item(@ast::item {
node: ast::item_trait(_, _, ref methods), _
}, _) => {

View File

@ -53,7 +53,7 @@ fn is_hidden(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
let id = doc.id;
do astsrv::exec(srv) |ctxt| {
let attrs = match *ctxt.ast_map.get(&id) {
let attrs = match ctxt.ast_map.get_copy(&id) {
ast_map::node_item(item, _) => copy item.attrs,
_ => ~[]
};

View File

@ -55,7 +55,7 @@ fn fold_impl(
let doc = fold::default_seq_fold_impl(fold, doc);
do astsrv::exec(fold.ctxt.clone()) |ctxt| {
match *ctxt.ast_map.get(&doc.item.id) {
match ctxt.ast_map.get_copy(&doc.item.id) {
ast_map::node_item(item, _) => {
match item.node {
ast::item_impl(_, None, _, ref methods) => {
@ -134,7 +134,7 @@ fn is_visible(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
let id = doc.id;
do astsrv::exec(srv) |ctxt| {
match *ctxt.ast_map.get(&id) {
match ctxt.ast_map.get_copy(&id) {
ast_map::node_item(item, _) => {
match &item.node {
&ast::item_impl(*) => {

View File

@ -63,7 +63,7 @@ fn fold_fn(
fn get_fn_sig(srv: astsrv::Srv, fn_id: doc::AstId) -> Option<~str> {
do astsrv::exec(srv) |ctxt| {
match *ctxt.ast_map.get(&fn_id) {
match ctxt.ast_map.get_copy(&fn_id) {
ast_map::node_item(@ast::item {
ident: ident,
node: ast::item_fn(ref decl, purity, _, ref tys, _), _
@ -90,7 +90,7 @@ fn fold_const(
sig: Some({
let doc = copy doc;
do astsrv::exec(srv) |ctxt| {
match *ctxt.ast_map.get(&doc.id()) {
match ctxt.ast_map.get_copy(&doc.id()) {
ast_map::node_item(@ast::item {
node: ast::item_const(ty, _), _
}, _) => {
@ -115,7 +115,7 @@ fn fold_enum(
let sig = {
let variant = copy *variant;
do astsrv::exec(srv.clone()) |ctxt| {
match *ctxt.ast_map.get(&doc_id) {
match ctxt.ast_map.get_copy(&doc_id) {
ast_map::node_item(@ast::item {
node: ast::item_enum(ref enum_definition, _), _
}, _) => {
@ -170,7 +170,7 @@ fn get_method_sig(
method_name: ~str
) -> Option<~str> {
do astsrv::exec(srv) |ctxt| {
match *ctxt.ast_map.get(&item_id) {
match ctxt.ast_map.get_copy(&item_id) {
ast_map::node_item(@ast::item {
node: ast::item_trait(_, _, ref methods), _
}, _) => {
@ -241,7 +241,7 @@ fn fold_impl(
let (bounds, trait_types, self_ty) = {
let doc = copy doc;
do astsrv::exec(srv) |ctxt| {
match *ctxt.ast_map.get(&doc.id()) {
match ctxt.ast_map.get_copy(&doc.id()) {
ast_map::node_item(@ast::item {
node: ast::item_impl(ref generics, opt_trait_type, self_ty, _), _
}, _) => {
@ -280,7 +280,7 @@ fn fold_type(
sig: {
let doc = copy doc;
do astsrv::exec(srv) |ctxt| {
match *ctxt.ast_map.get(&doc.id()) {
match ctxt.ast_map.get_copy(&doc.id()) {
ast_map::node_item(@ast::item {
ident: ident,
node: ast::item_ty(ty, ref params), _
@ -312,7 +312,7 @@ fn fold_struct(
sig: {
let doc = copy doc;
do astsrv::exec(srv) |ctxt| {
match *ctxt.ast_map.get(&doc.id()) {
match ctxt.ast_map.get_copy(&doc.id()) {
ast_map::node_item(item, _) => {
let item = strip_struct_extra_stuff(item);
Some(pprust::item_to_str(item,

View File

@ -41,6 +41,7 @@ use context::Ctx;
mod conditions;
mod context;
mod path_util;
#[cfg(test)]
mod tests;
mod util;
mod workspace;

View File

@ -77,7 +77,6 @@ fn is_rwx(p: &Path) -> bool {
}
}
#[cfg(test)]
fn test_sysroot() -> Path {
// Totally gross hack but it's just for test cases.
// Infer the sysroot from the exe name and tack "stage2"
@ -107,19 +106,19 @@ fn test_install_valid() {
let temp_pkg_id = fake_pkg();
let temp_workspace = mk_temp_workspace(&temp_pkg_id.path);
// should have test, bench, lib, and main
ctxt.install(&temp_workspace, temp_pkg_id);
ctxt.install(&temp_workspace, &temp_pkg_id);
// Check that all files exist
let exec = target_executable_in_workspace(temp_pkg_id, &temp_workspace);
let exec = target_executable_in_workspace(&temp_pkg_id, &temp_workspace);
debug!("exec = %s", exec.to_str());
assert!(os::path_exists(&exec));
assert!(is_rwx(&exec));
let lib = target_library_in_workspace(temp_pkg_id, &temp_workspace);
let lib = target_library_in_workspace(&temp_pkg_id, &temp_workspace);
debug!("lib = %s", lib.to_str());
assert!(os::path_exists(&lib));
assert!(is_rwx(&lib));
// And that the test and bench executables aren't installed
assert!(!os::path_exists(&target_test_in_workspace(temp_pkg_id, &temp_workspace)));
let bench = target_bench_in_workspace(temp_pkg_id, &temp_workspace);
assert!(!os::path_exists(&target_test_in_workspace(&temp_pkg_id, &temp_workspace)));
let bench = target_bench_in_workspace(&temp_pkg_id, &temp_workspace);
debug!("bench = %s", bench.to_str());
assert!(!os::path_exists(&bench));
}
@ -140,7 +139,7 @@ fn test_install_invalid() {
do cond.trap(|_| {
error_occurred = true;
}).in {
ctxt.install(&temp_workspace, pkgid);
ctxt.install(&temp_workspace, &pkgid);
}
}
assert!(error_occurred && error1_occurred);
@ -155,19 +154,19 @@ fn test_install_url() {
let temp_pkg_id = remote_pkg();
let temp_workspace = mk_temp_workspace(&temp_pkg_id.path);
// should have test, bench, lib, and main
ctxt.install(&temp_workspace, temp_pkg_id);
ctxt.install(&temp_workspace, &temp_pkg_id);
// Check that all files exist
let exec = target_executable_in_workspace(temp_pkg_id, &temp_workspace);
let exec = target_executable_in_workspace(&temp_pkg_id, &temp_workspace);
debug!("exec = %s", exec.to_str());
assert!(os::path_exists(&exec));
assert!(is_rwx(&exec));
let lib = target_library_in_workspace(temp_pkg_id, &temp_workspace);
let lib = target_library_in_workspace(&temp_pkg_id, &temp_workspace);
debug!("lib = %s", lib.to_str());
assert!(os::path_exists(&lib));
assert!(is_rwx(&lib));
// And that the test and bench executables aren't installed
assert!(!os::path_exists(&target_test_in_workspace(temp_pkg_id, &temp_workspace)));
let bench = target_bench_in_workspace(temp_pkg_id, &temp_workspace);
assert!(!os::path_exists(&target_test_in_workspace(&temp_pkg_id, &temp_workspace)));
let bench = target_bench_in_workspace(&temp_pkg_id, &temp_workspace);
debug!("bench = %s", bench.to_str());
assert!(!os::path_exists(&bench));
}
}

View File

@ -23,7 +23,7 @@ use syntax::codemap::{dummy_sp, spanned, dummy_spanned};
use syntax::ext::base::{mk_ctxt, ext_ctxt};
use syntax::ext::build;
use syntax::{ast, attr, codemap, diagnostic, fold};
use syntax::ast::{meta_name_value, meta_list, attribute, crate_};
use syntax::ast::{meta_name_value, meta_list, attribute};
use syntax::attr::{mk_attr};
use rustc::back::link::output_type_exe;
use rustc::driver::session::{lib_crate, unknown_crate, crate_type};

View File

@ -679,19 +679,19 @@ mod test {
#[test] fn xorpush_test () {
let mut s = ~[];
xorPush(&mut s,14);
assert_eq!(s,~[14]);
assert_eq!(copy s,~[14]);
xorPush(&mut s,14);
assert_eq!(s,~[]);
assert_eq!(copy s,~[]);
xorPush(&mut s,14);
assert_eq!(s,~[14]);
assert_eq!(copy s,~[14]);
xorPush(&mut s,15);
assert_eq!(s,~[14,15]);
assert_eq!(copy s,~[14,15]);
xorPush (&mut s,16);
assert_eq! (s,~[14,15,16]);
assert_eq!(copy s,~[14,15,16]);
xorPush (&mut s,16);
assert_eq! (s,~[14,15]);
assert_eq!(copy s,~[14,15]);
xorPush (&mut s,15);
assert_eq! (s,~[14]);
assert_eq!(copy s,~[14]);
}
// convert a list of uints to an @~[ident]
@ -746,7 +746,7 @@ mod test {
let mut t = mk_sctable();
let test_sc = ~[M(3),R(id(101,0),14),M(9)];
assert_eq!(unfold_test_sc(test_sc,empty_ctxt,&mut t),3);
assert_eq!(unfold_test_sc(copy test_sc,empty_ctxt,&mut t),3);
assert_eq!(t[1],Mark(9,0));
assert_eq!(t[2],Rename(id(101,0),14,1));
assert_eq!(t[3],Mark(3,2));

View File

@ -662,12 +662,11 @@ mod test {
#[test] fn fail_exists_test () {
let src = ~"fn main() { fail!(\"something appropriately gloomy\");}";
let sess = parse::new_parse_sess(None);
let cfg = ~[];
let crate_ast = parse::parse_crate_from_source_str(
~"<test>",
@src,
cfg,sess);
expand_crate(sess,cfg,crate_ast);
~[],sess);
expand_crate(sess,~[],crate_ast);
}
// these following tests are quite fragile, in that they don't test what
@ -679,13 +678,12 @@ mod test {
let src = ~"fn bogus() {macro_rules! z (() => (3+4))}\
fn inty() -> int { z!() }";
let sess = parse::new_parse_sess(None);
let cfg = ~[];
let crate_ast = parse::parse_crate_from_source_str(
~"<test>",
@src,
cfg,sess);
~[],sess);
// should fail:
expand_crate(sess,cfg,crate_ast);
expand_crate(sess,~[],crate_ast);
}
// make sure that macros can leave scope for modules
@ -694,13 +692,12 @@ mod test {
let src = ~"mod foo {macro_rules! z (() => (3+4))}\
fn inty() -> int { z!() }";
let sess = parse::new_parse_sess(None);
let cfg = ~[];
let crate_ast = parse::parse_crate_from_source_str(
~"<test>",
@src,
cfg,sess);
~[],sess);
// should fail:
expand_crate(sess,cfg,crate_ast);
expand_crate(sess,~[],crate_ast);
}
// macro_escape modules shouldn't cause macros to leave scope
@ -708,13 +705,12 @@ mod test {
let src = ~"#[macro_escape] mod foo {macro_rules! z (() => (3+4))}\
fn inty() -> int { z!() }";
let sess = parse::new_parse_sess(None);
let cfg = ~[];
let crate_ast = parse::parse_crate_from_source_str(
~"<test>",
@src,
cfg,sess);
~[], sess);
// should fail:
expand_crate(sess,cfg,crate_ast);
expand_crate(sess,~[],crate_ast);
}
#[test] fn core_macros_must_parse () {

View File

@ -351,15 +351,14 @@ mod test {
use core::option::None;
use core::int;
use core::num::NumCast;
use core::path::Path;
use codemap::{dummy_sp, CodeMap, span, BytePos, spanned};
use codemap::{CodeMap, span, BytePos, spanned};
use opt_vec;
use ast;
use abi;
use ast_util::mk_ident;
use parse::parser::Parser;
use parse::token::{ident_interner, mk_ident_interner, mk_fresh_ident_interner};
use diagnostic::{span_handler, mk_span_handler, mk_handler, Emitter};
use parse::token::{ident_interner, mk_fresh_ident_interner};
use diagnostic::{mk_span_handler, mk_handler};
// add known names to interner for testing
fn mk_testing_interner() -> @ident_interner {
@ -408,7 +407,7 @@ mod test {
// map a string to tts, return the tt without its parsesess
fn string_to_tts_only(source_str : @~str) -> ~[ast::token_tree] {
let (tts,ps) = string_to_tts_t(source_str);
let (tts,_ps) = string_to_tts_t(source_str);
tts
}
@ -483,7 +482,7 @@ mod test {
}*/
#[test] fn string_to_tts_1 () {
let (tts,ps) = string_to_tts_t(@~"fn a (b : int) { b; }");
let (tts,_ps) = string_to_tts_t(@~"fn a (b : int) { b; }");
assert_eq!(to_json_str(@tts),
~"[\
[\"tt_tok\",null,[\"IDENT\",\"fn\",false]],\
@ -548,7 +547,7 @@ mod test {
}
fn parser_done(p: Parser){
assert_eq!(*p.token,token::EOF);
assert_eq!(copy *p.token,token::EOF);
}
#[test] fn parse_ident_pat () {

View File

@ -2388,7 +2388,7 @@ pub impl Parser {
// preceded by unary-minus) or identifiers.
let val = self.parse_literal_maybe_minus();
if self.eat(&token::DOTDOT) {
let end = if is_ident_or_path(&tok) {
let end = if is_ident_or_path(tok) {
let path = self.parse_path_with_tps(true);
let hi = self.span.hi;
self.mk_expr(lo, hi, expr_path(path))