diff options
author | kyren <kerriganw@gmail.com> | 2018-02-06 00:54:04 -0500 |
---|---|---|
committer | kyren <kerriganw@gmail.com> | 2018-02-06 00:54:04 -0500 |
commit | 8820e7705c6f3cb2a0dcbdb16f8f609cb1327dcc (patch) | |
tree | 1938207370cbaac80e7991e7499095e2b9aea731 /src | |
parent | 79635f29be4b41bff9c3e4e261fde05bc89cb7f7 (diff) | |
download | mlua-8820e7705c6f3cb2a0dcbdb16f8f609cb1327dcc.zip |
test `owns_registry_value`
Diffstat (limited to 'src')
-rw-r--r-- | src/tests.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tests.rs b/src/tests.rs index bcbccc7..5acffa9 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -549,6 +549,20 @@ fn test_mismatched_lua_ref() { } #[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() { let lua1 = Lua::new(); |