Add limited recursion test to increase coverage
This commit is contained in:
parent
8d474bbf8d
commit
e4daff8c16
|
@ -846,6 +846,25 @@ fn test_mismatched_registry_key() -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_recursion() -> Result<()> {
|
||||||
|
let lua = Lua::new();
|
||||||
|
|
||||||
|
let f = lua.create_function(move |lua, i: i32| {
|
||||||
|
if i < 64 {
|
||||||
|
lua.globals()
|
||||||
|
.get::<_, Function>("f")?
|
||||||
|
.call::<_, ()>(i + 1)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})?;
|
||||||
|
|
||||||
|
lua.globals().set("f", f.clone())?;
|
||||||
|
f.call::<_, ()>(1)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_too_many_returns() -> Result<()> {
|
fn test_too_many_returns() -> Result<()> {
|
||||||
let lua = Lua::new();
|
let lua = Lua::new();
|
||||||
|
|
Loading…
Reference in New Issue