Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: introduce serde_v8 #9722

Merged
merged 24 commits into from
Mar 26, 2021
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
serde_v8: test de_map
  • Loading branch information
AaronO committed Mar 24, 2021
commit 1a1ac2a3348e6056f26b808988261969a7cf07b4
13 changes: 13 additions & 0 deletions serde_v8/tests/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@ fn de_f64() {
assert!((x - 12345.0).abs() < f64::EPSILON);
});
}

#[test]
fn de_map() {
use std::collections::HashMap;

dedo("({a: 1, b: 2, c: 3})", |scope, v| {
let map: HashMap<String, u64> = serde_v8::from_v8(scope, v).unwrap();
assert_eq!(map.get("a").cloned(), Some(1));
assert_eq!(map.get("b").cloned(), Some(2));
assert_eq!(map.get("c").cloned(), Some(3));
assert_eq!(map.get("nada"), None);
})
}