summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2022-02-12 18:36:26 +0000
committerAlex Orlenko <zxteam@protonmail.com>2022-02-12 18:40:18 +0000
commit9a5a341e44eb28f6f78d013b1ff9162f79eff163 (patch)
tree4cb79121db993ee3fd4f19d680bdfefa76da4cf6 /tests
parentdd91ebfbe545841f0dbe8d573fd90ad6f7c41c5b (diff)
downloadmlua-9a5a341e44eb28f6f78d013b1ff9162f79eff163.zip
Recognize LuaJIT TCDATA type to generate correct panic message.
Relates to #127 Should be fixed in a next major release by adding support of TCDATA type.
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index 95c41ad..4b92d4f 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -1256,3 +1256,24 @@ fn test_warnings() -> Result<()> {
Ok(())
}
+
+#[test]
+#[cfg(feature = "luajit")]
+#[should_panic]
+fn test_luajit_cdata() {
+ let lua = unsafe { Lua::unsafe_new() };
+ let _v: Result<Value> = lua
+ .load(
+ r#"
+ local ffi = require("ffi")
+ ffi.cdef[[
+ void *malloc(size_t size);
+ void free(void *ptr);
+ ]]
+ local ptr = ffi.C.malloc(1)
+ ffi.C.free(ptr)
+ return ptr
+ "#,
+ )
+ .eval();
+}