diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2022-05-18 13:15:08 +0100 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2022-05-18 13:15:08 +0100 |
commit | bcf2cbea3798504471d88345327671bf2da7e8e1 (patch) | |
tree | f3f2e13bdb16a6de0ee521628a3accfa7fb7f9c1 /tests | |
parent | 8cd594c609d94f9d32cbf19c9a039b6a3c046823 (diff) | |
download | mlua-bcf2cbea3798504471d88345327671bf2da7e8e1.zip |
Add `Value::to_pointer()` function.
Closes #165 and #166.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/value.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/value.rs b/tests/value.rs index 9beb68c..2f9c1e7 100644 --- a/tests/value.rs +++ b/tests/value.rs @@ -1,3 +1,5 @@ +use std::ptr; + use mlua::{Lua, Result, Value}; #[test] @@ -41,17 +43,23 @@ fn test_value_eq() -> Result<()> { let thread2: Value = globals.get("thread2")?; assert!(table1 != table2); - assert!(table1.equals(table2)?); + assert!(table1.equals(&table2)?); assert!(string1 == string2); - assert!(string1.equals(string2)?); + assert!(string1.equals(&string2)?); assert!(num1 == num2); assert!(num1.equals(num2)?); assert!(num1 != num3); assert!(func1 == func2); assert!(func1 != func3); - assert!(!func1.equals(func3)?); + assert!(!func1.equals(&func3)?); assert!(thread1 == thread2); - assert!(thread1.equals(thread2)?); + assert!(thread1.equals(&thread2)?); + + assert!(!table1.to_pointer().is_null()); + assert!(!ptr::eq(table1.to_pointer(), table2.to_pointer())); + assert!(ptr::eq(string1.to_pointer(), string2.to_pointer())); + assert!(ptr::eq(func1.to_pointer(), func2.to_pointer())); + assert!(num1.to_pointer().is_null()); Ok(()) } |