mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
Implement 'url!(..)' macro
https://github.com/servo/rust-url/issues/136 https://github.com/servo/rust-url/pull/137
This commit is contained in:
parent
0146751bb2
commit
f34da4120d
30 changed files with 346 additions and 128 deletions
15
tests/unit/plugin/Cargo.toml
Normal file
15
tests/unit/plugin/Cargo.toml
Normal file
|
@ -0,0 +1,15 @@
|
|||
[package]
|
||||
name = "plugin_tests"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
|
||||
[lib]
|
||||
name = "plugin_tests"
|
||||
path = "lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies.plugins]
|
||||
path = "../../../components/plugins"
|
||||
|
||||
[dependencies.url]
|
||||
version = "0.2.36"
|
11
tests/unit/plugin/lib.rs
Normal file
11
tests/unit/plugin/lib.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![feature(plugin)]
|
||||
#![plugin(plugins)]
|
||||
|
||||
extern crate url;
|
||||
|
||||
#[cfg(test)]
|
||||
mod url_plugin;
|
24
tests/unit/plugin/url_plugin.rs
Normal file
24
tests/unit/plugin/url_plugin.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#[test]
|
||||
fn test_url_plugin() {
|
||||
assert_eq!("ftp://google.com/",
|
||||
url!("ftp://google.com").to_string());
|
||||
|
||||
assert_eq!("ftp://google.com:443/",
|
||||
url!("ftp://google.com:443").to_string());
|
||||
|
||||
assert_eq!("ftp://google.com:443/a/b/c",
|
||||
url!("ftp://google.com:443/a/b/c").to_string());
|
||||
|
||||
assert_eq!("ftp://google.com:443/?a=b&c=d",
|
||||
url!("ftp://google.com:443?a=b&c=d").to_string());
|
||||
|
||||
assert_eq!("http://[2001::1]/",
|
||||
url!("http://[2001::1]:80").to_string());
|
||||
|
||||
assert_eq!("about:blank",
|
||||
url!("about:blank").to_string());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue