Skip to content

Commit

Permalink
Test stream behavior after error
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 4, 2020
1 parent fd6741f commit a1b1199
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,14 @@ fn test_json_stream_invalid_number() {
assert_eq!(second.to_string(), "trailing characters at line 1 column 2");
});
}

#[test]
fn test_error() {
let data = "true wrong false";

test_stream!(data, Value, |stream| {
assert_eq!(stream.next().unwrap().unwrap(), true);
assert!(stream.next().unwrap().is_err());
assert!(stream.next().is_none());
});
}

0 comments on commit a1b1199

Please sign in to comment.