aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/net_traits/lib.rs22
-rw-r--r--tests/unit/script/dom/xmlhttprequest.rs27
-rw-r--r--tests/unit/script/lib.rs1
3 files changed, 22 insertions, 28 deletions
diff --git a/tests/unit/net_traits/lib.rs b/tests/unit/net_traits/lib.rs
index 89bded99c22..0ea8e4cfe78 100644
--- a/tests/unit/net_traits/lib.rs
+++ b/tests/unit/net_traits/lib.rs
@@ -5,3 +5,25 @@
extern crate net_traits;
#[cfg(test)] mod image;
+
+#[test]
+fn test_trim_http_whitespace() {
+ fn test_trim(in_: &[u8], out: &[u8]) {
+ let b = net_traits::trim_http_whitespace(in_);
+ assert_eq!(b, out);
+ }
+
+ test_trim(b"", b"");
+
+ test_trim(b" ", b"");
+ test_trim(b"a", b"a");
+ test_trim(b" a", b"a");
+ test_trim(b"a ", b"a");
+ test_trim(b" a ", b"a");
+
+ test_trim(b"\t", b"");
+ test_trim(b"a", b"a");
+ test_trim(b"\ta", b"a");
+ test_trim(b"a\t", b"a");
+ test_trim(b"\ta\t", b"a");
+}
diff --git a/tests/unit/script/dom/xmlhttprequest.rs b/tests/unit/script/dom/xmlhttprequest.rs
deleted file mode 100644
index f9d4ebc25e8..00000000000
--- a/tests/unit/script/dom/xmlhttprequest.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-/* 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/. */
-
-use script::dom::xmlhttprequest::trim_http_whitespace;
-
-#[test]
-fn test_trim_http_whitespace() {
- fn test_trim(in_: &[u8], out: &[u8]) {
- let b = trim_http_whitespace(in_);
- assert_eq!(b, out);
- }
-
- test_trim(b"", b"");
-
- test_trim(b" ", b"");
- test_trim(b"a", b"a");
- test_trim(b" a", b"a");
- test_trim(b"a ", b"a");
- test_trim(b" a ", b"a");
-
- test_trim(b"\t", b"");
- test_trim(b"a", b"a");
- test_trim(b"\ta", b"a");
- test_trim(b"a\t", b"a");
- test_trim(b"\ta\t", b"a");
-}
diff --git a/tests/unit/script/lib.rs b/tests/unit/script/lib.rs
index cab595e0500..c2829292bb9 100644
--- a/tests/unit/script/lib.rs
+++ b/tests/unit/script/lib.rs
@@ -15,5 +15,4 @@ extern crate url;
#[cfg(test)] mod dom {
mod bindings;
mod blob;
- mod xmlhttprequest;
}