Add test case for #8776