@@ -106,7 +106,6 @@ fn test_exec() -> Result<()> {
106106 "# ,
107107 )
108108 . eval ( ) ?;
109- println ! ( "checkpoint" ) ;
110109 assert ! ( module. contains_key( "func" ) ?) ;
111110 assert_eq ! ( module. get:: <Function >( "func" ) ?. call:: <String >( ( ) ) ?, "hello" ) ;
112111
@@ -631,8 +630,7 @@ fn test_recursive_mut_callback_error() -> Result<()> {
631630 // Whoops, this will recurse into the function and produce another mutable reference!
632631 lua. globals ( ) . get :: < Function > ( "f" ) ?. call :: < ( ) > ( true ) ?;
633632 println ! ( "Should not get here, mutable aliasing has occurred!" ) ;
634- println ! ( "value at {:p}" , r as * mut _) ;
635- println ! ( "value is {}" , r) ;
633+ println ! ( "value at {:p} is {r}" , r as * mut _) ;
636634 }
637635
638636 Ok ( ( ) )
@@ -1134,6 +1132,13 @@ fn test_inspect_stack() -> Result<()> {
11341132 } ) ?;
11351133 lua. globals ( ) . set ( "logline" , logline) ?;
11361134
1135+ let stack_info = lua. create_function ( |lua, ( ) | {
1136+ let debug = lua. inspect_stack ( 1 ) . unwrap ( ) ; // caller
1137+ let stack_info = debug. stack ( ) ;
1138+ Ok ( format ! ( "{stack_info:?}" ) )
1139+ } ) ?;
1140+ lua. globals ( ) . set ( "stack_info" , stack_info) ?;
1141+
11371142 lua. load (
11381143 r#"
11391144 local function foo()
@@ -1143,10 +1148,18 @@ fn test_inspect_stack() -> Result<()> {
11431148 local function bar()
11441149 return foo()
11451150 end
1151+ local stack_info = stack_info
1152+ local function baz(a, b, c, ...)
1153+ return stack_info()
1154+ end
11461155
11471156 assert(foo() == '[string "chunk"]:3 hello')
11481157 assert(bar() == '[string "chunk"]:3 hello')
1149- assert(logline("world") == '[string "chunk"]:12 world')
1158+ assert(logline("world") == '[string "chunk"]:16 world')
1159+ assert(
1160+ baz() == 'DebugStack { num_ups: 1, num_params: 3, is_vararg: true }' or
1161+ baz() == 'DebugStack { num_ups: 1 }'
1162+ )
11501163 "# ,
11511164 )
11521165 . set_name ( "chunk" )
0 commit comments