summaryrefslogtreecommitdiffstats
path: root/third_party/rust/bytes-0.4.12/tests/test_iter.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/bytes-0.4.12/tests/test_iter.rs')
-rw-r--r--third_party/rust/bytes-0.4.12/tests/test_iter.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/third_party/rust/bytes-0.4.12/tests/test_iter.rs b/third_party/rust/bytes-0.4.12/tests/test_iter.rs
new file mode 100644
index 0000000000..c16dbf694b
--- /dev/null
+++ b/third_party/rust/bytes-0.4.12/tests/test_iter.rs
@@ -0,0 +1,22 @@
+extern crate bytes;
+
+use bytes::{Buf, IntoBuf, Bytes};
+
+#[test]
+fn iter_len() {
+ let buf = Bytes::from(&b"hello world"[..]).into_buf();
+ let iter = buf.iter();
+
+ assert_eq!(iter.size_hint(), (11, Some(11)));
+ assert_eq!(iter.len(), 11);
+}
+
+
+#[test]
+fn empty_iter_len() {
+ let buf = Bytes::from(&b""[..]).into_buf();
+ let iter = buf.iter();
+
+ assert_eq!(iter.size_hint(), (0, Some(0)));
+ assert_eq!(iter.len(), 0);
+}