Skip to content

Commit 53c3638

Browse files
committed
Fix docs
1 parent 2f0145e commit 53c3638

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ bytes = "1.0.1"
1818
tokio = {version = "1.5.0", features = ["net", "io-util", "io-std"]}
1919

2020
[dev-dependencies]
21-
tokio = {version="1.5.0", features=["rt", "macros"]}
21+
tokio = {version="1.5.0", features=["rt-multi-thread", "macros"]}

src/deserializer.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ fn read_line_and_return_next_line<'a>(pos: &mut usize, buf: &'a [u8]) -> Option<
302302

303303
#[cfg(test)]
304304
#[test]
305-
fn test_parser() {
305+
fn test_deserializer_responseitem() {
306306
let res = "#2\n*1\n#2\n&1\n+4\nHEY!\n".as_bytes().to_owned();
307307
assert_eq!(
308308
parse(&res),
@@ -313,11 +313,17 @@ fn test_parser() {
313313
parse(&res),
314314
ClientResult::ResponseItem(DataType::RespCode(RespCode::Okay), res.len())
315315
);
316+
}
317+
318+
#[cfg(test)]
319+
#[test]
320+
fn test_deserializer_simple_response() {
316321
let res = "#2\n*1\n#2\n&5\n!1\n1\n!1\n0\n+5\nsayan\n+2\nis\n+4\nbusy\n"
317322
.as_bytes()
318323
.to_owned();
324+
let ret = parse(&res);
319325
assert_eq!(
320-
parse(&res),
326+
ret,
321327
ClientResult::SimpleResponse(
322328
DataGroup(vec![
323329
DataType::RespCode(RespCode::NotFound),
@@ -329,4 +335,11 @@ fn test_parser() {
329335
res.len()
330336
)
331337
);
338+
if let ClientResult::SimpleResponse(ret, _) = ret {
339+
for val in ret {
340+
let _ = format!("{:?}", val);
341+
}
342+
} else {
343+
panic!("Expected a SimpleResponse with a single datagroup")
344+
}
332345
}

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
//! skytable = "0.1.0"
4242
//! ```
4343
//! Now open up your `src/main.rs` file and establish a connection to the server:
44-
//! ```no_run
44+
//! ```ignore
4545
//! use skytable::{Connection};
46-
//! async fn main() {
46+
//! async fn main() -> std::io::Result<()> {
4747
//! let mut con = Connection::new("127.0.0.1", 2003).await.unwrap();
4848
//! }
4949
//! ```
@@ -58,7 +58,7 @@
5858
//! tokio = {version="1.5.0", features=["full"]}
5959
//! ```
6060
//! And your `main.rs` should now look like:
61-
//! ```no_run
61+
//! ```ignore
6262
//! use skytable::{Connection, Query, Response, RespCode, DataType};
6363
//! #[tokio::main]
6464
//! async fn main() -> std::io::Result<()> {
@@ -67,7 +67,7 @@
6767
//! ```
6868
//!
6969
//! Now let's run a [`Query`]! Add this below the previous line:
70-
//! ```no_run
70+
//! ```ignore
7171
//! let mut query = Query::new();
7272
//! query.arg("heya");
7373
//! let res = con.run_simple_query(query).await?;

0 commit comments

Comments
 (0)