Skip to content

Commit 8400386

Browse files
author
Your Name
committed
fix
1 parent 10d2df4 commit 8400386

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

tests/thread.rs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -512,46 +512,46 @@ fn test_continuation() {
512512
let v = th.resume::<i32>(v).expect("Failed to load continuation");
513513

514514
assert_eq!(v, 7);
515+
}
515516

516-
// test panics
517-
let cont_func = lua
518-
.create_function_with_continuation(
519-
|lua, a: u64| {
520-
match lua.set_yield_args(a) {
521-
Ok(()) => println!("set_yield_args called"),
522-
Err(e) => println!("{:?}", e),
523-
};
524-
Ok(())
525-
},
526-
|_lua, _status, _a: u64| {
527-
panic!("Reached continuation which should panic!");
528-
#[allow(unreachable_code)]
529-
Ok(())
530-
},
531-
)
532-
.expect("Failed to create cont_func");
517+
// test panics
518+
let cont_func = lua
519+
.create_function_with_continuation(
520+
|lua, a: u64| {
521+
match lua.set_yield_args(a) {
522+
Ok(()) => println!("set_yield_args called"),
523+
Err(e) => println!("{:?}", e),
524+
};
525+
Ok(())
526+
},
527+
|_lua, _status, _a: u64| {
528+
panic!("Reached continuation which should panic!");
529+
#[allow(unreachable_code)]
530+
Ok(())
531+
},
532+
)
533+
.expect("Failed to create cont_func");
533534

534-
let luau_func = lua
535-
.load(
536-
"
535+
let luau_func = lua
536+
.load(
537+
"
537538
local cont_func = ...
538539
local ok, res = pcall(cont_func, 1)
539540
assert(not ok)
540541
return tostring(res)
541542
",
542-
)
543-
.into_function()
544-
.expect("Failed to create function");
543+
)
544+
.into_function()
545+
.expect("Failed to create function");
545546

546-
let th = lua
547-
.create_thread(luau_func)
548-
.expect("Failed to create luau thread");
547+
let th = lua
548+
.create_thread(luau_func)
549+
.expect("Failed to create luau thread");
549550

550-
let v = th
551-
.resume::<mlua::MultiValue>(cont_func)
552-
.expect("Failed to resume");
551+
let v = th
552+
.resume::<mlua::MultiValue>(cont_func)
553+
.expect("Failed to resume");
553554

554-
let v = th.resume::<String>(v).expect("Failed to load continuation");
555-
assert!(v.contains("Reached continuation which should panic!"));
556-
}
555+
let v = th.resume::<String>(v).expect("Failed to load continuation");
556+
assert!(v.contains("Reached continuation which should panic!"));
557557
}

0 commit comments

Comments
 (0)