test `owns_registry_value`
This commit is contained in:
parent
79635f29be
commit
8820e7705c
14
src/tests.rs
14
src/tests.rs
|
@ -548,6 +548,20 @@ fn test_mismatched_lua_ref() {
|
||||||
f.call::<_, ()>(s).unwrap();
|
f.call::<_, ()>(s).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_lua_registry_ownership() {
|
||||||
|
let lua1 = Lua::new();
|
||||||
|
let lua2 = Lua::new();
|
||||||
|
|
||||||
|
let r1 = lua1.create_registry_value("hello").unwrap();
|
||||||
|
let r2 = lua2.create_registry_value("hello").unwrap();
|
||||||
|
|
||||||
|
assert!(lua1.owns_registry_value(&r1));
|
||||||
|
assert!(!lua2.owns_registry_value(&r1));
|
||||||
|
assert!(lua2.owns_registry_value(&r2));
|
||||||
|
assert!(!lua1.owns_registry_value(&r2));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_mismatched_registry_key() {
|
fn test_mismatched_registry_key() {
|
||||||
|
|
Loading…
Reference in New Issue