debugger_visualizer.rs 3.2 KB

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