Add limited recursion test to increase coverage

This commit is contained in:
Alex Orlenko 2021-06-21 12:18:06 +01:00
parent 8d474bbf8d
commit e4daff8c16
No known key found for this signature in database
GPG Key ID: 4C150C250863B96D
1 changed files with 19 additions and 0 deletions

View File

@ -846,6 +846,25 @@ fn test_mismatched_registry_key() -> Result<()> {
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]
fn test_too_many_returns() -> Result<()> {
let lua = Lua::new();