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:
Nick Mathewson 2021-11-15 12:12:53 -05:00
parent 236255514a
commit 787a995458
2 changed files with 14 additions and 18 deletions

View File

@ -84,12 +84,10 @@ mod test {
#![allow(clippy::unwrap_used)]
use super::*;
use crate::circuit::sendme::{StreamRecvWindow, StreamSendWindow};
use tokio::test as async_test;
use tokio_crate as tokio;
use tor_cell::relaycell::msg;
#[async_test]
async fn halfstream_sendme() -> Result<()> {
#[test]
fn halfstream_sendme() -> Result<()> {
let mut sendw = StreamSendWindow::new(101);
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)
}
#[async_test]
async fn halfstream_data() {
#[test]
fn halfstream_data() {
let mut hs = hs_new();
// 20 data cells are okay.
@ -131,8 +129,8 @@ mod test {
);
}
#[async_test]
async fn halfstream_connected() {
#[test]
fn halfstream_connected() {
let mut hs = hs_new();
// We were told to accept a connected, so we'll accept one
// and no more.
@ -150,8 +148,8 @@ mod test {
);
}
#[async_test]
async fn halfstream_other() {
#[test]
fn halfstream_other() {
let mut hs = hs_new();
let m = msg::Extended2::new(Vec::new()).into();
let e = hs.handle_msg(&m).err().unwrap();

View File

@ -247,8 +247,6 @@ pub(crate) fn cell_counts_towards_windows(cell: &RelayCell) -> bool {
mod test {
#![allow(clippy::unwrap_used)]
use super::*;
use tokio::test as async_test;
use tokio_crate as tokio;
use tor_cell::relaycell::{msg, RelayCell};
#[test]
@ -291,8 +289,8 @@ mod test {
SendWindow::new(1000)
}
#[async_test]
async fn sendwindow_basic() -> Result<()> {
#[test]
fn sendwindow_basic() -> Result<()> {
let mut w = new_sendwindow();
let n = w.take(&"Hello")?;
@ -330,8 +328,8 @@ mod test {
Ok(())
}
#[async_test]
async fn sendwindow_bad_put() -> Result<()> {
#[test]
fn sendwindow_bad_put() -> Result<()> {
let mut w = new_sendwindow();
for _ in 0_usize..250 {
w.take(&"correct")?;
@ -359,8 +357,8 @@ mod test {
Ok(())
}
#[async_test]
async fn sendwindow_erroring() -> Result<()> {
#[test]
fn sendwindow_erroring() -> Result<()> {
let mut w = new_sendwindow();
for _ in 0_usize..1000 {
w.take(&"here a string")?;