Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
DelSkayn committed Apr 24, 2024
1 parent 5daf2d9 commit 9ba52be
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions core/src/value/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,28 +573,13 @@ mod test {
assert_eq!(module.name::<StdString>().unwrap(), "Test");
let _ = module.meta::<Object>().unwrap();

let names = module
.namespace()
.unwrap()
.keys()
.collect::<Result<Vec<StdString>>>()
.unwrap();

assert_eq!(names[0], "a");
assert_eq!(names[1], "foo");
assert_eq!(names[2], "Baz");
let ns = module.namespace().unwrap();

let entries = module
.namespace()
.unwrap()
.props()
.collect::<Result<Vec<(StdString, Value)>>>()
.unwrap();
assert!(ns.contains_key("a").unwrap());
assert!(ns.contains_key("foo").unwrap());
assert!(ns.contains_key("Baz").unwrap());

assert_eq!(entries[0].0, "a");
assert_eq!(i32::from_js(&ctx, entries[0].1.clone()).unwrap(), 2);
assert_eq!(entries[1].0, "foo");
assert_eq!(entries[2].0, "Baz");
assert_eq!(ns.get::<_, u32>("a").unwrap(), 2u32);
});
}
}

0 comments on commit 9ba52be

Please sign in to comment.