Add testcase for #8565