Added test for loading unsafe debug library in Lua
This commit is contained in:
parent
2658433bd1
commit
26b7901ab3
17
src/tests.rs
17
src/tests.rs
|
@ -14,6 +14,23 @@ fn test_load() {
|
||||||
assert!(lua.load("§$%§&$%&", None).is_err());
|
assert!(lua.load("§$%§&$%&", None).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_load_debug() {
|
||||||
|
let lua = Lua::new();
|
||||||
|
lua.eval::<()>("debug", None).unwrap();
|
||||||
|
unsafe {
|
||||||
|
lua.load_debug();
|
||||||
|
}
|
||||||
|
match lua.eval("debug", None).unwrap() {
|
||||||
|
Value::Table(_) => {},
|
||||||
|
val => {
|
||||||
|
panic!("Expected table for debug library, got {:#?}", val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let traceback_output = lua.eval::<String>("debug.traceback()", None).unwrap();
|
||||||
|
assert_eq!(traceback_output.split("\n").next(), "stack traceback:".into());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_exec() {
|
fn test_exec() {
|
||||||
let lua = Lua::new();
|
let lua = Lua::new();
|
||||||
|
|
Loading…
Reference in New Issue