From 0ce9c7a5b0d694bd01d74d7f47b990063765f94b Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Fri, 31 Jul 2020 20:18:00 +0600 Subject: [PATCH] Compile tests/redis.rs only if all the features are satisfied --- tests/redis.rs | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/tests/redis.rs b/tests/redis.rs index 41e21a73..3d9da600 100644 --- a/tests/redis.rs +++ b/tests/redis.rs @@ -1,28 +1,45 @@ +#![cfg(feature = "redis_storage")] + use std::{ fmt::{Debug, Display}, future::Future, sync::Arc, }; -use teloxide::dispatching::dialogue::{ - serializer::{Bincode, CBOR, JSON}, - RedisStorage, Serializer, Storage, -}; +use teloxide::dispatching::dialogue::{RedisStorage, Serializer, Storage}; #[tokio::test] +#[cfg(feature = "redis_storage")] async fn test_redis_json() { - let storage = RedisStorage::open("redis://127.0.0.1:7777", JSON).await.unwrap(); + let storage = RedisStorage::open( + "redis://127.0.0.1:7777", + teloxide::dispatching::dialogue::serializer::JSON, + ) + .await + .unwrap(); test_redis(storage).await; } +#[cfg(feature = "bincode_serializer")] #[tokio::test] async fn test_redis_bincode() { - let storage = RedisStorage::open("redis://127.0.0.1:7778", Bincode).await.unwrap(); + let storage = RedisStorage::open( + "redis://127.0.0.1:7778", + teloxide::dispatching::dialogue::serializer::Bincode, + ) + .await + .unwrap(); test_redis(storage).await; } +#[cfg(feature = "cbor_serializer")] #[tokio::test] async fn test_redis_cbor() { - let storage = RedisStorage::open("redis://127.0.0.1:7779", CBOR).await.unwrap(); + let storage = RedisStorage::open( + "redis://127.0.0.1:7779", + teloxide::dispatching::dialogue::serializer::CBOR, + ) + .await + .unwrap(); test_redis(storage).await; }