@@ -512,46 +512,46 @@ fn test_continuation() {
512
512
let v = th. resume :: < i32 > ( v) . expect ( "Failed to load continuation" ) ;
513
513
514
514
assert_eq ! ( v, 7 ) ;
515
+ }
515
516
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" ) ;
533
534
534
- let luau_func = lua
535
- . load (
536
- "
535
+ let luau_func = lua
536
+ . load (
537
+ "
537
538
local cont_func = ...
538
539
local ok, res = pcall(cont_func, 1)
539
540
assert(not ok)
540
541
return tostring(res)
541
542
" ,
542
- )
543
- . into_function ( )
544
- . expect ( "Failed to create function" ) ;
543
+ )
544
+ . into_function ( )
545
+ . expect ( "Failed to create function" ) ;
545
546
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" ) ;
549
550
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" ) ;
553
554
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!" ) ) ;
557
557
}
0 commit comments