From 24e0c968eefd8e165e5abf935dfde8d50d41bf93 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Tue, 7 Jan 2020 00:46:12 +0800 Subject: [PATCH] fix tests --- Cargo.toml | 3 +++ README.md | 4 ++++ src/lib.rs | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6af5061..36a4d19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,3 +16,6 @@ reqwest = "0.10.0" urlencoding = "1.0.0" json = "0.12.0" futures = "0.3.1" + +[dev-dependencies] +tokio-test = "0.2.0" diff --git a/README.md b/README.md index dd31d77..1ee1596 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ NOTE: From version 1.1.0 dingtalk uses reqwest 0.10.0's async/await API. Sample 1: ```rust +use dingtalk::DingTalk; + #[tokio::main] pub async fn main() -> Result<(), Box> { let dt = DingTalk::new("", ""); @@ -18,6 +20,8 @@ pub async fn main() -> Result<(), Box> { } ``` +Need use crate: `tokio = { version = "0.2.6", features = ["full"] }`. + Sample 2 (Read token from file): ```rust #[tokio::main] diff --git a/src/lib.rs b/src/lib.rs index e374050..74afda5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -497,7 +497,7 @@ fn calc_hmac_sha256(key: &[u8], message: &[u8]) -> MacResult { #[test] fn run_all_tests() { - futures::executor::block_on(_test_send()).unwrap(); + tokio_test::block_on(_test_send()).unwrap(); } async fn _test_send() -> XResult<()> {