Added test for loading unsafe debug library in Lua

This commit is contained in:
Timidger 2017-10-29 14:53:30 -07:00
parent 2658433bd1
commit 26b7901ab3
1 changed files with 17 additions and 0 deletions

View File

@ -14,6 +14,23 @@ fn test_load() {
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]
fn test_exec() {
let lua = Lua::new();