Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit 50fe8ad

Browse files
author
Oliver Schneider
committed
test for #66
1 parent c9d84b7 commit 50fe8ad

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/json.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3848,6 +3848,18 @@ mod tests {
38483848
}
38493849
}
38503850

3851+
#[test]
3852+
fn test_bad_json_stack_depleted() {
3853+
use json;
3854+
#[derive(Debug, RustcDecodable)]
3855+
enum ChatEvent {
3856+
Variant(i32)
3857+
}
3858+
let serialized = "{\"variant\": \"Variant\", \"fields\": []}";
3859+
let r: Result<ChatEvent, _> = json::decode(serialized);
3860+
assert!(r.unwrap_err() == EOF);
3861+
}
3862+
38513863
#[bench]
38523864
fn bench_streaming_small(b: &mut Bencher) {
38533865
b.iter( || {

0 commit comments

Comments
 (0)