tests: Add test for catching infinite function recursion.

Put into misc/ to not complicate life for builds with check disabled.