diff options
Diffstat (limited to 'src/rustdoc/tystr_pass.rs')
| -rw-r--r-- | src/rustdoc/tystr_pass.rs | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/rustdoc/tystr_pass.rs b/src/rustdoc/tystr_pass.rs index 011420bdcf4..006e8bc66dc 100644 --- a/src/rustdoc/tystr_pass.rs +++ b/src/rustdoc/tystr_pass.rs @@ -9,7 +9,7 @@ export mk_pass; fn mk_pass() -> pass { { - name: "tystr", + name: ~"tystr", f: run } } @@ -43,7 +43,7 @@ fn fold_fn( } } -fn get_fn_sig(srv: astsrv::srv, fn_id: doc::ast_id) -> option<str> { +fn get_fn_sig(srv: astsrv::srv, fn_id: doc::ast_id) -> option<~str> { do astsrv::exec(srv) |ctxt| { alt check ctxt.ast_map.get(fn_id) { ast_map::node_item(@{ @@ -62,14 +62,14 @@ fn get_fn_sig(srv: astsrv::srv, fn_id: doc::ast_id) -> option<str> { #[test] fn should_add_fn_sig() { - let doc = test::mk_doc("fn a<T>() -> int { }"); - assert doc.cratemod().fns()[0].sig == some("fn a<T>() -> int"); + let doc = test::mk_doc(~"fn a<T>() -> int { }"); + assert doc.cratemod().fns()[0].sig == some(~"fn a<T>() -> int"); } #[test] fn should_add_foreign_fn_sig() { - let doc = test::mk_doc("extern mod a { fn a<T>() -> int; }"); - assert doc.cratemod().nmods()[0].fns[0].sig == some("fn a<T>() -> int"); + let doc = test::mk_doc(~"extern mod a { fn a<T>() -> int; }"); + assert doc.cratemod().nmods()[0].fns[0].sig == some(~"fn a<T>() -> int"); } fn fold_const( @@ -94,8 +94,8 @@ fn fold_const( #[test] fn should_add_const_types() { - let doc = test::mk_doc("const a: bool = true;"); - assert doc.cratemod().consts()[0].sig == some("bool"); + let doc = test::mk_doc(~"const a: bool = true;"); + assert doc.cratemod().consts()[0].sig == some(~"bool"); } fn fold_enum( @@ -133,8 +133,8 @@ fn fold_enum( #[test] fn should_add_variant_sigs() { - let doc = test::mk_doc("enum a { b(int) }"); - assert doc.cratemod().enums()[0].variants[0].sig == some("b(int)"); + let doc = test::mk_doc(~"enum a { b(int) }"); + assert doc.cratemod().enums()[0].variants[0].sig == some(~"b(int)"); } fn fold_trait( @@ -163,8 +163,8 @@ fn merge_methods( fn get_method_sig( srv: astsrv::srv, item_id: doc::ast_id, - method_name: str -) -> option<str> { + method_name: ~str +) -> option<~str> { do astsrv::exec(srv) |ctxt| { alt check ctxt.ast_map.get(item_id) { ast_map::node_item(@{ @@ -217,9 +217,9 @@ fn get_method_sig( #[test] fn should_add_trait_method_sigs() { - let doc = test::mk_doc("iface i { fn a<T>() -> int; }"); + let doc = test::mk_doc(~"iface i { fn a<T>() -> int; }"); assert doc.cratemod().traits()[0].methods[0].sig - == some("fn a<T>() -> int"); + == some(~"fn a<T>() -> int"); } fn fold_impl( @@ -239,7 +239,7 @@ fn fold_impl( }); (trait_ty, some(pprust::ty_to_str(self_ty))) } - _ { fail "expected impl" } + _ { fail ~"expected impl" } } }; @@ -253,27 +253,27 @@ fn fold_impl( #[test] fn should_add_impl_trait_ty() { - let doc = test::mk_doc("impl i of j for int { fn a<T>() { } }"); - assert doc.cratemod().impls()[0].trait_ty == some("j"); + let doc = test::mk_doc(~"impl i of j for int { fn a<T>() { } }"); + assert doc.cratemod().impls()[0].trait_ty == some(~"j"); } #[test] fn should_not_add_impl_trait_ty_if_none() { - let doc = test::mk_doc("impl i for int { fn a() { } }"); + let doc = test::mk_doc(~"impl i for int { fn a() { } }"); assert doc.cratemod().impls()[0].trait_ty == none; } #[test] fn should_add_impl_self_ty() { - let doc = test::mk_doc("impl i for int { fn a() { } }"); - assert doc.cratemod().impls()[0].self_ty == some("int"); + let doc = test::mk_doc(~"impl i for int { fn a() { } }"); + assert doc.cratemod().impls()[0].self_ty == some(~"int"); } #[test] fn should_add_impl_method_sigs() { - let doc = test::mk_doc("impl i for int { fn a<T>() -> int { fail } }"); + let doc = test::mk_doc(~"impl i for int { fn a<T>() -> int { fail } }"); assert doc.cratemod().impls()[0].methods[0].sig - == some("fn a<T>() -> int"); + == some(~"fn a<T>() -> int"); } fn fold_type( @@ -297,7 +297,7 @@ fn fold_type( pprust::ty_to_str(ty) )) } - _ { fail "expected type" } + _ { fail ~"expected type" } } } with doc @@ -306,15 +306,15 @@ fn fold_type( #[test] fn should_add_type_signatures() { - let doc = test::mk_doc("type t<T> = int;"); - assert doc.cratemod().types()[0].sig == some("type t<T> = int"); + let doc = test::mk_doc(~"type t<T> = int;"); + assert doc.cratemod().types()[0].sig == some(~"type t<T> = int"); } #[cfg(test)] mod test { - fn mk_doc(source: str) -> doc::doc { + fn mk_doc(source: ~str) -> doc::doc { do astsrv::from_str(source) |srv| { - let doc = extract::from_srv(srv, ""); + let doc = extract::from_srv(srv, ~""); run(srv, doc) } } |
