1 use debugger_test::debugger_test;
2 use url::Url;
3
4 #[inline(never)]
__break()5 fn __break() {}
6
7 #[debugger_test(
8 debugger = "cdb",
9 commands = "
10 .nvlist
11
12 dx base_url
13
14 dx url_with_non_special_scheme
15
16 dx url_with_user_pass_port_query_fragments
17
18 dx url_blob
19
20 dx url_with_base
21
22 dx url_with_base_replaced
23
24 dx url_with_comma",
25 expected_statements = r#"
26 pattern:debugger_visualizer-.*\.exe \(embedded NatVis ".*-[0-9]+\.natvis"\)
27
28 base_url : "http://example.org/foo/bar" [Type: url::Url]
29 [<Raw View>] [Type: url::Url]
30 [scheme] : "http"
31 [host] : "example.org"
32 [path] : "/foo/bar"
33
34 url_with_non_special_scheme : "non-special://test/x" [Type: url::Url]
35 [<Raw View>] [Type: url::Url]
36 [scheme] : "non-special"
37 [host] : "test"
38 [path] : "/x"
39
40 url_with_user_pass_port_query_fragments : "http://user:pass@foo:21/bar;par?b#c" [Type: url::Url]
41 [<Raw View>] [Type: url::Url]
42 [scheme] : "http"
43 [username] : "user"
44 [host] : "foo"
45 [port] : 21
46 [path] : "/bar;par"
47 [query] : "b"
48 [fragment] : "c"
49
50 url_blob : "blob:https://example.com:443/" [Type: url::Url]
51 [<Raw View>] [Type: url::Url]
52 [scheme] : "blob"
53 [path] : "https://example.com:443/"
54
55 url_with_base : "http://example.org/a%2fc" [Type: url::Url]
56 [<Raw View>] [Type: url::Url]
57 [scheme] : "http"
58 [host] : "example.org"
59 [path] : "/a%2fc"
60
61 url_with_base_replaced : "http://[::7f00:1]/" [Type: url::Url]
62 [<Raw View>] [Type: url::Url]
63 [scheme] : "http"
64 [host] : "[::7f00:1]"
65 [path] : "/"
66
67 url_with_comma : "data:text/html,test#test" [Type: url::Url]
68 [<Raw View>] [Type: url::Url]
69 [scheme] : "data"
70 [path] : "text/html,test"
71 [fragment] : "test"
72 "#
73 )]
test_url_visualizer()74 fn test_url_visualizer() {
75 // Copied from https://github.com/web-platform-tests/wpt/blob/master/url/
76 let base_url = Url::parse("http://example.org/foo/bar").unwrap();
77 assert_eq!(base_url.as_str(), "http://example.org/foo/bar");
78
79 let url_with_non_special_scheme = Url::parse("non-special://:@test/x").unwrap();
80 assert_eq!(url_with_non_special_scheme.as_str(), "non-special://test/x");
81
82 let url_with_user_pass_port_query_fragments =
83 Url::parse("http://user:pass@foo:21/bar;par?b#c").unwrap();
84 assert_eq!(
85 url_with_user_pass_port_query_fragments.as_str(),
86 "http://user:pass@foo:21/bar;par?b#c"
87 );
88
89 let url_blob = Url::parse("blob:https://example.com:443/").unwrap();
90 assert_eq!(url_blob.as_str(), "blob:https://example.com:443/");
91
92 let url_with_base = base_url.join("/a%2fc").unwrap();
93 assert_eq!(url_with_base.as_str(), "http://example.org/a%2fc");
94
95 let url_with_base_replaced = base_url.join("http://[::127.0.0.1]").unwrap();
96 assert_eq!(url_with_base_replaced.as_str(), "http://[::7f00:1]/");
97
98 let url_with_comma = base_url.join("data:text/html,test#test").unwrap();
99 assert_eq!(url_with_comma.as_str(), "data:text/html,test#test");
100
101 __break();
102 }
103