From 8820e7705c6f3cb2a0dcbdb16f8f609cb1327dcc Mon Sep 17 00:00:00 2001 From: kyren Date: Tue, 6 Feb 2018 00:54:04 -0500 Subject: [PATCH] test `owns_registry_value` --- src/tests.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/tests.rs b/src/tests.rs index bcbccc7..5acffa9 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -548,6 +548,20 @@ fn test_mismatched_lua_ref() { 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] #[should_panic] fn test_mismatched_registry_key() {