diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2021-03-03 22:32:22 +0000 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2021-03-03 22:32:22 +0000 |
commit | 7cb9c4f39ca3e58e4a135dcad2aa60c5620d9a7e (patch) | |
tree | ac1c5c0407a566870b2caa3e27d72a8a0f897555 /tests/async.rs | |
parent | b93ace022421aff6868f0b1de292c102d55d9ad1 (diff) | |
download | mlua-7cb9c4f39ca3e58e4a135dcad2aa60c5620d9a7e.zip |
Fix bug in returning nil-prefixed multi values from async function
Diffstat (limited to 'tests/async.rs')
-rw-r--r-- | tests/async.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/async.rs b/tests/async.rs index e2496f1..7d87b49 100644 --- a/tests/async.rs +++ b/tests/async.rs @@ -137,6 +137,24 @@ async fn test_async_handle_yield() -> Result<()> { } #[tokio::test] +async fn test_async_multi_return_nil() -> Result<()> { + let lua = Lua::new(); + lua.globals().set( + "func", + lua.create_async_function(|_, _: ()| async { Ok((Option::<String>::None, "error")) })?, + )?; + + lua.load( + r#" + local ok, err = func() + assert(err == "error") + "#, + ) + .exec_async() + .await +} + +#[tokio::test] async fn test_async_return_async_closure() -> Result<()> { let lua = Lua::new(); |