3 fn t(builder: UrlPartsBuilder, expect: &str) {
4 assert_eq!(builder.finish(), expect);
9 t(UrlPartsBuilder::new(), "");
14 t(UrlPartsBuilder::singleton("index.html"), "index.html");
19 let mut builder = UrlPartsBuilder::new();
22 builder.push("struct.Bytes.html");
23 t(builder, "core/str/struct.Bytes.html");
27 fn push_front_empty() {
28 let mut builder = UrlPartsBuilder::new();
29 builder.push_front("page.html");
30 t(builder, "page.html");
34 fn push_front_non_empty() {
35 let mut builder = UrlPartsBuilder::new();
38 builder.push("struct.Bytes.html");
39 builder.push_front("nightly");
40 t(builder, "nightly/core/str/struct.Bytes.html");
45 let mut builder = UrlPartsBuilder::new();
46 builder.push_fmt(format_args!("{}", "core"));
48 builder.push_front("nightly");
49 builder.push_fmt(format_args!("{}.{}.html", "struct", "Bytes"));
50 t(builder, "nightly/core/str/struct.Bytes.html");
55 t(["core", "str"].into_iter().collect(), "core/str");
56 t(["core", "str", "struct.Bytes.html"].into_iter().collect(), "core/str/struct.Bytes.html");
61 let mut builder = UrlPartsBuilder::singleton("core");
62 builder.extend(["str", "struct.Bytes.html"]);
63 t(builder, "core/str/struct.Bytes.html");