mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-26 00:00:20 +02:00
Fix tests for no_std build (#384)
This fixes `cargo test --no-default-features`.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#![deny(warnings, rust_2018_idioms)]
|
#![deny(warnings, rust_2018_idioms)]
|
||||||
|
|
||||||
use bytes::Buf;
|
use bytes::Buf;
|
||||||
|
#[cfg(feature = "std")]
|
||||||
use std::io::IoSlice;
|
use std::io::IoSlice;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -42,6 +43,7 @@ fn test_get_u16_buffer_underflow() {
|
|||||||
buf.get_u16();
|
buf.get_u16();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_bufs_vec() {
|
fn test_bufs_vec() {
|
||||||
let buf = &b"hello world"[..];
|
let buf = &b"hello world"[..];
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#![deny(warnings, rust_2018_idioms)]
|
#![deny(warnings, rust_2018_idioms)]
|
||||||
|
|
||||||
use bytes::{buf::IoSliceMut, BufMut, BytesMut};
|
use bytes::{BufMut, BytesMut};
|
||||||
use std::usize;
|
#[cfg(feature = "std")]
|
||||||
use std::fmt::Write;
|
use bytes::buf::IoSliceMut;
|
||||||
|
use core::usize;
|
||||||
|
use core::fmt::Write;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_vec_as_mut_buf() {
|
fn test_vec_as_mut_buf() {
|
||||||
@@ -64,6 +66,7 @@ fn test_clone() {
|
|||||||
assert!(buf != buf2);
|
assert!(buf != buf2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_bufs_vec_mut() {
|
fn test_bufs_vec_mut() {
|
||||||
let b1: &mut [u8] = &mut [];
|
let b1: &mut [u8] = &mut [];
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use bytes::{Buf, BufMut, Bytes};
|
use bytes::{Buf, BufMut, Bytes};
|
||||||
use bytes::buf::{BufExt, BufMutExt};
|
use bytes::buf::{BufExt, BufMutExt};
|
||||||
|
#[cfg(feature = "std")]
|
||||||
use std::io::IoSlice;
|
use std::io::IoSlice;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -42,6 +43,7 @@ fn iterating_two_bufs() {
|
|||||||
assert_eq!(res, &b"helloworld"[..]);
|
assert_eq!(res, &b"helloworld"[..]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
#[test]
|
#[test]
|
||||||
fn vectored_read() {
|
fn vectored_read() {
|
||||||
let a = Bytes::from(&b"hello"[..]);
|
let a = Bytes::from(&b"hello"[..]);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#![deny(warnings, rust_2018_idioms)]
|
#![deny(warnings, rust_2018_idioms)]
|
||||||
|
#![cfg(feature = "std")]
|
||||||
|
|
||||||
use std::io::{BufRead, Read};
|
use std::io::{BufRead, Read};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user