Fix "unused" warning in tests
This commit is contained in:
parent
a62636fde0
commit
790df77965
|
@ -1,6 +1,6 @@
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
use mlua::{Function, Lua, Result, Table};
|
use mlua::{Lua, Result, Table};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_static_lua() -> Result<()> {
|
fn test_static_lua() -> Result<()> {
|
||||||
|
@ -73,16 +73,17 @@ fn test_static_lua_coroutine() -> Result<()> {
|
||||||
async fn test_static_async() -> Result<()> {
|
async fn test_static_async() -> Result<()> {
|
||||||
let lua = Lua::new().into_static();
|
let lua = Lua::new().into_static();
|
||||||
|
|
||||||
let timer = lua.create_async_function(|_, (i, n, f): (u64, u64, Function)| async move {
|
let timer =
|
||||||
tokio::task::spawn_local(async move {
|
lua.create_async_function(|_, (i, n, f): (u64, u64, mlua::Function)| async move {
|
||||||
let dur = std::time::Duration::from_millis(i);
|
tokio::task::spawn_local(async move {
|
||||||
for _ in 0..n {
|
let dur = std::time::Duration::from_millis(i);
|
||||||
tokio::task::spawn_local(f.call_async::<(), ()>(()));
|
for _ in 0..n {
|
||||||
tokio::time::sleep(dur).await;
|
tokio::task::spawn_local(f.call_async::<(), ()>(()));
|
||||||
}
|
tokio::time::sleep(dur).await;
|
||||||
});
|
}
|
||||||
Ok(())
|
});
|
||||||
})?;
|
Ok(())
|
||||||
|
})?;
|
||||||
lua.globals().set("timer", timer)?;
|
lua.globals().set("timer", timer)?;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue