Add unit test for scope/stack trace generation