Remove unit tests

This commit is contained in:
Seiichi Uchida 2018-03-18 01:08:10 +09:00 committed by topecongiro
parent c9701d8e18
commit 84ea306d32

View file

@ -957,50 +957,3 @@ fn format_lazy_static(context: &RewriteContext, shape: Shape, ts: &TokenStream)
Some(result)
}
#[cfg(test)]
mod test {
use super::*;
use syntax;
use syntax::parse::{parse_stream_from_source_str, ParseSess};
use syntax::codemap::{FileName, FilePathMapping};
fn format_macro_args_str(s: &str) -> String {
let mut result = String::new();
syntax::with_globals(|| {
let input = parse_stream_from_source_str(
FileName::Custom("stdin".to_owned()),
s.to_owned(),
&ParseSess::new(FilePathMapping::empty()),
None,
);
let shape = Shape {
width: 100,
indent: Indent::empty(),
offset: 0,
};
result = format_macro_args(input.into(), shape).unwrap();
});
result
}
#[test]
fn test_format_macro_args() {
assert_eq!(format_macro_args_str(""), "".to_owned());
assert_eq!(format_macro_args_str("$ x : ident"), "$x: ident".to_owned());
assert_eq!(
format_macro_args_str("$ m1 : ident , $ m2 : ident , $ x : ident"),
"$m1: ident, $m2: ident, $x: ident".to_owned()
);
assert_eq!(
format_macro_args_str("$($beginning:ident),*;$middle:ident;$($end:ident),*"),
"$($beginning: ident),*; $middle: ident; $($end: ident),*".to_owned()
);
assert_eq!(
format_macro_args_str(
"$ name : ident ( $ ( $ dol : tt $ var : ident ) * ) $ ( $ body : tt ) *"
),
"$name: ident($($dol: tt $var: ident)*) $($body: tt)*".to_owned()
);
}
}