Test cases for #1007