Add tests
Fix GH-8932: Provide a way to get the called-scope of closures (#9299) Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>