@@ -106,7 +106,6 @@ fn test_exec() -> Result<()> {
106
106
"# ,
107
107
)
108
108
. eval ( ) ?;
109
- println ! ( "checkpoint" ) ;
110
109
assert ! ( module. contains_key( "func" ) ?) ;
111
110
assert_eq ! ( module. get:: <Function >( "func" ) ?. call:: <String >( ( ) ) ?, "hello" ) ;
112
111
@@ -631,8 +630,7 @@ fn test_recursive_mut_callback_error() -> Result<()> {
631
630
// Whoops, this will recurse into the function and produce another mutable reference!
632
631
lua. globals ( ) . get :: < Function > ( "f" ) ?. call :: < ( ) > ( true ) ?;
633
632
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 _) ;
636
634
}
637
635
638
636
Ok ( ( ) )
@@ -1134,6 +1132,13 @@ fn test_inspect_stack() -> Result<()> {
1134
1132
} ) ?;
1135
1133
lua. globals ( ) . set ( "logline" , logline) ?;
1136
1134
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
+
1137
1142
lua. load (
1138
1143
r#"
1139
1144
local function foo()
@@ -1143,10 +1148,18 @@ fn test_inspect_stack() -> Result<()> {
1143
1148
local function bar()
1144
1149
return foo()
1145
1150
end
1151
+ local stack_info = stack_info
1152
+ local function baz(a, b, c, ...)
1153
+ return stack_info()
1154
+ end
1146
1155
1147
1156
assert(foo() == '[string "chunk"]:3 hello')
1148
1157
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
+ )
1150
1163
"# ,
1151
1164
)
1152
1165
. set_name ( "chunk" )
0 commit comments