Skip to content

Commit

Permalink
syntax: tests: fix fallout from using ptr::P.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Sep 14, 2014
1 parent ccd8498 commit d379ad1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/libsyntax/ext/expand.rs
Expand Up @@ -1130,6 +1130,7 @@ mod test {
use fold::Folder;
use parse;
use parse::token;
use ptr::P;
use util::parser_testing::{string_to_parser};
use util::parser_testing::{string_to_pat, string_to_crate, strs_to_idents};
use visit;
Expand Down Expand Up @@ -1239,7 +1240,7 @@ mod test {
let attr1 = make_dummy_attr ("foo");
let attr2 = make_dummy_attr ("bar");
let escape_attr = make_dummy_attr ("macro_escape");
let attrs1 = vec!(attr1, escape_attr, attr2);
let attrs1 = vec!(attr1.clone(), escape_attr, attr2.clone());
assert_eq!(contains_macro_escape(attrs1.as_slice()),true);
let attrs2 = vec!(attr1,attr2);
assert_eq!(contains_macro_escape(attrs2.as_slice()),false);
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/fold.rs
Expand Up @@ -1236,7 +1236,7 @@ mod test {
fn fold_ident(&mut self, _: ast::Ident) -> ast::Ident {
token::str_to_ident("zz")
}
fn fold_mac(&mut self, macro: &ast::Mac) -> ast::Mac {
fn fold_mac(&mut self, macro: ast::Mac) -> ast::Mac {
fold::noop_fold_mac(macro, self)
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/libsyntax/parse/mod.rs
Expand Up @@ -702,7 +702,6 @@ pub fn integer_lit(s: &str, sd: &SpanHandler, sp: Span) -> ast::Lit_ {
mod test {
use super::*;
use serialize::json;
use std::gc::GC;
use codemap::{Span, BytePos, Spanned};
use owned_slice::OwnedSlice;
use ast;
Expand All @@ -711,6 +710,7 @@ mod test {
use attr::AttrMetaMethods;
use parse::parser::Parser;
use parse::token::{str_to_ident};
use ptr::P;
use util::parser_testing::{string_to_tts, string_to_parser};
use util::parser_testing::{string_to_expr, string_to_item};
use util::parser_testing::string_to_stmt;
Expand Down Expand Up @@ -1023,10 +1023,10 @@ mod test {
P(ast::Item{ident:str_to_ident("a"),
attrs:Vec::new(),
id: ast::DUMMY_NODE_ID,
node: ast::ItemFn(ast::P(ast::FnDecl {
node: ast::ItemFn(P(ast::FnDecl {
inputs: vec!(ast::Arg{
ty: ast::P(ast::Ty{id: ast::DUMMY_NODE_ID,
node: ast::TyPath(ast::Path{
ty: P(ast::Ty{id: ast::DUMMY_NODE_ID,
node: ast::TyPath(ast::Path{
span:sp(10,13),
global:false,
segments: vec!(
Expand All @@ -1053,9 +1053,9 @@ mod test {
}),
id: ast::DUMMY_NODE_ID
}),
output: ast::P(ast::Ty{id: ast::DUMMY_NODE_ID,
node: ast::TyNil,
span:sp(15,15)}), // not sure
output: P(ast::Ty{id: ast::DUMMY_NODE_ID,
node: ast::TyNil,
span:sp(15,15)}), // not sure
cf: ast::Return,
variadic: false
}),
Expand All @@ -1069,7 +1069,7 @@ mod test {
predicates: Vec::new(),
}
},
ast::P(ast::Block {
P(ast::Block {
view_items: Vec::new(),
stmts: vec!(P(Spanned{
node: ast::StmtSemi(P(ast::Expr{
Expand Down
7 changes: 4 additions & 3 deletions src/libsyntax/print/pprust.rs
Expand Up @@ -2786,16 +2786,17 @@ mod test {
use ast_util;
use codemap;
use parse::token;
use ptr::P;

#[test]
fn test_fun_to_string() {
let abba_ident = token::str_to_ident("abba");

let decl = ast::FnDecl {
inputs: Vec::new(),
output: ast::P(ast::Ty {id: 0,
node: ast::TyNil,
span: codemap::DUMMY_SP}),
output: P(ast::Ty {id: 0,
node: ast::TyNil,
span: codemap::DUMMY_SP}),
cf: ast::Return,
variadic: false
};
Expand Down
4 changes: 1 addition & 3 deletions src/libsyntax/util/parser_testing.rs
Expand Up @@ -9,14 +9,12 @@
// except according to those terms.

use ast;
use ast::P;
use parse::{new_parse_sess};
use parse::{ParseSess,string_to_filemap,filemap_to_tts};
use parse::{new_parser_from_source_str};
use parse::parser::Parser;
use parse::token;

use std::gc::Gc;
use ptr::P;

/// Map a string to tts, using a made-up filename:
pub fn string_to_tts(source_str: String) -> Vec<ast::TokenTree> {
Expand Down

0 comments on commit d379ad1

Please sign in to comment.