tor-proto: Stop using async_test in halfstream.rs and sendme.rs
Thanks to eta's refactoring, these tests no longer need to be async.
This commit is contained in:
parent
236255514a
commit
787a995458
|
@ -84,12 +84,10 @@ mod test {
|
||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::circuit::sendme::{StreamRecvWindow, StreamSendWindow};
|
use crate::circuit::sendme::{StreamRecvWindow, StreamSendWindow};
|
||||||
use tokio::test as async_test;
|
|
||||||
use tokio_crate as tokio;
|
|
||||||
use tor_cell::relaycell::msg;
|
use tor_cell::relaycell::msg;
|
||||||
|
|
||||||
#[async_test]
|
#[test]
|
||||||
async fn halfstream_sendme() -> Result<()> {
|
fn halfstream_sendme() -> Result<()> {
|
||||||
let mut sendw = StreamSendWindow::new(101);
|
let mut sendw = StreamSendWindow::new(101);
|
||||||
sendw.take(&())?; // Make sure that it will accept one sendme.
|
sendw.take(&())?; // Make sure that it will accept one sendme.
|
||||||
|
|
||||||
|
@ -111,8 +109,8 @@ mod test {
|
||||||
HalfStream::new(StreamSendWindow::new(20), StreamRecvWindow::new(20), true)
|
HalfStream::new(StreamSendWindow::new(20), StreamRecvWindow::new(20), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_test]
|
#[test]
|
||||||
async fn halfstream_data() {
|
fn halfstream_data() {
|
||||||
let mut hs = hs_new();
|
let mut hs = hs_new();
|
||||||
|
|
||||||
// 20 data cells are okay.
|
// 20 data cells are okay.
|
||||||
|
@ -131,8 +129,8 @@ mod test {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_test]
|
#[test]
|
||||||
async fn halfstream_connected() {
|
fn halfstream_connected() {
|
||||||
let mut hs = hs_new();
|
let mut hs = hs_new();
|
||||||
// We were told to accept a connected, so we'll accept one
|
// We were told to accept a connected, so we'll accept one
|
||||||
// and no more.
|
// and no more.
|
||||||
|
@ -150,8 +148,8 @@ mod test {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_test]
|
#[test]
|
||||||
async fn halfstream_other() {
|
fn halfstream_other() {
|
||||||
let mut hs = hs_new();
|
let mut hs = hs_new();
|
||||||
let m = msg::Extended2::new(Vec::new()).into();
|
let m = msg::Extended2::new(Vec::new()).into();
|
||||||
let e = hs.handle_msg(&m).err().unwrap();
|
let e = hs.handle_msg(&m).err().unwrap();
|
||||||
|
|
|
@ -247,8 +247,6 @@ pub(crate) fn cell_counts_towards_windows(cell: &RelayCell) -> bool {
|
||||||
mod test {
|
mod test {
|
||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
use super::*;
|
use super::*;
|
||||||
use tokio::test as async_test;
|
|
||||||
use tokio_crate as tokio;
|
|
||||||
use tor_cell::relaycell::{msg, RelayCell};
|
use tor_cell::relaycell::{msg, RelayCell};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -291,8 +289,8 @@ mod test {
|
||||||
SendWindow::new(1000)
|
SendWindow::new(1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_test]
|
#[test]
|
||||||
async fn sendwindow_basic() -> Result<()> {
|
fn sendwindow_basic() -> Result<()> {
|
||||||
let mut w = new_sendwindow();
|
let mut w = new_sendwindow();
|
||||||
|
|
||||||
let n = w.take(&"Hello")?;
|
let n = w.take(&"Hello")?;
|
||||||
|
@ -330,8 +328,8 @@ mod test {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_test]
|
#[test]
|
||||||
async fn sendwindow_bad_put() -> Result<()> {
|
fn sendwindow_bad_put() -> Result<()> {
|
||||||
let mut w = new_sendwindow();
|
let mut w = new_sendwindow();
|
||||||
for _ in 0_usize..250 {
|
for _ in 0_usize..250 {
|
||||||
w.take(&"correct")?;
|
w.take(&"correct")?;
|
||||||
|
@ -359,8 +357,8 @@ mod test {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_test]
|
#[test]
|
||||||
async fn sendwindow_erroring() -> Result<()> {
|
fn sendwindow_erroring() -> Result<()> {
|
||||||
let mut w = new_sendwindow();
|
let mut w = new_sendwindow();
|
||||||
for _ in 0_usize..1000 {
|
for _ in 0_usize..1000 {
|
||||||
w.take(&"here a string")?;
|
w.take(&"here a string")?;
|
||||||
|
|
Loading…
Reference in New Issue