-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The previous implementation was incorrect because it essentially recreated a slice of the Buffer on each call, meaning that read progress information was lost across calls. The implementation has been removed since the implementation was very basic anyways. Going forward, one can Read from a Buffer by first getting a slice of the Buffer and then using _its_ Read implementation. See the regression test in this commit for an example of using read_to_end(). Fixes #6
- Loading branch information
Showing
3 changed files
with
23 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "hoedown" | ||
version = "5.0.0" | ||
version = "6.0.0" | ||
authors = ["Jorge Israel Peña <[email protected]>"] | ||
description = "bindings for the Hoedown markdown processor" | ||
repository = "https://github.com/blaenk/hoedown" | ||
|
@@ -14,6 +14,7 @@ libc = "0.2" | |
|
||
[dev-dependencies] | ||
glob = "0.2" | ||
timebomb = "0.1.2" | ||
|
||
[build-dependencies] | ||
gcc = "0.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
extern crate hoedown; | ||
extern crate timebomb; | ||
|
||
use std::vec::Vec; | ||
use std::io::Read; | ||
|
||
use hoedown::Buffer; | ||
|
||
use timebomb::timeout_ms; | ||
|
||
#[test] | ||
fn test_read_to_end() { | ||
let buffer = Buffer::from("This is a test"); | ||
let mut destination = Vec::new(); | ||
|
||
timeout_ms(move || { | ||
let mut slice: &[u8] = &buffer; | ||
|
||
slice.read_to_end(&mut destination).unwrap(); | ||
}, 1000); | ||
} |