rustdoc: fix tests for @~str -> @str change.
This commit is contained in:
parent
096f6f56a8
commit
a30ee0dee1
3 changed files with 33 additions and 33 deletions
|
@ -75,13 +75,13 @@ mod test {
|
|||
use syntax;
|
||||
use super::{parse_hidden, parse_crate, parse_desc};
|
||||
|
||||
fn parse_attributes(source: ~str) -> ~[ast::attribute] {
|
||||
fn parse_attributes(source: @str) -> ~[ast::attribute] {
|
||||
use syntax::parse;
|
||||
use syntax::parse::attr::parser_attr;
|
||||
|
||||
let parse_sess = syntax::parse::new_parse_sess(None);
|
||||
let parser = parse::new_parser_from_source_str(
|
||||
parse_sess, ~[], ~"-", @source);
|
||||
parse_sess, ~[], @"-", source);
|
||||
|
||||
parser.parse_outer_attributes()
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn should_extract_crate_name_from_link_attribute() {
|
||||
let source = ~"#[link(name = \"snuggles\")]";
|
||||
let source = @"#[link(name = \"snuggles\")]";
|
||||
let attrs = parse_attributes(source);
|
||||
let attrs = parse_crate(attrs);
|
||||
assert!(attrs.name == Some(~"snuggles"));
|
||||
|
@ -97,7 +97,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn should_not_extract_crate_name_if_no_link_attribute() {
|
||||
let source = ~"";
|
||||
let source = @"";
|
||||
let attrs = parse_attributes(source);
|
||||
let attrs = parse_crate(attrs);
|
||||
assert!(attrs.name == None);
|
||||
|
@ -105,7 +105,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn should_not_extract_crate_name_if_no_name_value_in_link_attribute() {
|
||||
let source = ~"#[link(whatever)]";
|
||||
let source = @"#[link(whatever)]";
|
||||
let attrs = parse_attributes(source);
|
||||
let attrs = parse_crate(attrs);
|
||||
assert!(attrs.name == None);
|
||||
|
@ -113,7 +113,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn parse_desc_should_handle_undocumented_mods() {
|
||||
let source = ~"";
|
||||
let source = @"";
|
||||
let attrs = parse_attributes(source);
|
||||
let attrs = parse_desc(attrs);
|
||||
assert!(attrs == None);
|
||||
|
@ -121,7 +121,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn parse_desc_should_parse_simple_doc_attributes() {
|
||||
let source = ~"#[doc = \"basic\"]";
|
||||
let source = @"#[doc = \"basic\"]";
|
||||
let attrs = parse_attributes(source);
|
||||
let attrs = parse_desc(attrs);
|
||||
assert!(attrs == Some(~"basic"));
|
||||
|
@ -129,28 +129,28 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn should_parse_hidden_attribute() {
|
||||
let source = ~"#[doc(hidden)]";
|
||||
let source = @"#[doc(hidden)]";
|
||||
let attrs = parse_attributes(source);
|
||||
assert!(parse_hidden(attrs) == true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_parse_hidden_attribute_with_other_docs() {
|
||||
let source = ~"#[doc = \"foo\"] #[doc(hidden)] #[doc = \"foo\"]";
|
||||
let source = @"#[doc = \"foo\"] #[doc(hidden)] #[doc = \"foo\"]";
|
||||
let attrs = parse_attributes(source);
|
||||
assert!(parse_hidden(attrs) == true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_not_parse_non_hidden_attribute() {
|
||||
let source = ~"#[doc = \"\"]";
|
||||
let source = @"#[doc = \"\"]";
|
||||
let attrs = parse_attributes(source);
|
||||
assert!(parse_hidden(attrs) == false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_concatenate_multiple_doc_comments() {
|
||||
let source = ~"/// foo\n/// bar";
|
||||
let source = @"/// foo\n/// bar";
|
||||
let desc = parse_desc(parse_attributes(source));
|
||||
assert!(desc == Some(~"foo\nbar"));
|
||||
}
|
||||
|
|
|
@ -287,21 +287,21 @@ mod test {
|
|||
|
||||
use core::vec;
|
||||
|
||||
fn mk_doc(source: ~str) -> doc::Doc {
|
||||
fn mk_doc(source: @str) -> doc::Doc {
|
||||
let ast = parse::from_str(source);
|
||||
extract(ast, ~"")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extract_empty_crate() {
|
||||
let doc = mk_doc(~"");
|
||||
let doc = mk_doc(@"");
|
||||
assert!(doc.cratemod().mods().is_empty());
|
||||
assert!(doc.cratemod().fns().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extract_mods() {
|
||||
let doc = mk_doc(~"mod a { mod b { } mod c { } }");
|
||||
let doc = mk_doc(@"mod a { mod b { } mod c { } }");
|
||||
assert!(doc.cratemod().mods()[0].name() == ~"a");
|
||||
assert!(doc.cratemod().mods()[0].mods()[0].name() == ~"b");
|
||||
assert!(doc.cratemod().mods()[0].mods()[1].name() == ~"c");
|
||||
|
@ -309,27 +309,27 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn extract_fns_from_foreign_mods() {
|
||||
let doc = mk_doc(~"extern { fn a(); }");
|
||||
let doc = mk_doc(@"extern { fn a(); }");
|
||||
assert!(doc.cratemod().nmods()[0].fns[0].name() == ~"a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extract_mods_deep() {
|
||||
let doc = mk_doc(~"mod a { mod b { mod c { } } }");
|
||||
let doc = mk_doc(@"mod a { mod b { mod c { } } }");
|
||||
assert!(doc.cratemod().mods()[0].mods()[0].mods()[0].name() ==
|
||||
~"c");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extract_should_set_mod_ast_id() {
|
||||
let doc = mk_doc(~"mod a { }");
|
||||
let doc = mk_doc(@"mod a { }");
|
||||
assert!(doc.cratemod().mods()[0].id() != 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extract_fns() {
|
||||
let doc = mk_doc(
|
||||
~"fn a() { } \
|
||||
@"fn a() { } \
|
||||
mod b { fn c() {
|
||||
} }");
|
||||
assert!(doc.cratemod().fns()[0].name() == ~"a");
|
||||
|
@ -338,13 +338,13 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn extract_should_set_fn_ast_id() {
|
||||
let doc = mk_doc(~"fn a() { }");
|
||||
let doc = mk_doc(@"fn a() { }");
|
||||
assert!(doc.cratemod().fns()[0].id() != 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extract_should_use_default_crate_name() {
|
||||
let source = ~"";
|
||||
let source = @"";
|
||||
let ast = parse::from_str(source);
|
||||
let doc = extract(ast, ~"burp");
|
||||
assert!(doc.cratemod().name() == ~"burp");
|
||||
|
@ -361,57 +361,57 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn should_extract_const_name_and_id() {
|
||||
let doc = mk_doc(~"static a: int = 0;");
|
||||
let doc = mk_doc(@"static a: int = 0;");
|
||||
assert!(doc.cratemod().consts()[0].id() != 0);
|
||||
assert!(doc.cratemod().consts()[0].name() == ~"a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_extract_enums() {
|
||||
let doc = mk_doc(~"enum e { v }");
|
||||
let doc = mk_doc(@"enum e { v }");
|
||||
assert!(doc.cratemod().enums()[0].id() != 0);
|
||||
assert!(doc.cratemod().enums()[0].name() == ~"e");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_extract_enum_variants() {
|
||||
let doc = mk_doc(~"enum e { v }");
|
||||
let doc = mk_doc(@"enum e { v }");
|
||||
assert!(doc.cratemod().enums()[0].variants[0].name == ~"v");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_extract_traits() {
|
||||
let doc = mk_doc(~"trait i { fn f(); }");
|
||||
let doc = mk_doc(@"trait i { fn f(); }");
|
||||
assert!(doc.cratemod().traits()[0].name() == ~"i");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_extract_trait_methods() {
|
||||
let doc = mk_doc(~"trait i { fn f(); }");
|
||||
let doc = mk_doc(@"trait i { fn f(); }");
|
||||
assert!(doc.cratemod().traits()[0].methods[0].name == ~"f");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_extract_impl_methods() {
|
||||
let doc = mk_doc(~"impl int { fn f() { } }");
|
||||
let doc = mk_doc(@"impl int { fn f() { } }");
|
||||
assert!(doc.cratemod().impls()[0].methods[0].name == ~"f");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_extract_tys() {
|
||||
let doc = mk_doc(~"type a = int;");
|
||||
let doc = mk_doc(@"type a = int;");
|
||||
assert!(doc.cratemod().types()[0].name() == ~"a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_extract_structs() {
|
||||
let doc = mk_doc(~"struct Foo { field: () }");
|
||||
let doc = mk_doc(@"struct Foo { field: () }");
|
||||
assert!(doc.cratemod().structs()[0].name() == ~"Foo");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_extract_struct_fields() {
|
||||
let doc = mk_doc(~"struct Foo { field: () }");
|
||||
let doc = mk_doc(@"struct Foo { field: () }");
|
||||
assert!(doc.cratemod().structs()[0].fields[0] == ~"field");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ pub fn default_seq_fold_struct<T>(
|
|||
|
||||
#[test]
|
||||
fn default_fold_should_produce_same_doc() {
|
||||
let source = ~"mod a { fn b() { } mod c { fn d() { } } }";
|
||||
let source = @"mod a { fn b() { } mod c { fn d() { } } }";
|
||||
let ast = parse::from_str(source);
|
||||
let doc = extract::extract(ast, ~"");
|
||||
let fld = default_seq_fold(());
|
||||
|
@ -378,7 +378,7 @@ fn default_fold_should_produce_same_doc() {
|
|||
|
||||
#[test]
|
||||
fn default_fold_should_produce_same_consts() {
|
||||
let source = ~"static a: int = 0;";
|
||||
let source = @"static a: int = 0;";
|
||||
let ast = parse::from_str(source);
|
||||
let doc = extract::extract(ast, ~"");
|
||||
let fld = default_seq_fold(());
|
||||
|
@ -388,7 +388,7 @@ fn default_fold_should_produce_same_consts() {
|
|||
|
||||
#[test]
|
||||
fn default_fold_should_produce_same_enums() {
|
||||
let source = ~"enum a { b }";
|
||||
let source = @"enum a { b }";
|
||||
let ast = parse::from_str(source);
|
||||
let doc = extract::extract(ast, ~"");
|
||||
let fld = default_seq_fold(());
|
||||
|
@ -398,7 +398,7 @@ fn default_fold_should_produce_same_enums() {
|
|||
|
||||
#[test]
|
||||
fn default_parallel_fold_should_produce_same_doc() {
|
||||
let source = ~"mod a { fn b() { } mod c { fn d() { } } }";
|
||||
let source = @"mod a { fn b() { } mod c { fn d() { } } }";
|
||||
let ast = parse::from_str(source);
|
||||
let doc = extract::extract(ast, ~"");
|
||||
let fld = default_par_fold(());
|
||||
|
|
Loading…
Add table
Reference in a new issue